space_highlight_rules.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. define(function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var SpaceHighlightRules = function() {
  6. // Todo: support multiline values that escape the newline with spaces.
  7. this.$rules = {
  8. "start" : [
  9. {
  10. token : "empty_line",
  11. regex : / */,
  12. next : "key"
  13. },
  14. {
  15. token : "empty_line",
  16. regex : /$/,
  17. next : "key"
  18. }
  19. ],
  20. "key" : [
  21. {
  22. token : "variable",
  23. regex : /\S+/
  24. },
  25. {
  26. token : "empty_line",
  27. regex : /$/,
  28. next : "start"
  29. },{
  30. token : "keyword.operator",
  31. regex : / /,
  32. next : "value"
  33. }
  34. ],
  35. "value" : [
  36. {
  37. token : "keyword.operator",
  38. regex : /$/,
  39. next : "start"
  40. },
  41. {
  42. token : "string",
  43. regex : /[^$]/
  44. }
  45. ]
  46. };
  47. };
  48. oop.inherits(SpaceHighlightRules, TextHighlightRules);
  49. exports.SpaceHighlightRules = SpaceHighlightRules;
  50. });