mode-yql.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. define("ace/mode/yql_highlight_rules",
  2. ["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],
  3. function(require, exports, module) {
  4. "use strict";
  5. var oop = require("../lib/oop");
  6. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  7. var YqlHighlightRules = function() {
  8. var keywordControl = "let|return|quote|lambda|block|import|export|bind";
  9. var keywordMapper = this.createKeywordMapper({
  10. "keyword.control": keywordControl,
  11. "keyword.operator": window.yql.builtinFunctions.join("|"),
  12. "variable": window.yql.supportedFunctions.join("|")
  13. }, "identifier", false);
  14. this.$rules = {
  15. "start": [
  16. {
  17. token : "comment",
  18. regex : "#.*$"
  19. },
  20. {
  21. token: ["storage.type.function-type.yql", "text", "entity.name.function.lisp"],
  22. regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\?)*)"
  23. },
  24. {
  25. token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
  26. regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
  27. },
  28. {
  29. token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
  30. regex: "(\\*)(\\S*)(\\*)"
  31. },
  32. {
  33. token : "string",
  34. regex : '\'?"(?=.)',
  35. next : "qqstring"
  36. },
  37. {
  38. token : "string", // multiline atom
  39. regex : '\'?@@',
  40. next : "multiline"
  41. },
  42. {
  43. token : "string", // binary atom
  44. regex : '\'?x"(?:[0-9A-Fa-f]{2})*"',
  45. },
  46. {
  47. token : "variable.parameter", // short quote
  48. regex : "'[^#\\s)(]+"
  49. },
  50. {
  51. token : keywordMapper,
  52. regex : "(?:(?:<=?|>=?|==|!=|[-+*/%])|[a-zA-Z][a-zA-Z0-9!]*)"
  53. }
  54. ],
  55. "qqstring": [
  56. {
  57. token: "string.regexp",
  58. regex: "\\\\(?:[0-3][0-7][0-7]|x[0-9A-Fa-f]{2}|[\"tnrbfav\\\\])"
  59. },
  60. {
  61. token : "string",
  62. regex : '[^"\\\\]+'
  63. },
  64. {
  65. token : "string",
  66. regex : '"|$',
  67. next : "start"
  68. }
  69. ],
  70. "multiline": [
  71. {
  72. token : "string",
  73. regex: "[^@]+"
  74. },
  75. {
  76. token : "string",
  77. regex : "[@]{2}",
  78. next : "start"
  79. },
  80. ]
  81. }
  82. };
  83. oop.inherits(YqlHighlightRules, TextHighlightRules);
  84. exports.YqlHighlightRules = YqlHighlightRules;
  85. });
  86. define("ace/mode/yql",
  87. ["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/yql_highlight_rules"],
  88. function(require, exports, module) {
  89. "use strict";
  90. var oop = require("../lib/oop");
  91. var TextMode = require("./text").Mode;
  92. var YqlHighlightRules = require("./yql_highlight_rules").YqlHighlightRules;
  93. var Mode = function() {
  94. this.HighlightRules = YqlHighlightRules;
  95. };
  96. oop.inherits(Mode, TextMode);
  97. (function() {
  98. this.lineCommentStart = "#";
  99. this.$id = "ace/mode/yql";
  100. }).call(Mode.prototype);
  101. exports.Mode = Mode;
  102. });