Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-drools.js

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