You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

457 lines
17 KiB

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