mode-groovy.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. define("ace/mode/doc_comment_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2. "use strict";
  3. var oop = ace_require("../lib/oop");
  4. var TextHighlightRules = ace_require("./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. define("ace/mode/javascript_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  42. "use strict";
  43. var oop = ace_require("../lib/oop");
  44. var DocCommentHighlightRules = ace_require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/,
  171. next : "start"
  172. }, {
  173. token : "keyword.operator",
  174. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  175. next : "start"
  176. }, {
  177. token : "punctuation.operator",
  178. regex : /[?:,;.]/,
  179. next : "start"
  180. }, {
  181. token : "paren.lparen",
  182. regex : /[\[({]/,
  183. next : "start"
  184. }, {
  185. token : "paren.rparen",
  186. regex : /[\])}]/
  187. }, {
  188. token: "comment",
  189. regex: /^#!.*$/
  190. }
  191. ],
  192. property: [{
  193. token : "text",
  194. regex : "\\s+"
  195. }, {
  196. token : [
  197. "storage.type", "punctuation.operator", "entity.name.function", "text",
  198. "keyword.operator", "text",
  199. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  200. ],
  201. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  202. next: "function_arguments"
  203. }, {
  204. token : "punctuation.operator",
  205. regex : /[.](?![.])/
  206. }, {
  207. token : "support.function",
  208. regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  209. }, {
  210. token : "support.function.dom",
  211. regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  212. }, {
  213. token : "support.constant",
  214. regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  215. }, {
  216. token : "identifier",
  217. regex : identifierRe
  218. }, {
  219. regex: "",
  220. token: "empty",
  221. next: "no_regex"
  222. }
  223. ],
  224. "start": [
  225. DocCommentHighlightRules.getStartRule("doc-start"),
  226. comments("start"),
  227. {
  228. token: "string.regexp",
  229. regex: "\\/",
  230. next: "regex"
  231. }, {
  232. token : "text",
  233. regex : "\\s+|^$",
  234. next : "start"
  235. }, {
  236. token: "empty",
  237. regex: "",
  238. next: "no_regex"
  239. }
  240. ],
  241. "regex": [
  242. {
  243. token: "regexp.keyword.operator",
  244. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  245. }, {
  246. token: "string.regexp",
  247. regex: "/[sxngimy]*",
  248. next: "no_regex"
  249. }, {
  250. token : "invalid",
  251. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  252. }, {
  253. token : "constant.language.escape",
  254. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  255. }, {
  256. token : "constant.language.delimiter",
  257. regex: /\|/
  258. }, {
  259. token: "constant.language.escape",
  260. regex: /\[\^?/,
  261. next: "regex_character_class"
  262. }, {
  263. token: "empty",
  264. regex: "$",
  265. next: "no_regex"
  266. }, {
  267. defaultToken: "string.regexp"
  268. }
  269. ],
  270. "regex_character_class": [
  271. {
  272. token: "regexp.charclass.keyword.operator",
  273. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  274. }, {
  275. token: "constant.language.escape",
  276. regex: "]",
  277. next: "regex"
  278. }, {
  279. token: "constant.language.escape",
  280. regex: "-"
  281. }, {
  282. token: "empty",
  283. regex: "$",
  284. next: "no_regex"
  285. }, {
  286. defaultToken: "string.regexp.charachterclass"
  287. }
  288. ],
  289. "function_arguments": [
  290. {
  291. token: "variable.parameter",
  292. regex: identifierRe
  293. }, {
  294. token: "punctuation.operator",
  295. regex: "[, ]+"
  296. }, {
  297. token: "punctuation.operator",
  298. regex: "$"
  299. }, {
  300. token: "empty",
  301. regex: "",
  302. next: "no_regex"
  303. }
  304. ],
  305. "qqstring" : [
  306. {
  307. token : "constant.language.escape",
  308. regex : escapedRe
  309. }, {
  310. token : "string",
  311. regex : "\\\\$",
  312. consumeLineEnd : true
  313. }, {
  314. token : "string",
  315. regex : '"|$',
  316. next : "no_regex"
  317. }, {
  318. defaultToken: "string"
  319. }
  320. ],
  321. "qstring" : [
  322. {
  323. token : "constant.language.escape",
  324. regex : escapedRe
  325. }, {
  326. token : "string",
  327. regex : "\\\\$",
  328. consumeLineEnd : true
  329. }, {
  330. token : "string",
  331. regex : "'|$",
  332. next : "no_regex"
  333. }, {
  334. defaultToken: "string"
  335. }
  336. ]
  337. };
  338. if (!options || !options.noES6) {
  339. this.$rules.no_regex.unshift({
  340. regex: "[{}]", onMatch: function(val, state, stack) {
  341. this.next = val == "{" ? this.nextState : "";
  342. if (val == "{" && stack.length) {
  343. stack.unshift("start", state);
  344. }
  345. else if (val == "}" && stack.length) {
  346. stack.shift();
  347. this.next = stack.shift();
  348. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  349. return "paren.quasi.end";
  350. }
  351. return val == "{" ? "paren.lparen" : "paren.rparen";
  352. },
  353. nextState: "start"
  354. }, {
  355. token : "string.quasi.start",
  356. regex : /`/,
  357. push : [{
  358. token : "constant.language.escape",
  359. regex : escapedRe
  360. }, {
  361. token : "paren.quasi.start",
  362. regex : /\${/,
  363. push : "start"
  364. }, {
  365. token : "string.quasi.end",
  366. regex : /`/,
  367. next : "pop"
  368. }, {
  369. defaultToken: "string.quasi"
  370. }]
  371. });
  372. if (!options || options.jsx != false)
  373. JSX.call(this);
  374. }
  375. this.embedRules(DocCommentHighlightRules, "doc-",
  376. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  377. this.normalizeRules();
  378. };
  379. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  380. function JSX() {
  381. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  382. var jsxTag = {
  383. onMatch : function(val, state, stack) {
  384. var offset = val.charAt(1) == "/" ? 2 : 1;
  385. if (offset == 1) {
  386. if (state != this.nextState)
  387. stack.unshift(this.next, this.nextState, 0);
  388. else
  389. stack.unshift(this.next);
  390. stack[2]++;
  391. } else if (offset == 2) {
  392. if (state == this.nextState) {
  393. stack[1]--;
  394. if (!stack[1] || stack[1] < 0) {
  395. stack.shift();
  396. stack.shift();
  397. }
  398. }
  399. }
  400. return [{
  401. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  402. value: val.slice(0, offset)
  403. }, {
  404. type: "meta.tag.tag-name.xml",
  405. value: val.substr(offset)
  406. }];
  407. },
  408. regex : "</?" + tagRegex + "",
  409. next: "jsxAttributes",
  410. nextState: "jsx"
  411. };
  412. this.$rules.start.unshift(jsxTag);
  413. var jsxJsRule = {
  414. regex: "{",
  415. token: "paren.quasi.start",
  416. push: "start"
  417. };
  418. this.$rules.jsx = [
  419. jsxJsRule,
  420. jsxTag,
  421. {include : "reference"},
  422. {defaultToken: "string"}
  423. ];
  424. this.$rules.jsxAttributes = [{
  425. token : "meta.tag.punctuation.tag-close.xml",
  426. regex : "/?>",
  427. onMatch : function(value, currentState, stack) {
  428. if (currentState == stack[0])
  429. stack.shift();
  430. if (value.length == 2) {
  431. if (stack[0] == this.nextState)
  432. stack[1]--;
  433. if (!stack[1] || stack[1] < 0) {
  434. stack.splice(0, 2);
  435. }
  436. }
  437. this.next = stack[0] || "start";
  438. return [{type: this.token, value: value}];
  439. },
  440. nextState: "jsx"
  441. },
  442. jsxJsRule,
  443. comments("jsxAttributes"),
  444. {
  445. token : "entity.other.attribute-name.xml",
  446. regex : tagRegex
  447. }, {
  448. token : "keyword.operator.attribute-equals.xml",
  449. regex : "="
  450. }, {
  451. token : "text.tag-whitespace.xml",
  452. regex : "\\s+"
  453. }, {
  454. token : "string.attribute-value.xml",
  455. regex : "'",
  456. stateName : "jsx_attr_q",
  457. push : [
  458. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  459. {include : "reference"},
  460. {defaultToken : "string.attribute-value.xml"}
  461. ]
  462. }, {
  463. token : "string.attribute-value.xml",
  464. regex : '"',
  465. stateName : "jsx_attr_qq",
  466. push : [
  467. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  468. {include : "reference"},
  469. {defaultToken : "string.attribute-value.xml"}
  470. ]
  471. },
  472. jsxTag
  473. ];
  474. this.$rules.reference = [{
  475. token : "constant.language.escape.reference.xml",
  476. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  477. }];
  478. }
  479. function comments(next) {
  480. return [
  481. {
  482. token : "comment", // multi line comment
  483. regex : /\/\*/,
  484. next: [
  485. DocCommentHighlightRules.getTagRule(),
  486. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  487. {defaultToken : "comment", caseInsensitive: true}
  488. ]
  489. }, {
  490. token : "comment",
  491. regex : "\\/\\/",
  492. next: [
  493. DocCommentHighlightRules.getTagRule(),
  494. {token : "comment", regex : "$|^", next : next || "pop"},
  495. {defaultToken : "comment", caseInsensitive: true}
  496. ]
  497. }
  498. ];
  499. }
  500. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  501. });
  502. define("ace/mode/matching_brace_outdent",["ace_require","exports","module","ace/range"], function(ace_require, exports, module) {
  503. "use strict";
  504. var Range = ace_require("../range").Range;
  505. var MatchingBraceOutdent = function() {};
  506. (function() {
  507. this.checkOutdent = function(line, input) {
  508. if (! /^\s+$/.test(line))
  509. return false;
  510. return /^\s*\}/.test(input);
  511. };
  512. this.autoOutdent = function(doc, row) {
  513. var line = doc.getLine(row);
  514. var match = line.match(/^(\s*\})/);
  515. if (!match) return 0;
  516. var column = match[1].length;
  517. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  518. if (!openBracePos || openBracePos.row == row) return 0;
  519. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  520. doc.replace(new Range(row, 0, row, column-1), indent);
  521. };
  522. this.$getIndent = function(line) {
  523. return line.match(/^\s*/)[0];
  524. };
  525. }).call(MatchingBraceOutdent.prototype);
  526. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  527. });
  528. define("ace/mode/folding/cstyle",["ace_require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(ace_require, exports, module) {
  529. "use strict";
  530. var oop = ace_require("../../lib/oop");
  531. var Range = ace_require("../../range").Range;
  532. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  533. var FoldMode = exports.FoldMode = function(commentRegex) {
  534. if (commentRegex) {
  535. this.foldingStartMarker = new RegExp(
  536. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  537. );
  538. this.foldingStopMarker = new RegExp(
  539. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  540. );
  541. }
  542. };
  543. oop.inherits(FoldMode, BaseFoldMode);
  544. (function() {
  545. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  546. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  547. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  548. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  549. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  550. this._getFoldWidgetBase = this.getFoldWidget;
  551. this.getFoldWidget = function(session, foldStyle, row) {
  552. var line = session.getLine(row);
  553. if (this.singleLineBlockCommentRe.test(line)) {
  554. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  555. return "";
  556. }
  557. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  558. if (!fw && this.startRegionRe.test(line))
  559. return "start"; // lineCommentRegionStart
  560. return fw;
  561. };
  562. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  563. var line = session.getLine(row);
  564. if (this.startRegionRe.test(line))
  565. return this.getCommentRegionBlock(session, line, row);
  566. var match = line.match(this.foldingStartMarker);
  567. if (match) {
  568. var i = match.index;
  569. if (match[1])
  570. return this.openingBracketBlock(session, match[1], row, i);
  571. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  572. if (range && !range.isMultiLine()) {
  573. if (forceMultiline) {
  574. range = this.getSectionRange(session, row);
  575. } else if (foldStyle != "all")
  576. range = null;
  577. }
  578. return range;
  579. }
  580. if (foldStyle === "markbegin")
  581. return;
  582. var match = line.match(this.foldingStopMarker);
  583. if (match) {
  584. var i = match.index + match[0].length;
  585. if (match[1])
  586. return this.closingBracketBlock(session, match[1], row, i);
  587. return session.getCommentFoldRange(row, i, -1);
  588. }
  589. };
  590. this.getSectionRange = function(session, row) {
  591. var line = session.getLine(row);
  592. var startIndent = line.search(/\S/);
  593. var startRow = row;
  594. var startColumn = line.length;
  595. row = row + 1;
  596. var endRow = row;
  597. var maxRow = session.getLength();
  598. while (++row < maxRow) {
  599. line = session.getLine(row);
  600. var indent = line.search(/\S/);
  601. if (indent === -1)
  602. continue;
  603. if (startIndent > indent)
  604. break;
  605. var subRange = this.getFoldWidgetRange(session, "all", row);
  606. if (subRange) {
  607. if (subRange.start.row <= startRow) {
  608. break;
  609. } else if (subRange.isMultiLine()) {
  610. row = subRange.end.row;
  611. } else if (startIndent == indent) {
  612. break;
  613. }
  614. }
  615. endRow = row;
  616. }
  617. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  618. };
  619. this.getCommentRegionBlock = function(session, line, row) {
  620. var startColumn = line.search(/\s*$/);
  621. var maxRow = session.getLength();
  622. var startRow = row;
  623. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  624. var depth = 1;
  625. while (++row < maxRow) {
  626. line = session.getLine(row);
  627. var m = re.exec(line);
  628. if (!m) continue;
  629. if (m[1]) depth--;
  630. else depth++;
  631. if (!depth) break;
  632. }
  633. var endRow = row;
  634. if (endRow > startRow) {
  635. return new Range(startRow, startColumn, endRow, line.length);
  636. }
  637. };
  638. }).call(FoldMode.prototype);
  639. });
  640. define("ace/mode/javascript",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(ace_require, exports, module) {
  641. "use strict";
  642. var oop = ace_require("../lib/oop");
  643. var TextMode = ace_require("./text").Mode;
  644. var JavaScriptHighlightRules = ace_require("./javascript_highlight_rules").JavaScriptHighlightRules;
  645. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  646. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  647. var CstyleBehaviour = ace_require("./behaviour/cstyle").CstyleBehaviour;
  648. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  649. var Mode = function() {
  650. this.HighlightRules = JavaScriptHighlightRules;
  651. this.$outdent = new MatchingBraceOutdent();
  652. this.$behaviour = new CstyleBehaviour();
  653. this.foldingRules = new CStyleFoldMode();
  654. };
  655. oop.inherits(Mode, TextMode);
  656. (function() {
  657. this.lineCommentStart = "//";
  658. this.blockComment = {start: "/*", end: "*/"};
  659. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  660. this.getNextLineIndent = function(state, line, tab) {
  661. var indent = this.$getIndent(line);
  662. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  663. var tokens = tokenizedLine.tokens;
  664. var endState = tokenizedLine.state;
  665. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  666. return indent;
  667. }
  668. if (state == "start" || state == "no_regex") {
  669. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  670. if (match) {
  671. indent += tab;
  672. }
  673. } else if (state == "doc-start") {
  674. if (endState == "start" || endState == "no_regex") {
  675. return "";
  676. }
  677. var match = line.match(/^\s*(\/?)\*/);
  678. if (match) {
  679. if (match[1]) {
  680. indent += " ";
  681. }
  682. indent += "* ";
  683. }
  684. }
  685. return indent;
  686. };
  687. this.checkOutdent = function(state, line, input) {
  688. return this.$outdent.checkOutdent(line, input);
  689. };
  690. this.autoOutdent = function(state, doc, row) {
  691. this.$outdent.autoOutdent(doc, row);
  692. };
  693. this.createWorker = function(session) {
  694. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  695. worker.attachToDocument(session.getDocument());
  696. worker.on("annotate", function(results) {
  697. session.setAnnotations(results.data);
  698. });
  699. worker.on("terminate", function() {
  700. session.clearAnnotations();
  701. });
  702. return worker;
  703. };
  704. this.$id = "ace/mode/javascript";
  705. this.snippetFileId = "ace/snippets/javascript";
  706. }).call(Mode.prototype);
  707. exports.Mode = Mode;
  708. });
  709. define("ace/mode/groovy_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  710. "use strict";
  711. var oop = ace_require("../lib/oop");
  712. var DocCommentHighlightRules = ace_require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  713. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  714. var GroovyHighlightRules = function() {
  715. var keywords = (
  716. "assert|with|abstract|continue|for|new|switch|" +
  717. "assert|default|goto|package|synchronized|" +
  718. "boolean|do|if|private|this|" +
  719. "break|double|implements|protected|throw|" +
  720. "byte|else|import|public|throws|" +
  721. "case|enum|instanceof|return|transient|" +
  722. "catch|extends|int|short|try|" +
  723. "char|final|interface|static|void|" +
  724. "class|finally|long|strictfp|volatile|" +
  725. "def|float|native|super|while"
  726. );
  727. var buildinConstants = (
  728. "null|Infinity|NaN|undefined"
  729. );
  730. var langClasses = (
  731. "AbstractMethodError|AssertionError|ClassCircularityError|"+
  732. "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
  733. "ExceptionInInitializerError|IllegalAccessError|"+
  734. "IllegalThreadStateException|InstantiationError|InternalError|"+
  735. "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
  736. "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
  737. "SuppressWarnings|TypeNotPresentException|UnknownError|"+
  738. "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
  739. "InstantiationException|IndexOutOfBoundsException|"+
  740. "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
  741. "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
  742. "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
  743. "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
  744. "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
  745. "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
  746. "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
  747. "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
  748. "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
  749. "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
  750. "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
  751. "ArrayStoreException|ClassCastException|LinkageError|"+
  752. "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
  753. "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
  754. "Cloneable|Class|CharSequence|Comparable|String|Object"
  755. );
  756. var keywordMapper = this.createKeywordMapper({
  757. "variable.language": "this",
  758. "keyword": keywords,
  759. "support.function": langClasses,
  760. "constant.language": buildinConstants
  761. }, "identifier");
  762. this.$rules = {
  763. "start" : [
  764. {
  765. token : "comment",
  766. regex : "\\/\\/.*$"
  767. },
  768. DocCommentHighlightRules.getStartRule("doc-start"),
  769. {
  770. token : "comment", // multi line comment
  771. regex : "\\/\\*",
  772. next : "comment"
  773. }, {
  774. token : "string.regexp",
  775. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  776. }, {
  777. token : "string",
  778. regex : '"""',
  779. next : "qqstring"
  780. }, {
  781. token : "string",
  782. regex : "'''",
  783. next : "qstring"
  784. }, {
  785. token : "string", // single line
  786. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  787. }, {
  788. token : "string", // single line
  789. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  790. }, {
  791. token : "constant.numeric", // hex
  792. regex : "0[xX][0-9a-fA-F]+\\b"
  793. }, {
  794. token : "constant.numeric", // float
  795. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  796. }, {
  797. token : "constant.language.boolean",
  798. regex : "(?:true|false)\\b"
  799. }, {
  800. token : keywordMapper,
  801. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  802. }, {
  803. token : "keyword.operator",
  804. regex : "\\?:|\\?\\.|\\*\\.|<=>|=~|==~|\\.@|\\*\\.@|\\.&|as|in|is|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  805. }, {
  806. token : "lparen",
  807. regex : "[[({]"
  808. }, {
  809. token : "rparen",
  810. regex : "[\\])}]"
  811. }, {
  812. token : "text",
  813. regex : "\\s+"
  814. }
  815. ],
  816. "comment" : [
  817. {
  818. token : "comment", // closing comment
  819. regex : "\\*\\/",
  820. next : "start"
  821. }, {
  822. defaultToken : "comment"
  823. }
  824. ],
  825. "qqstring" : [
  826. {
  827. token : "constant.language.escape",
  828. regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
  829. }, {
  830. token : "constant.language.escape",
  831. regex : /\$[\w\d]+/
  832. }, {
  833. token : "constant.language.escape",
  834. regex : /\$\{[^"\}]+\}?/
  835. }, {
  836. token : "string",
  837. regex : '"{3,5}',
  838. next : "start"
  839. }, {
  840. token : "string",
  841. regex : '.+?'
  842. }
  843. ],
  844. "qstring" : [
  845. {
  846. token : "constant.language.escape",
  847. regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
  848. }, {
  849. token : "string",
  850. regex : "'{3,5}",
  851. next : "start"
  852. }, {
  853. token : "string",
  854. regex : ".+?"
  855. }
  856. ]
  857. };
  858. this.embedRules(DocCommentHighlightRules, "doc-",
  859. [ DocCommentHighlightRules.getEndRule("start") ]);
  860. };
  861. oop.inherits(GroovyHighlightRules, TextHighlightRules);
  862. exports.GroovyHighlightRules = GroovyHighlightRules;
  863. });
  864. define("ace/mode/groovy",["ace_require","exports","module","ace/lib/oop","ace/mode/javascript","ace/mode/groovy_highlight_rules"], function(ace_require, exports, module) {
  865. "use strict";
  866. var oop = ace_require("../lib/oop");
  867. var JavaScriptMode = ace_require("./javascript").Mode;
  868. var GroovyHighlightRules = ace_require("./groovy_highlight_rules").GroovyHighlightRules;
  869. var Mode = function() {
  870. JavaScriptMode.call(this);
  871. this.HighlightRules = GroovyHighlightRules;
  872. };
  873. oop.inherits(Mode, JavaScriptMode);
  874. (function() {
  875. this.createWorker = function(session) {
  876. return null;
  877. };
  878. this.$id = "ace/mode/groovy";
  879. }).call(Mode.prototype);
  880. exports.Mode = Mode;
  881. }); (function() {
  882. window.ace_require(["ace/mode/groovy"], function(m) {
  883. if (typeof module == "object" && typeof exports == "object" && module) {
  884. module.exports = m;
  885. }
  886. });
  887. })();