cb133a447f7bbaa64d268360db08ac7a.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. ace.define("ace/mode/java_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  41. var oop = require("../lib/oop");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. var JavaHighlightRules = function () {
  45. var keywords = ("abstract|continue|for|new|switch|" +
  46. "assert|default|goto|package|synchronized|" +
  47. "boolean|do|if|private|this|" +
  48. "break|double|implements|protected|throw|" +
  49. "byte|else|import|public|throws|" +
  50. "case|enum|instanceof|return|transient|" +
  51. "catch|extends|int|short|try|" +
  52. "char|final|interface|static|void|" +
  53. "class|finally|long|strictfp|volatile|" +
  54. "const|float|native|super|while|" +
  55. "var");
  56. var buildinConstants = ("null|Infinity|NaN|undefined");
  57. var langClasses = ("AbstractMethodError|AssertionError|ClassCircularityError|" +
  58. "ClassFormatError|Deprecated|EnumConstantNotPresentException|" +
  59. "ExceptionInInitializerError|IllegalAccessError|" +
  60. "IllegalThreadStateException|InstantiationError|InternalError|" +
  61. "NegativeArraySizeException|NoSuchFieldError|Override|Process|" +
  62. "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|" +
  63. "SuppressWarnings|TypeNotPresentException|UnknownError|" +
  64. "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|" +
  65. "InstantiationException|IndexOutOfBoundsException|" +
  66. "ArrayIndexOutOfBoundsException|CloneNotSupportedException|" +
  67. "NoSuchFieldException|IllegalArgumentException|NumberFormatException|" +
  68. "SecurityException|Void|InheritableThreadLocal|IllegalStateException|" +
  69. "InterruptedException|NoSuchMethodException|IllegalAccessException|" +
  70. "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|" +
  71. "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|" +
  72. "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|" +
  73. "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|" +
  74. "Character|Boolean|StackTraceElement|Appendable|StringBuffer|" +
  75. "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|" +
  76. "StackOverflowError|OutOfMemoryError|VirtualMachineError|" +
  77. "ArrayStoreException|ClassCastException|LinkageError|" +
  78. "NoClassDefFoundError|ClassNotFoundException|RuntimeException|" +
  79. "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|" +
  80. "Cloneable|Class|CharSequence|Comparable|String|Object");
  81. var keywordMapper = this.createKeywordMapper({
  82. "variable.language": "this",
  83. "keyword": keywords,
  84. "constant.language": buildinConstants,
  85. "support.function": langClasses
  86. }, "identifier");
  87. this.$rules = {
  88. "start": [
  89. {
  90. token: "comment",
  91. regex: "\\/\\/.*$"
  92. },
  93. DocCommentHighlightRules.getStartRule("doc-start"),
  94. {
  95. token: "comment",
  96. regex: "\\/\\*",
  97. next: "comment"
  98. }, {
  99. token: "string",
  100. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  101. }, {
  102. token: "string",
  103. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  104. }, {
  105. token: "constant.numeric",
  106. regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
  107. }, {
  108. token: "constant.numeric",
  109. regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
  110. }, {
  111. token: "constant.language.boolean",
  112. regex: "(?:true|false)\\b"
  113. }, {
  114. regex: "(open(?:\\s+))?module(?=\\s*\\w)",
  115. token: "keyword",
  116. next: [{
  117. regex: "{",
  118. token: "paren.lparen",
  119. next: [{
  120. regex: "}",
  121. token: "paren.rparen",
  122. next: "start"
  123. }, {
  124. regex: "\\b(requires|transitive|exports|opens|to|uses|provides|with)\\b",
  125. token: "keyword"
  126. }]
  127. }, {
  128. token: "text",
  129. regex: "\\s+"
  130. }, {
  131. token: "identifier",
  132. regex: "\\w+"
  133. }, {
  134. token: "punctuation.operator",
  135. regex: "."
  136. }, {
  137. token: "text",
  138. regex: "\\s+"
  139. }, {
  140. regex: "",
  141. next: "start"
  142. }]
  143. }, {
  144. token: keywordMapper,
  145. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  146. }, {
  147. token: "keyword.operator",
  148. regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  149. }, {
  150. token: "lparen",
  151. regex: "[[({]"
  152. }, {
  153. token: "rparen",
  154. regex: "[\\])}]"
  155. }, {
  156. token: "text",
  157. regex: "\\s+"
  158. }
  159. ],
  160. "comment": [
  161. {
  162. token: "comment",
  163. regex: "\\*\\/",
  164. next: "start"
  165. }, {
  166. defaultToken: "comment"
  167. }
  168. ]
  169. };
  170. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
  171. this.normalizeRules();
  172. };
  173. oop.inherits(JavaHighlightRules, TextHighlightRules);
  174. exports.JavaHighlightRules = JavaHighlightRules;
  175. });
  176. ace.define("ace/mode/drools_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/java_highlight_rules","ace/mode/doc_comment_highlight_rules"], function(require, exports, module){"use strict";
  177. var oop = require("../lib/oop");
  178. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  179. var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
  180. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  181. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  182. var packageIdentifierRe = "[a-zA-Z\\$_\u00a1-\uffff][\\.a-zA-Z\\d\\$_\u00a1-\uffff]*";
  183. var DroolsHighlightRules = function () {
  184. var keywords = ("date|effective|expires|lock|on|active|no|loop|auto|focus" +
  185. "|activation|group|agenda|ruleflow|duration|timer|calendars|refract|direct" +
  186. "|dialect|salience|enabled|attributes|extends|template" +
  187. "|function|contains|matches|eval|excludes|soundslike" +
  188. "|memberof|not|in|or|and|exists|forall|over|from|entry|point|accumulate|acc|collect" +
  189. "|action|reverse|result|end|init|instanceof|extends|super|boolean|char|byte|short" +
  190. "|int|long|float|double|this|void|class|new|case|final|if|else|for|while|do" +
  191. "|default|try|catch|finally|switch|synchronized|return|throw|break|continue|assert" +
  192. "|modify|static|public|protected|private|abstract|native|transient|volatile" +
  193. "|strictfp|throws|interface|enum|implements|type|window|trait|no-loop|str");
  194. var langClasses = ("AbstractMethodError|AssertionError|ClassCircularityError|" +
  195. "ClassFormatError|Deprecated|EnumConstantNotPresentException|" +
  196. "ExceptionInInitializerError|IllegalAccessError|" +
  197. "IllegalThreadStateException|InstantiationError|InternalError|" +
  198. "NegativeArraySizeException|NoSuchFieldError|Override|Process|" +
  199. "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|" +
  200. "SuppressWarnings|TypeNotPresentException|UnknownError|" +
  201. "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|" +
  202. "InstantiationException|IndexOutOfBoundsException|" +
  203. "ArrayIndexOutOfBoundsException|CloneNotSupportedException|" +
  204. "NoSuchFieldException|IllegalArgumentException|NumberFormatException|" +
  205. "SecurityException|Void|InheritableThreadLocal|IllegalStateException|" +
  206. "InterruptedException|NoSuchMethodException|IllegalAccessException|" +
  207. "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|" +
  208. "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|" +
  209. "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|" +
  210. "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|" +
  211. "Character|Boolean|StackTraceElement|Appendable|StringBuffer|" +
  212. "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|" +
  213. "StackOverflowError|OutOfMemoryError|VirtualMachineError|" +
  214. "ArrayStoreException|ClassCastException|LinkageError|" +
  215. "NoClassDefFoundError|ClassNotFoundException|RuntimeException|" +
  216. "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|" +
  217. "Cloneable|Class|CharSequence|Comparable|String|Object");
  218. var keywordMapper = this.createKeywordMapper({
  219. "variable.language": "this",
  220. "keyword": keywords,
  221. "constant.language": "null",
  222. "support.class": langClasses,
  223. "support.function": "retract|update|modify|insert"
  224. }, "identifier");
  225. var stringRules = function () {
  226. return [{
  227. token: "string",
  228. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  229. }, {
  230. token: "string",
  231. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  232. }];
  233. };
  234. var basicPreRules = function (blockCommentRules) {
  235. return [{
  236. token: "comment",
  237. regex: "\\/\\/.*$"
  238. },
  239. DocCommentHighlightRules.getStartRule("doc-start"),
  240. {
  241. token: "comment",
  242. regex: "\\/\\*",
  243. next: blockCommentRules
  244. }, {
  245. token: "constant.numeric",
  246. regex: "0[xX][0-9a-fA-F]+\\b"
  247. }, {
  248. token: "constant.numeric",
  249. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  250. }, {
  251. token: "constant.language.boolean",
  252. regex: "(?:true|false)\\b"
  253. }];
  254. };
  255. var blockCommentRules = function (returnRule) {
  256. return [
  257. {
  258. token: "comment.block",
  259. regex: "\\*\\/",
  260. next: returnRule
  261. }, {
  262. defaultToken: "comment.block"
  263. }
  264. ];
  265. };
  266. var basicPostRules = function () {
  267. return [{
  268. token: keywordMapper,
  269. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  270. }, {
  271. token: "keyword.operator",
  272. regex: "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  273. }, {
  274. token: "lparen",
  275. regex: "[[({]"
  276. }, {
  277. token: "rparen",
  278. regex: "[\\])}]"
  279. }, {
  280. token: "text",
  281. regex: "\\s+"
  282. }];
  283. };
  284. this.$rules = {
  285. "start": [].concat(basicPreRules("block.comment"), [
  286. {
  287. token: "entity.name.type",
  288. regex: "@[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  289. }, {
  290. token: ["keyword", "text", "entity.name.type"],
  291. regex: "(package)(\\s+)(" + packageIdentifierRe + ")"
  292. }, {
  293. token: ["keyword", "text", "keyword", "text", "entity.name.type"],
  294. regex: "(import)(\\s+)(function)(\\s+)(" + packageIdentifierRe + ")"
  295. }, {
  296. token: ["keyword", "text", "entity.name.type"],
  297. regex: "(import)(\\s+)(" + packageIdentifierRe + ")"
  298. }, {
  299. token: ["keyword", "text", "entity.name.type", "text", "variable"],
  300. regex: "(global)(\\s+)(" + packageIdentifierRe + ")(\\s+)(" + identifierRe + ")"
  301. }, {
  302. token: ["keyword", "text", "keyword", "text", "entity.name.type"],
  303. regex: "(declare)(\\s+)(trait)(\\s+)(" + identifierRe + ")"
  304. }, {
  305. token: ["keyword", "text", "entity.name.type"],
  306. regex: "(declare)(\\s+)(" + identifierRe + ")"
  307. }, {
  308. token: ["keyword", "text", "entity.name.type"],
  309. regex: "(extends)(\\s+)(" + packageIdentifierRe + ")"
  310. }, {
  311. token: ["keyword", "text"],
  312. regex: "(rule)(\\s+)",
  313. next: "asset.name"
  314. }
  315. ], stringRules(), [{
  316. token: ["variable.other", "text", "text"],
  317. regex: "(" + identifierRe + ")(\\s*)(:)"
  318. }, {
  319. token: ["keyword", "text"],
  320. regex: "(query)(\\s+)",
  321. next: "asset.name"
  322. }, {
  323. token: ["keyword", "text"],
  324. regex: "(when)(\\s*)"
  325. }, {
  326. token: ["keyword", "text"],
  327. regex: "(then)(\\s*)",
  328. next: "java-start"
  329. }, {
  330. token: "paren.lparen",
  331. regex: /[\[({]/
  332. }, {
  333. token: "paren.rparen",
  334. regex: /[\])}]/
  335. }], basicPostRules()),
  336. "block.comment": blockCommentRules("start"),
  337. "asset.name": [
  338. {
  339. token: "entity.name",
  340. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  341. }, {
  342. token: "entity.name",
  343. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  344. }, {
  345. token: "entity.name",
  346. regex: identifierRe
  347. }, {
  348. regex: "",
  349. token: "empty",
  350. next: "start"
  351. }
  352. ]
  353. };
  354. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
  355. this.embedRules(JavaHighlightRules, "java-", [
  356. {
  357. token: "support.function",
  358. regex: "\\b(insert|modify|retract|update)\\b"
  359. }, {
  360. token: "keyword",
  361. regex: "\\bend\\b",
  362. next: "start"
  363. }
  364. ]);
  365. };
  366. oop.inherits(DroolsHighlightRules, TextHighlightRules);
  367. exports.DroolsHighlightRules = DroolsHighlightRules;
  368. });
  369. ace.define("ace/mode/folding/drools",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module){"use strict";
  370. var oop = require("../../lib/oop");
  371. var Range = require("../../range").Range;
  372. var BaseFoldMode = require("./fold_mode").FoldMode;
  373. var TokenIterator = require("../../token_iterator").TokenIterator;
  374. var FoldMode = exports.FoldMode = function () { };
  375. oop.inherits(FoldMode, BaseFoldMode);
  376. (function () {
  377. this.foldingStartMarker = /\b(rule|declare|query|when|then)\b/;
  378. this.foldingStopMarker = /\bend\b/;
  379. this.getFoldWidgetRange = function (session, foldStyle, row) {
  380. var line = session.getLine(row);
  381. var match = line.match(this.foldingStartMarker);
  382. if (match) {
  383. var i = match.index;
  384. if (match[1]) {
  385. var position = { row: row, column: line.length };
  386. var iterator = new TokenIterator(session, position.row, position.column);
  387. var seek = "end";
  388. var token = iterator.getCurrentToken();
  389. if (token.value == "when") {
  390. seek = "then";
  391. }
  392. while (token) {
  393. if (token.value == seek) {
  394. return Range.fromPoints(position, {
  395. row: iterator.getCurrentTokenRow(),
  396. column: iterator.getCurrentTokenColumn()
  397. });
  398. }
  399. token = iterator.stepForward();
  400. }
  401. }
  402. }
  403. };
  404. }).call(FoldMode.prototype);
  405. });
  406. ace.define("ace/mode/drools",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/drools_highlight_rules","ace/mode/folding/drools"], function(require, exports, module){"use strict";
  407. var oop = require("../lib/oop");
  408. var TextMode = require("./text").Mode;
  409. var DroolsHighlightRules = require("./drools_highlight_rules").DroolsHighlightRules;
  410. var DroolsFoldMode = require("./folding/drools").FoldMode;
  411. var Mode = function () {
  412. this.HighlightRules = DroolsHighlightRules;
  413. this.foldingRules = new DroolsFoldMode();
  414. this.$behaviour = this.$defaultBehaviour;
  415. };
  416. oop.inherits(Mode, TextMode);
  417. (function () {
  418. this.lineCommentStart = "//";
  419. this.$id = "ace/mode/drools";
  420. this.snippetFileId = "ace/snippets/drools";
  421. }).call(Mode.prototype);
  422. exports.Mode = Mode;
  423. }); (function() {
  424. ace.require(["ace/mode/drools"], function(m) {
  425. if (typeof module == "object" && typeof exports == "object" && module) {
  426. module.exports = m;
  427. }
  428. });
  429. })();