1 define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
4 var oop = require("../lib/oop");
5 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7 var DocCommentHighlightRules = function() {
10 token : "comment.doc.tag",
11 regex : "@[\\w\\d_]+" // TODO: fix email addresses
13 DocCommentHighlightRules.getTagRule(),
15 defaultToken : "comment.doc",
21 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
23 DocCommentHighlightRules.getTagRule = function(start) {
25 token : "comment.doc.tag.storage.type",
26 regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
30 DocCommentHighlightRules.getStartRule = function(start) {
32 token : "comment.doc", // doc comment
33 regex : "\\/\\*(?=\\*)",
38 DocCommentHighlightRules.getEndRule = function (start) {
40 token : "comment.doc", // closing comment
47 exports.DocCommentHighlightRules = DocCommentHighlightRules;
51 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) {
54 var oop = require("../lib/oop");
55 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
59 var JavaScriptHighlightRules = function(options) {
60 var keywordMapper = this.createKeywordMapper({
62 "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
63 "Namespace|QName|XML|XMLList|" + // E4X
64 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
65 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
66 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
67 "SyntaxError|TypeError|URIError|" +
68 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
69 "isNaN|parseFloat|parseInt|" +
70 "JSON|Math|" + // Other
71 "this|arguments|prototype|window|document" , // Pseudo
73 "const|yield|import|get|set|async|await|" +
74 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
75 "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
76 "__parent__|__count__|escape|unescape|with|__proto__|" +
77 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
79 "const|let|var|function",
81 "null|Infinity|NaN|undefined",
84 "constant.language.boolean": "true|false"
86 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
88 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89 "u[0-9a-fA-F]{4}|" + // unicode
90 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
91 "[0-2][0-7]{0,2}|" + // oct
92 "3[0-7][0-7]?|" + // oct
93 "[4-7][0-7]?|" + //oct
98 DocCommentHighlightRules.getStartRule("doc-start"),
109 token : "constant.numeric", // hexadecimal, octal and binary
110 regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
112 token : "constant.numeric", // decimal integers and floats
113 regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
116 "storage.type", "punctuation.operator", "support.function",
117 "punctuation.operator", "entity.name.function", "text","keyword.operator"
119 regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
120 next: "function_arguments"
123 "storage.type", "punctuation.operator", "entity.name.function", "text",
124 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
126 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
127 next: "function_arguments"
130 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
131 "text", "paren.lparen"
133 regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
134 next: "function_arguments"
137 "storage.type", "punctuation.operator", "entity.name.function", "text",
138 "keyword.operator", "text",
139 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
141 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
142 next: "function_arguments"
145 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
147 regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
148 next: "function_arguments"
151 "entity.name.function", "text", "punctuation.operator",
152 "text", "storage.type", "text", "paren.lparen"
154 regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
155 next: "function_arguments"
158 "text", "text", "storage.type", "text", "paren.lparen"
160 regex : "(:)(\\s*)(function)(\\s*)(\\()",
161 next: "function_arguments"
164 regex : "from(?=\\s*('|\"))"
167 regex : "(?:" + kwBeforeRe + ")\\b",
170 token : ["support.constant"],
173 token : ["storage.type", "punctuation.operator", "support.function.firebug"],
174 regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
176 token : keywordMapper,
179 token : "punctuation.operator",
180 regex : /[.](?![.])/,
183 token : "storage.type",
186 token : "keyword.operator",
187 regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
190 token : "punctuation.operator",
194 token : "paren.lparen",
198 token : "paren.rparen",
210 "storage.type", "punctuation.operator", "entity.name.function", "text",
211 "keyword.operator", "text",
212 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
214 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
215 next: "function_arguments"
217 token : "punctuation.operator",
220 token : "support.function",
221 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(?=\()/
223 token : "support.function.dom",
224 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(?=\()/
226 token : "support.constant",
227 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/
229 token : "identifier",
238 DocCommentHighlightRules.getStartRule("doc-start"),
241 token: "string.regexp",
256 token: "regexp.keyword.operator",
257 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
259 token: "string.regexp",
260 regex: "/[sxngimy]*",
264 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
266 token : "constant.language.escape",
267 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
269 token : "constant.language.delimiter",
272 token: "constant.language.escape",
274 next: "regex_character_class"
280 defaultToken: "string.regexp"
283 "regex_character_class": [
285 token: "regexp.charclass.keyword.operator",
286 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
288 token: "constant.language.escape",
292 token: "constant.language.escape",
299 defaultToken: "string.regexp.charachterclass"
302 "function_arguments": [
304 token: "variable.parameter",
307 token: "punctuation.operator",
310 token: "punctuation.operator",
320 token : "constant.language.escape",
325 consumeLineEnd : true
331 defaultToken: "string"
336 token : "constant.language.escape",
341 consumeLineEnd : true
347 defaultToken: "string"
353 if (!options || !options.noES6) {
354 this.$rules.no_regex.unshift({
355 regex: "[{}]", onMatch: function(val, state, stack) {
356 this.next = val == "{" ? this.nextState : "";
357 if (val == "{" && stack.length) {
358 stack.unshift("start", state);
360 else if (val == "}" && stack.length) {
362 this.next = stack.shift();
363 if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
364 return "paren.quasi.end";
366 return val == "{" ? "paren.lparen" : "paren.rparen";
370 token : "string.quasi.start",
373 token : "constant.language.escape",
376 token : "paren.quasi.start",
380 token : "string.quasi.end",
384 defaultToken: "string.quasi"
388 if (!options || options.jsx != false)
392 this.embedRules(DocCommentHighlightRules, "doc-",
393 [ DocCommentHighlightRules.getEndRule("no_regex") ]);
395 this.normalizeRules();
398 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
401 var tagRegex = identifierRe.replace("\\d", "\\d\\-");
403 onMatch : function(val, state, stack) {
404 var offset = val.charAt(1) == "/" ? 2 : 1;
406 if (state != this.nextState)
407 stack.unshift(this.next, this.nextState, 0);
409 stack.unshift(this.next);
411 } else if (offset == 2) {
412 if (state == this.nextState) {
414 if (!stack[1] || stack[1] < 0) {
421 type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
422 value: val.slice(0, offset)
424 type: "meta.tag.tag-name.xml",
425 value: val.substr(offset)
428 regex : "</?" + tagRegex + "",
429 next: "jsxAttributes",
432 this.$rules.start.unshift(jsxTag);
435 token: "paren.quasi.start",
441 {include : "reference"},
442 {defaultToken: "string"}
444 this.$rules.jsxAttributes = [{
445 token : "meta.tag.punctuation.tag-close.xml",
447 onMatch : function(value, currentState, stack) {
448 if (currentState == stack[0])
450 if (value.length == 2) {
451 if (stack[0] == this.nextState)
453 if (!stack[1] || stack[1] < 0) {
457 this.next = stack[0] || "start";
458 return [{type: this.token, value: value}];
463 comments("jsxAttributes"),
465 token : "entity.other.attribute-name.xml",
468 token : "keyword.operator.attribute-equals.xml",
471 token : "text.tag-whitespace.xml",
474 token : "string.attribute-value.xml",
476 stateName : "jsx_attr_q",
478 {token : "string.attribute-value.xml", regex: "'", next: "pop"},
479 {include : "reference"},
480 {defaultToken : "string.attribute-value.xml"}
483 token : "string.attribute-value.xml",
485 stateName : "jsx_attr_qq",
487 {token : "string.attribute-value.xml", regex: '"', next: "pop"},
488 {include : "reference"},
489 {defaultToken : "string.attribute-value.xml"}
494 this.$rules.reference = [{
495 token : "constant.language.escape.reference.xml",
496 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
500 function comments(next) {
503 token : "comment", // multi line comment
506 DocCommentHighlightRules.getTagRule(),
507 {token : "comment", regex : "\\*\\/", next : next || "pop"},
508 {defaultToken : "comment", caseInsensitive: true}
514 DocCommentHighlightRules.getTagRule(),
515 {token : "comment", regex : "$|^", next : next || "pop"},
516 {defaultToken : "comment", caseInsensitive: true}
521 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
524 define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
527 var Range = require("../range").Range;
529 var MatchingBraceOutdent = function() {};
533 this.checkOutdent = function(line, input) {
534 if (! /^\s+$/.test(line))
537 return /^\s*\}/.test(input);
540 this.autoOutdent = function(doc, row) {
541 var line = doc.getLine(row);
542 var match = line.match(/^(\s*\})/);
544 if (!match) return 0;
546 var column = match[1].length;
547 var openBracePos = doc.findMatchingBracket({row: row, column: column});
549 if (!openBracePos || openBracePos.row == row) return 0;
551 var indent = this.$getIndent(doc.getLine(openBracePos.row));
552 doc.replace(new Range(row, 0, row, column-1), indent);
555 this.$getIndent = function(line) {
556 return line.match(/^\s*/)[0];
559 }).call(MatchingBraceOutdent.prototype);
561 exports.MatchingBraceOutdent = MatchingBraceOutdent;
564 define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
567 var oop = require("../../lib/oop");
568 var Range = require("../../range").Range;
569 var BaseFoldMode = require("./fold_mode").FoldMode;
571 var FoldMode = exports.FoldMode = function(commentRegex) {
573 this.foldingStartMarker = new RegExp(
574 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
576 this.foldingStopMarker = new RegExp(
577 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
581 oop.inherits(FoldMode, BaseFoldMode);
585 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
586 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
587 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
588 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
589 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
590 this._getFoldWidgetBase = this.getFoldWidget;
591 this.getFoldWidget = function(session, foldStyle, row) {
592 var line = session.getLine(row);
594 if (this.singleLineBlockCommentRe.test(line)) {
595 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
599 var fw = this._getFoldWidgetBase(session, foldStyle, row);
601 if (!fw && this.startRegionRe.test(line))
602 return "start"; // lineCommentRegionStart
607 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
608 var line = session.getLine(row);
610 if (this.startRegionRe.test(line))
611 return this.getCommentRegionBlock(session, line, row);
613 var match = line.match(this.foldingStartMarker);
618 return this.openingBracketBlock(session, match[1], row, i);
620 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
622 if (range && !range.isMultiLine()) {
623 if (forceMultiline) {
624 range = this.getSectionRange(session, row);
625 } else if (foldStyle != "all")
632 if (foldStyle === "markbegin")
635 var match = line.match(this.foldingStopMarker);
637 var i = match.index + match[0].length;
640 return this.closingBracketBlock(session, match[1], row, i);
642 return session.getCommentFoldRange(row, i, -1);
646 this.getSectionRange = function(session, row) {
647 var line = session.getLine(row);
648 var startIndent = line.search(/\S/);
650 var startColumn = line.length;
653 var maxRow = session.getLength();
654 while (++row < maxRow) {
655 line = session.getLine(row);
656 var indent = line.search(/\S/);
659 if (startIndent > indent)
661 var subRange = this.getFoldWidgetRange(session, "all", row);
664 if (subRange.start.row <= startRow) {
666 } else if (subRange.isMultiLine()) {
667 row = subRange.end.row;
668 } else if (startIndent == indent) {
675 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
677 this.getCommentRegionBlock = function(session, line, row) {
678 var startColumn = line.search(/\s*$/);
679 var maxRow = session.getLength();
682 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
684 while (++row < maxRow) {
685 line = session.getLine(row);
686 var m = re.exec(line);
695 if (endRow > startRow) {
696 return new Range(startRow, startColumn, endRow, line.length);
700 }).call(FoldMode.prototype);
704 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) {
707 var oop = require("../lib/oop");
708 var TextMode = require("./text").Mode;
709 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
710 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
711 var WorkerClient = require("../worker/worker_client").WorkerClient;
712 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
713 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
715 var Mode = function() {
716 this.HighlightRules = JavaScriptHighlightRules;
718 this.$outdent = new MatchingBraceOutdent();
719 this.$behaviour = new CstyleBehaviour();
720 this.foldingRules = new CStyleFoldMode();
722 oop.inherits(Mode, TextMode);
726 this.lineCommentStart = "//";
727 this.blockComment = {start: "/*", end: "*/"};
728 this.$quotes = {'"': '"', "'": "'", "`": "`"};
730 this.getNextLineIndent = function(state, line, tab) {
731 var indent = this.$getIndent(line);
733 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
734 var tokens = tokenizedLine.tokens;
735 var endState = tokenizedLine.state;
737 if (tokens.length && tokens[tokens.length-1].type == "comment") {
741 if (state == "start" || state == "no_regex") {
742 var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
746 } else if (state == "doc-start") {
747 if (endState == "start" || endState == "no_regex") {
750 var match = line.match(/^\s*(\/?)\*/);
762 this.checkOutdent = function(state, line, input) {
763 return this.$outdent.checkOutdent(line, input);
766 this.autoOutdent = function(state, doc, row) {
767 this.$outdent.autoOutdent(doc, row);
770 this.createWorker = function(session) {
771 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
772 worker.attachToDocument(session.getDocument());
774 worker.on("annotate", function(results) {
775 session.setAnnotations(results.data);
778 worker.on("terminate", function() {
779 session.clearAnnotations();
785 this.$id = "ace/mode/javascript";
786 }).call(Mode.prototype);