aecb26a2eb6c7e44cf7b73ef096dc6a5.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ace.define("ace/mode/flix_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var FlixHighlightRules = function () {
  5. var keywords = ("use|checked_cast|checked_ecast|unchecked_cast|masked_cast|as|discard|from|" +
  6. "into|inject|project|solve|query|where|select|force|import|region|red|deref");
  7. var controlKeywords = ("choose|debug|do|for|forA|forM|foreach|yield|if|else|case|" +
  8. "match|typematch|try|catch|resume|spawn|par|branch|jumpto");
  9. var operators = "not|and|or|fix";
  10. var declarations = "eff|def|law|enum|case|type|alias|class|instance|mod|let";
  11. var modifiers = "with|without|opaque|lazy|lawful|pub|override|sealed|static";
  12. var primitives = "Unit|Bool|Char|Float32|Float64|Int8|Int16|Int32|Int64|BigInt|String";
  13. var keywordMapper = this.createKeywordMapper({
  14. "keyword": keywords,
  15. "keyword.control": controlKeywords,
  16. "keyword.operator": operators,
  17. "storage.type": declarations,
  18. "storage.modifier": modifiers,
  19. "support.type": primitives
  20. }, "identifier");
  21. this.$rules = {
  22. "start": [
  23. {
  24. token: "comment.line",
  25. regex: "\\/\\/.*$"
  26. }, {
  27. token: "comment.block",
  28. regex: "\\/\\*",
  29. next: "comment"
  30. }, {
  31. token: "string",
  32. regex: '"',
  33. next: "string"
  34. }, {
  35. token: "string.regexp",
  36. regex: 'regex"',
  37. next: "regex"
  38. }, {
  39. token: "constant.character",
  40. regex: "'",
  41. next: "char"
  42. }, {
  43. token: "constant.numeric", // hex
  44. regex: "0x[a-fA-F0-9](_*[a-fA-F0-9])*(i8|i16|i32|i64|ii)?\\b"
  45. }, {
  46. token: "constant.numeric", // float
  47. regex: "[0-9](_*[0-9])*\\.[0-9](_*[0-9])*(f32|f64)?\\b"
  48. }, {
  49. token: "constant.numeric", // integer
  50. regex: "[0-9](_*[0-9])*(i8|i16|i32|i64|ii)?\\b"
  51. }, {
  52. token: "constant.language.boolean",
  53. regex: "(true|false)\\b"
  54. }, {
  55. token: "constant.language",
  56. regex: "null\\b"
  57. }, {
  58. token: "keyword.operator",
  59. regex: "\\->|~>|<\\-|=>"
  60. }, {
  61. token: "storage.modifier",
  62. regex: "@(Deprecated|Experimental|Internal|ParallelWhenPure|Parallel|LazyWhenPure|Lazy|Skip|Test)\\b"
  63. }, {
  64. token: "keyword", // hole
  65. regex: "(\\?\\?\\?|\\?[a-zA-Z0-9]+)"
  66. }, {
  67. token: keywordMapper,
  68. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  69. }, {
  70. token: "paren.lparen",
  71. regex: "[[({]"
  72. }, {
  73. token: "paren.rparen",
  74. regex: "[\\])}]"
  75. }, {
  76. token: "text",
  77. regex: "\\s+"
  78. }
  79. ],
  80. "comment": [
  81. {
  82. token: "comment.block",
  83. regex: "\\*\\/",
  84. next: "start"
  85. }, {
  86. defaultToken: "comment.block"
  87. }
  88. ],
  89. "string": [
  90. {
  91. token: "constant.character.escape", // unicode
  92. regex: "\\\\(u[0-9a-fA-F]{4})"
  93. }, {
  94. token: "constant.character.escape",
  95. regex: '\\\\.'
  96. }, {
  97. token: "string",
  98. regex: '"',
  99. next: "start"
  100. }, {
  101. token: "string",
  102. regex: '[^"\\\\]+'
  103. }
  104. ],
  105. "regex": [
  106. {
  107. token: "constant.character.escape", // unicode
  108. regex: "\\\\(u[0-9a-fA-F]{4})"
  109. }, {
  110. token: "constant.character.escape",
  111. regex: '\\\\.'
  112. }, {
  113. token: "string.regexp",
  114. regex: '"',
  115. next: "start"
  116. }, {
  117. token: "string.regexp",
  118. regex: '[^"\\\\]+'
  119. }
  120. ],
  121. "char": [
  122. {
  123. token: "constant.character.escape", // unicode
  124. regex: "\\\\(u[0-9a-fA-F]{4})"
  125. }, {
  126. token: "constant.character.escape",
  127. regex: '\\\\.'
  128. }, {
  129. token: "constant.character",
  130. regex: "'",
  131. next: "start"
  132. }, {
  133. token: "constant.character",
  134. regex: "[^'\\\\]+"
  135. }
  136. ]
  137. };
  138. };
  139. oop.inherits(FlixHighlightRules, TextHighlightRules);
  140. exports.FlixHighlightRules = FlixHighlightRules;
  141. });
  142. ace.define("ace/mode/flix",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/flix_highlight_rules"], function(require, exports, module){"use strict";
  143. var oop = require("../lib/oop");
  144. var TextMode = require("./text").Mode;
  145. var FlixHighlightRules = require("./flix_highlight_rules").FlixHighlightRules;
  146. var Mode = function () {
  147. this.HighlightRules = FlixHighlightRules;
  148. };
  149. oop.inherits(Mode, TextMode);
  150. (function () {
  151. this.$id = "ace/mode/flix";
  152. }).call(Mode.prototype);
  153. exports.Mode = Mode;
  154. }); (function() {
  155. ace.require(["ace/mode/flix"], function(m) {
  156. if (typeof module == "object" && typeof exports == "object" && module) {
  157. module.exports = m;
  158. }
  159. });
  160. })();