1ace.define("ace/mode/doc_comment_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text_highlight_rules"], function (require, exports, module) { 2 "use strict"; 3 4 var oop = require("../lib/oop"); 5 6 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 7 8 var DocCommentHighlightRules = function DocCommentHighlightRules() { 9 this.$rules = { 10 "start": [{ 11 token: "comment.doc.tag", 12 regex: "@[\\w\\d_]+" // TODO: fix email addresses 13 14 }, DocCommentHighlightRules.getTagRule(), { 15 defaultToken: "comment.doc", 16 caseInsensitive: true 17 }] 18 }; 19 }; 20 21 oop.inherits(DocCommentHighlightRules, TextHighlightRules); 22 23 DocCommentHighlightRules.getTagRule = function (start) { 24 return { 25 token: "comment.doc.tag.storage.type", 26 regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b" 27 }; 28 }; 29 30 DocCommentHighlightRules.getStartRule = function (start) { 31 return { 32 token: "comment.doc", 33 // doc comment 34 regex: "\\/\\*(?=\\*)", 35 next: start 36 }; 37 }; 38 39 DocCommentHighlightRules.getEndRule = function (start) { 40 return { 41 token: "comment.doc", 42 // closing comment 43 regex: "\\*\\/", 44 next: start 45 }; 46 }; 47 48 exports.DocCommentHighlightRules = DocCommentHighlightRules; 49}); 50ace.define("ace/mode/javascript_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/doc_comment_highlight_rules", "ace/mode/text_highlight_rules"], function (require, exports, module) { 51 "use strict"; 52 53 var oop = require("../lib/oop"); 54 55 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; 56 57 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 58 59 var identifierRe = "[a-zA-Z\\$_\xA1-\uFFFF][a-zA-Z\\d\\$_\xA1-\uFFFF]*"; 60 61 var JavaScriptHighlightRules = function JavaScriptHighlightRules(options) { 62 var keywordMapper = this.createKeywordMapper({ 63 "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors 64 "Namespace|QName|XML|XMLList|" + // E4X 65 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors 66 "SyntaxError|TypeError|URIError|" + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions 67 "isNaN|parseFloat|parseInt|" + "JSON|Math|" + // Other 68 "this|arguments|prototype|window|document", 69 // Pseudo 70 "keyword": "const|yield|import|get|set|async|await|" + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + "__parent__|__count__|escape|unescape|with|__proto__|" + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", 71 "storage.type": "const|let|var|function", 72 "constant.language": "null|Infinity|NaN|undefined", 73 "support.function": "alert", 74 "constant.language.boolean": "true|false" 75 }, "identifier"); 76 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; 77 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex 78 "u[0-9a-fA-F]{4}|" + // unicode 79 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode 80 "[0-2][0-7]{0,2}|" + // oct 81 "3[0-7][0-7]?|" + // oct 82 "[4-7][0-7]?|" + //oct 83 ".)"; 84 this.$rules = { 85 "no_regex": [DocCommentHighlightRules.getStartRule("doc-start"), comments("no_regex"), { 86 token: "string", 87 regex: "'(?=.)", 88 next: "qstring" 89 }, { 90 token: "string", 91 regex: '"(?=.)', 92 next: "qqstring" 93 }, { 94 token: "constant.numeric", 95 // hexadecimal, octal and binary 96 regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ 97 }, { 98 token: "constant.numeric", 99 // decimal integers and floats 100 regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ 101 }, { 102 token: ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator"], 103 regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)", 104 next: "function_arguments" 105 }, { 106 token: ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen"], 107 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", 108 next: "function_arguments" 109 }, { 110 token: ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen"], 111 regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", 112 next: "function_arguments" 113 }, { 114 token: ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "entity.name.function", "text", "paren.lparen"], 115 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", 116 next: "function_arguments" 117 }, { 118 token: ["storage.type", "text", "entity.name.function", "text", "paren.lparen"], 119 regex: "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", 120 next: "function_arguments" 121 }, { 122 token: ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen"], 123 regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", 124 next: "function_arguments" 125 }, { 126 token: ["text", "text", "storage.type", "text", "paren.lparen"], 127 regex: "(:)(\\s*)(function)(\\s*)(\\()", 128 next: "function_arguments" 129 }, { 130 token: "keyword", 131 regex: "from(?=\\s*('|\"))" 132 }, { 133 token: "keyword", 134 regex: "(?:" + kwBeforeRe + ")\\b", 135 next: "start" 136 }, {
137 token: ["support.constant"], 138 regex: /that\b/ 139 }, { 140 token: ["storage.type", "punctuation.operator", "support.function.firebug"], 141 regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ 142 }, { 143 token: keywordMapper, 144 regex: identifierRe 145 }, { 146 token: "punctuation.operator", 147 regex: /[.](?![.])/, 148 next: "property" 149 }, { 150 token: "storage.type", 151 regex: /=>/, 152 next: "start" 153 }, { 154 token: "keyword.operator", 155 regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, 156 next: "start" 157 }, { 158 token: "punctuation.operator", 159 regex: /[?:,;.]/, 160 next: "start" 161 }, { 162 token: "paren.lparen", 163 regex: /[\[({]/, 164 next: "start" 165 }, { 166 token: "paren.rparen", 167 regex: /[\])}]/ 168 }, { 169 token: "comment", 170 regex: /^#!.*$/ 171 }], 172 property: [{ 173 token: "text", 174 regex: "\\s+" 175 }, { 176 token: ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "entity.name.function", "text", "paren.lparen"], 177 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", 178 next: "function_arguments" 179 }, { 180 token: "punctuation.operator", 181 regex: /[.](?![.])/ 182 }, { 183 token: "support.function", 184 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(?=\()/ 185 }, { 186 token: "support.function.dom", 187 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(?=\()/ 188 }, { 189 token: "support.constant", 190 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|asse
190s)|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/ 191 }, { 192 token: "identifier", 193 regex: identifierRe 194 }, { 195 regex: "", 196 token: "empty", 197 next: "no_regex" 198 }], 199 "start": [DocCommentHighlightRules.getStartRule("doc-start"), comments("start"), { 200 token: "string.regexp", 201 regex: "\\/", 202 next: "regex" 203 }, { 204 token: "text", 205 regex: "\\s+|^$", 206 next: "start" 207 }, { 208 token: "empty", 209 regex: "", 210 next: "no_regex" 211 }], 212 "regex": [{ 213 token: "regexp.keyword.operator", 214 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" 215 }, { 216 token: "string.regexp", 217 regex: "/[sxngimy]*", 218 next: "no_regex" 219 }, { 220 token: "invalid", 221 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ 222 }, { 223 token: "constant.language.escape", 224 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ 225 }, { 226 token: "constant.language.delimiter", 227 regex: /\|/ 228 }, { 229 token: "constant.language.escape", 230 regex: /\[\^?/, 231 next: "regex_character_class" 232 }, { 233 token: "empty", 234 regex: "$", 235 next: "no_regex" 236 }, { 237 defaultToken: "string.regexp" 238 }], 239 "regex_character_class": [{ 240 token: "regexp.charclass.keyword.operator", 241 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" 242 }, { 243 token: "constant.language.escape", 244 regex: "]", 245 next: "regex" 246 }, { 247 token: "constant.language.escape", 248 regex: "-" 249 }, { 250 token: "empty", 251 regex: "$", 252 next: "no_regex" 253 }, { 254 defaultToken: "string.regexp.charachterclass" 255 }], 256 "function_arguments": [{ 257 token: "variable.parameter", 258 regex: identifierRe 259 }, { 260 token: "punctuation.operator", 261 regex: "[, ]+" 262 }, { 263 token: "punctuation.operator", 264 regex: "$" 265 }, { 266 token: "empty", 267 regex: "", 268 next: "no_regex" 269 }], 270 "qqstring": [{ 271 token: "constant.language.escape", 272 regex: escapedRe 273 }, { 274 token: "string", 275 regex: "\\\\$", 276 consumeLineEnd: true 277 }, { 278 token: "string", 279 regex: '"|$', 280 next: "no_regex" 281 }, { 282 defaultToken: "string" 283 }], 284 "qstring": [{ 285 token: "constant.language.escape", 286 regex: escapedRe 287 }, { 288 token: "string", 289 regex: "\\\\$", 290 consumeLineEnd: true 291 }, { 292 token: "string", 293 regex: "'|$", 294 next: "no_regex" 295 }, { 296 defaultToken: "string" 297 }] 298 }; 299 300 if (!options || !options.noES6) { 301 this.$rules.no_regex.unshift({ 302 regex: "[{}]", 303 onMatch: function onMatch(val, state, stack) { 304 this.next = val == "{" ? this.nextState : ""; 305 306 if (val == "{" && stack.length) { 307 stack.unshift("start", state); 308 } else if (val == "}" && stack.length) { 309 stack.shift(); 310 this.next = stack.shift(); 311 if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) return "paren.quasi.end"; 312 } 313 314 return val == "{" ? "paren.lparen" : "paren.rparen"; 315 }, 316 nextState: "start" 317 }, { 318 token: "string.quasi.start", 319 regex: /`/, 320 push: [{ 321 token: "constant.language.escape", 322 regex: escapedRe 323 }, { 324 token: "paren.quasi.start", 325 regex: /\${/, 326 push: "start" 327 }, { 328 token: "string.quasi.end", 329 regex: /`/, 330 next: "pop" 331 }, { 332 defaultToken: "string.quasi" 333 }] 334 }); 335 if (!options || options.jsx != false) JSX.call(this); 336 } 337 338 this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]); 339 this.normalizeRules(); 340 }; 341 342 oop.inherits(JavaScriptHighlightRules, TextHighlightRules); 343 344 function JSX() { 345 var tagRegex = identifierRe.replace("\\d", "\\d\\-"); 346 var jsxTag = { 347 onMatch: function onMatch(val, state, stack) { 348 var offset = val.charAt(1) == "/" ? 2 : 1; 349 350 if (offset == 1) { 351 if (state != this.nextState) stack.unshift(this.next, this.nextState, 0);else stack.unshift(this.next); 352 stack[2]++; 353 } else if (offset == 2) { 354 if (state == this.nextState) { 355 stack[1]--; 356 357 if (!stack[1] || stack[1] < 0) { 358 stack.shift(); 359 stack.shift(); 360 } 361 } 362 } 363 364 return [{ 365 type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", 366 value: val.slice(0, offset) 367 }, { 368 type: "meta.tag.tag-name.xml", 369 value: val.substr(offset) 370 }]; 371 }, 372 regex: "</?" + tagRegex + "", 373 next: "jsxAttributes", 374 nextState: "jsx" 375 }; 376 this.$rules.start.unshift(jsxTag); 377 var jsxJsRule = { 378 regex: "{", 379 token: "paren.quasi.start", 380 push: "start" 381 }; 382 this.$rules.jsx = [jsxJsRule, jsxTag, { 383 include: "reference" 384 }, {
385 defaultToken: "string" 386 }]; 387 this.$rules.jsxAttributes = [{ 388 token: "meta.tag.punctuation.tag-close.xml", 389 regex: "/?>", 390 onMatch: function onMatch(value, currentState, stack) { 391 if (currentState == stack[0]) stack.shift(); 392 393 if (value.length == 2) { 394 if (stack[0] == this.nextState) stack[1]--; 395 396 if (!stack[1] || stack[1] < 0) { 397 stack.splice(0, 2); 398 } 399 } 400 401 this.next = stack[0] || "start"; 402 return [{ 403 type: this.token, 404 value: value 405 }]; 406 }, 407 nextState: "jsx" 408 }, jsxJsRule, comments("jsxAttributes"), { 409 token: "entity.other.attribute-name.xml", 410 regex: tagRegex 411 }, { 412 token: "keyword.operator.attribute-equals.xml", 413 regex: "=" 414 }, { 415 token: "text.tag-whitespace.xml", 416 regex: "\\s+" 417 }, { 418 token: "string.attribute-value.xml", 419 regex: "'", 420 stateName: "jsx_attr_q", 421 push: [{ 422 token: "string.attribute-value.xml", 423 regex: "'", 424 next: "pop" 425 }, { 426 include: "reference" 427 }, { 428 defaultToken: "string.attribute-value.xml" 429 }] 430 }, { 431 token: "string.attribute-value.xml", 432 regex: '"', 433 stateName: "jsx_attr_qq", 434 push: [{ 435 token: "string.attribute-value.xml", 436 regex: '"', 437 next: "pop" 438 }, { 439 include: "reference" 440 }, { 441 defaultToken: "string.attribute-value.xml" 442 }] 443 }, jsxTag]; 444 this.$rules.reference = [{ 445 token: "constant.language.escape.reference.xml", 446 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" 447 }]; 448 } 449 450 function comments(next) { 451 return [{ 452 token: "comment", 453 // multi line comment 454 regex: /\/\*/, 455 next: [DocCommentHighlightRules.getTagRule(), { 456 token: "comment", 457 regex: "\\*\\/", 458 next: next || "pop" 459 }, { 460 defaultToken: "comment", 461 caseInsensitive: true 462 }] 463 }, { 464 token: "comment", 465 regex: "\\/\\/", 466 next: [DocCommentHighlightRules.getTagRule(), { 467 token: "comment", 468 regex: "$|^", 469 next: next || "pop" 470 }, { 471 defaultToken: "comment", 472 caseInsensitive: true 473 }] 474 }]; 475 } 476 477 exports.JavaScriptHighlightRules = JavaScriptHighlightRules; 478}); 479ace.define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "ace/range"], function (require, exports, module) { 480 "use strict"; 481 482 var Range = require("../range").Range; 483 484 var MatchingBraceOutdent = function MatchingBraceOutdent() {}; 485 486 (function () { 487 this.checkOutdent = function (line, input) { 488 if (!/^\s+$/.test(line)) return false; 489 return /^\s*\}/.test(input); 490 }; 491 492 this.autoOutdent = function (doc, row) { 493 var line = doc.getLine(row); 494 var match = line.match(/^(\s*\})/); 495 if (!match) return 0; 496 var column = match[1].length; 497 var openBracePos = doc.findMatchingBracket({ 498 row: row, 499 column: column 500 }); 501 if (!openBracePos || openBracePos.row == row) return 0; 502 var indent = this.$getIndent(doc.getLine(openBracePos.row)); 503 doc.replace(new Range(row, 0, row, column - 1), indent); 504 }; 505 506 this.$getIndent = function (line) { 507 return line.match(/^\s*/)[0]; 508 }; 509 }).call(MatchingBraceOutdent.prototype); 510 exports.MatchingBraceOutdent = MatchingBraceOutdent; 511}); 512ace.define("ace/mode/folding/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function (require, exports, module) { 513 "use strict"; 514 515 var oop = require("../../lib/oop"); 516 517 var Range = require("../../range").Range; 518 519 var BaseFoldMode = require("./fold_mode").FoldMode; 520 521 var FoldMode = exports.FoldMode = function (commentRegex) { 522 if (commentRegex) { 523 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); 524 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); 525 } 526 }; 527 528 oop.inherits(FoldMode, BaseFoldMode); 529 (function () { 530 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; 531 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; 532 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; 533 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; 534 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; 535 this._getFoldWidgetBase = this.getFoldWidget; 536 537 this.getFoldWidget = function (session, foldStyle, row) { 538 var line = session.getLine(row); 539 540 if (this.singleLineBlockCommentRe.test(line)) { 541 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) return ""; 542 } 543 544 var fw = this._getFoldWidgetBase(session, foldStyle, row); 545 546 if (!fw && this.startRegionRe.test(line)) return "start"; // lineCommentRegionStart 547 548 return fw; 549 }; 550 551 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { 552 var line = session.getLine(row); 553 if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row); 554 var match = line.match(this.foldingStartMarker); 555 556 if (match) { 557 var i = match.index; 558 if (match[1]) return this.openingBracketBlock(session, match[1], row, i); 559 var range = session.getCommentFoldRange(row, i + match[0].length, 1); 560 561 if (range && !range.isMultiLine()) { 562 if (forceMultiline) {
563 range = this.getSectionRange(session, row); 564 } else if (foldStyle != "all") range = null; 565 } 566 567 return range; 568 } 569 570 if (foldStyle === "markbegin") return; 571 var match = line.match(this.foldingStopMarker); 572 573 if (match) { 574 var i = match.index + match[0].length; 575 if (match[1]) return this.closingBracketBlock(session, match[1], row, i); 576 return session.getCommentFoldRange(row, i, -1); 577 } 578 }; 579 580 this.getSectionRange = function (session, row) { 581 var line = session.getLine(row); 582 var startIndent = line.search(/\S/); 583 var startRow = row; 584 var startColumn = line.length; 585 row = row + 1; 586 var endRow = row; 587 var maxRow = session.getLength(); 588 589 while (++row < maxRow) { 590 line = session.getLine(row); 591 var indent = line.search(/\S/); 592 if (indent === -1) continue; 593 if (startIndent > indent) break; 594 var subRange = this.getFoldWidgetRange(session, "all", row); 595 596 if (subRange) { 597 if (subRange.start.row <= startRow) { 598 break; 599 } else if (subRange.isMultiLine()) { 600 row = subRange.end.row; 601 } else if (startIndent == indent) { 602 break; 603 } 604 } 605 606 endRow = row; 607 } 608 609 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); 610 }; 611 612 this.getCommentRegionBlock = function (session, line, row) { 613 var startColumn = line.search(/\s*$/); 614 var maxRow = session.getLength(); 615 var startRow = row; 616 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; 617 var depth = 1; 618 619 while (++row < maxRow) { 620 line = session.getLine(row); 621 var m = re.exec(line); 622 if (!m) continue; 623 if (m[1]) depth--;else depth++; 624 if (!depth) break; 625 } 626 627 var endRow = row; 628 629 if (endRow > startRow) { 630 return new Range(startRow, startColumn, endRow, line.length); 631 } 632 }; 633 }).call(FoldMode.prototype); 634}); 635ace.define("ace/mode/javascript", ["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 (require, exports, module) { 636 "use strict"; 637 638 var oop = require("../lib/oop"); 639 640 var TextMode = require("./text").Mode; 641 642 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; 643 644 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; 645 646 var WorkerClient = require("../worker/worker_client").WorkerClient; 647 648 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; 649 650 var CStyleFoldMode = require("./folding/cstyle").FoldMode; 651 652 var Mode = function Mode() { 653 this.HighlightRules = JavaScriptHighlightRules; 654 this.$outdent = new MatchingBraceOutdent(); 655 this.$behaviour = new CstyleBehaviour(); 656 this.foldingRules = new CStyleFoldMode(); 657 }; 658 659 oop.inherits(Mode, TextMode); 660 (function () { 661 this.lineCommentStart = "//"; 662 this.blockComment = { 663 start: "/*", 664 end: "*/" 665 }; 666 this.$quotes = { 667 '"': '"', 668 "'": "'", 669 "`": "`" 670 }; 671 672 this.getNextLineIndent = function (state, line, tab) { 673 var indent = this.$getIndent(line); 674 var tokenizedLine = this.getTokenizer().getLineTokens(line, state); 675 var tokens = tokenizedLine.tokens; 676 var endState = tokenizedLine.state; 677 678 if (tokens.length && tokens[tokens.length - 1].type == "comment") { 679 return indent; 680 } 681 682 if (state == "start" || state == "no_regex") { 683 var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); 684 685 if (match) { 686 indent += tab; 687 } 688 } else if (state == "doc-start") { 689 if (endState == "start" || endState == "no_regex") { 690 return ""; 691 } 692 693 var match = line.match(/^\s*(\/?)\*/); 694 695 if (match) { 696 if (match[1]) { 697 indent += " "; 698 } 699 700 indent += "* "; 701 } 702 } 703 704 return indent; 705 }; 706 707 this.checkOutdent = function (state, line, input) { 708 return this.$outdent.checkOutdent(line, input); 709 }; 710 711 this.autoOutdent = function (state, doc, row) { 712 this.$outdent.autoOutdent(doc, row); 713 }; 714 715 this.createWorker = function (session) { 716 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); 717 worker.attachToDocument(session.getDocument()); 718 worker.on("annotate", function (results) { 719 session.setAnnotations(results.data); 720 }); 721 worker.on("terminate", function () { 722 session.clearAnnotations(); 723 }); 724 return worker; 725 }; 726 727 this.$id = "ace/mode/javascript"; 728 }).call(Mode.prototype); 729 exports.Mode = Mode; 730}); 731ace.define("ace/mode/scala_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/doc_comment_highlight_rules", "ace/mode/text_highlight_rules"], function (require, exports, module) { 732 "use strict"; 733 734 var oop = require("../lib/oop"); 735 736 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; 737 738 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 739
740 var ScalaHighlightRules = function ScalaHighlightRules() { 741 var keywords = "case|default|do|else|for|if|match|while|throw|return|try|trye|catch|finally|yield|" + "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|null|" + "override|package|private|protected|sealed|super|this|trait|type|val|var|with|" + "assert|assume|require|print|println|printf|readLine|readBoolean|readByte|readShort|" + // package scala 742 "readChar|readInt|readLong|readFloat|readDouble" // package scala 743 ; 744 var buildinConstants = "true|false"; 745 var langClasses = "AbstractMethodError|AssertionError|ClassCircularityError|" + "ClassFormatError|Deprecated|EnumConstantNotPresentException|" + "ExceptionInInitializerError|IllegalAccessError|" + "IllegalThreadStateException|InstantiationError|InternalError|" + "NegativeArraySizeException|NoSuchFieldError|Override|Process|" + "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|" + "SuppressWarnings|TypeNotPresentException|UnknownError|" + "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|" + "InstantiationException|IndexOutOfBoundsException|" + "ArrayIndexOutOfBoundsException|CloneNotSupportedException|" + "NoSuchFieldException|IllegalArgumentException|NumberFormatException|" + "SecurityException|Void|InheritableThreadLocal|IllegalStateException|" + "InterruptedException|NoSuchMethodException|IllegalAccessException|" + "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|" + "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|" + "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|" + "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|" + "Character|Boolean|StackTraceElement|Appendable|StringBuffer|" + "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|" + "StackOverflowError|OutOfMemoryError|VirtualMachineError|" + "ArrayStoreException|ClassCastException|LinkageError|" + "NoClassDefFoundError|ClassNotFoundException|RuntimeException|" + "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|" + "Cloneable|Class|CharSequence|Comparable|String|Object|" + "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" + "Option|Array|Char|Byte|Int|Long|Nothing|" + "App|Application|BufferedIterator|BigDecimal|BigInt|Console|Either|" + "Enumeration|Equiv|Fractional|Function|IndexedSeq|Integral|Iterator|" + "Map|Numeric|Nil|NotNull|Ordered|Ordering|PartialFunction|PartialOrdering|" + "Product|Proxy|Range|Responder|Seq|Serializable|Set|Specializable|Stream|" + "StringContext|Symbol|Traversable|TraversableOnce|Tuple|Vector|Pair|Triple"; 746 var keywordMapper = this.createKeywordMapper({ 747 "variable.language": "this", 748 "keyword": keywords, 749 "support.function": langClasses, 750 "constant.language": buildinConstants 751 }, "identifier"); 752 this.$rules = { 753 "start": [{ 754 token: "comment", 755 regex: "\\/\\/.*$" 756 }, DocCommentHighlightRules.getStartRule("doc-start"), { 757 token: "comment", 758 // multi line comment 759 regex: "\\/\\*", 760 next: "comment" 761 }, { 762 token: "string.regexp", 763 regex: "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" 764 }, { 765 token: "string", 766 regex: '"""', 767 next: "tstring" 768 }, { 769 token: "string", 770 regex: '"(?=.)', 771 // " strings can't span multiple lines 772 next: "string" 773 }, { 774 token: "symbol.constant", 775 // single line 776 regex: "'[\\w\\d_]+" 777 }, { 778 token: "constant.numeric", 779 // hex 780 regex: "0[xX][0-9a-fA-F]+\\b" 781 }, { 782 token: "constant.numeric", 783 // float 784 regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" 785 }, { 786 token: "constant.language.boolean", 787 regex: "(?:true|false)\\b" 788 }, { 789 token: keywordMapper, 790 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" 791 }, { 792 token: "keyword.operator", 793 regex: "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" 794 }, { 795 token: "paren.lparen", 796 regex: "[[({]" 797 }, { 798 token: "paren.rparen", 799 regex: "[\\])}]" 800 }, { 801 token: "text", 802 regex: "\\s+" 803 }], 804 "comment": [{ 805 token: "comment", 806 // closing comment 807 regex: "\\*\\/", 808 next: "start" 809 }, { 810 defaultToken: "comment" 811 }], 812 "string": [{ 813 token: "escape", 814 regex: '\\\\"' 815 }, { 816 token: "string", 817 regex: '"', 818 next: "start" 819 }, {
820 token: "string.invalid", 821 regex: '[^"\\\\]*$', 822 next: "start" 823 }, { 824 token: "string", 825 regex: '[^"\\\\]+' 826 }], 827 "tstring": [{ 828 token: "string", 829 regex: '"{3,5}', 830 next: "start" 831 }, { 832 defaultToken: "string" 833 }] 834 }; 835 this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]); 836 }; 837 838 oop.inherits(ScalaHighlightRules, TextHighlightRules); 839 exports.ScalaHighlightRules = ScalaHighlightRules; 840}); 841ace.define("ace/mode/scala", ["require", "exports", "module", "ace/lib/oop", "ace/mode/javascript", "ace/mode/scala_highlight_rules"], function (require, exports, module) { 842 "use strict"; 843 844 var oop = require("../lib/oop"); 845 846 var JavaScriptMode = require("./javascript").Mode; 847 848 var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules; 849 850 var Mode = function Mode() { 851 JavaScriptMode.call(this); 852 this.HighlightRules = ScalaHighlightRules; 853 }; 854 855 oop.inherits(Mode, JavaScriptMode); 856 (function () { 857 this.createWorker = function (session) { 858 return null; 859 }; 860 861 this.$id = "ace/mode/scala"; 862 }).call(Mode.prototype); 863 exports.Mode = Mode; 864}); 865 866(function () { 867 ace.require(["ace/mode/scala"], function (m) { 868 if (typeof module == "object" && typeof exports == "object" && module) { 869 module.exports = m; 870 } 871 }); 872})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.