vendor/assets/javascripts/ace/mode-java.js in ace-rails-ap-4.0.1 vs vendor/assets/javascripts/ace/mode-java.js in ace-rails-ap-4.0.2

- old
+ new

@@ -85,42 +85,34 @@ }, "identifier"); var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode + "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode "[0-2][0-7]{0,2}|" + // oct - "3[0-6][0-7]?|" + // oct - "37[0-7]?|" + // oct + "3[0-7][0-7]?|" + // oct "[4-7][0-7]?|" + //oct ".)"; this.$rules = { "no_regex" : [ - { - token : "comment", - regex : "\\/\\/", - next : "line_comment" - }, DocCommentHighlightRules.getStartRule("doc-start"), + comments("no_regex"), { - token : "comment", // multi line comment - regex : /\/\*/, - next : "comment" - }, { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token : "constant.numeric", // hex - regex : /0[xX][0-9a-fA-F]+\b/ + regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/ }, { token : "constant.numeric", // float - regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ + regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ }, { token : [ "storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text","keyword.operator" ], @@ -184,11 +176,11 @@ token : "punctuation.operator", regex : /[.](?![.])/, next : "property" }, { token : "keyword.operator", - regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/, + regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/, next : "start" }, { token : "punctuation.operator", regex : /[?:,;.]/, next : "start" @@ -236,19 +228,12 @@ next: "no_regex" } ], "start": [ DocCommentHighlightRules.getStartRule("doc-start"), + comments("start"), { - token : "comment", // multi line comment - regex : "\\/\\*", - next : "comment_regex_allowed" - }, { - token : "comment", - regex : "\\/\\/", - next : "line_comment_regex_allowed" - }, { token: "string.regexp", regex: "\\/", next: "regex" }, { token : "text", @@ -322,30 +307,10 @@ token: "empty", regex: "", next: "no_regex" } ], - "comment_regex_allowed" : [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "\\*\\/", next : "start"}, - {defaultToken : "comment", caseInsensitive: true} - ], - "comment" : [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "\\*\\/", next : "no_regex"}, - {defaultToken : "comment", caseInsensitive: true} - ], - "line_comment_regex_allowed" : [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "$|^", next : "start"}, - {defaultToken : "comment", caseInsensitive: true} - ], - "line_comment" : [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "$|^", next : "no_regex"}, - {defaultToken : "comment", caseInsensitive: true} - ], "qqstring" : [ { token : "constant.language.escape", regex : escapedRe }, { @@ -383,13 +348,12 @@ this.$rules.no_regex.unshift({ regex: "[{}]", onMatch: function(val, state, stack) { this.next = val == "{" ? this.nextState : ""; if (val == "{" && stack.length) { stack.unshift("start", state); - return "paren"; } - if (val == "}" && stack.length) { + else if (val == "}" && stack.length) { stack.shift(); this.next = stack.shift(); if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) return "paren.quasi.end"; } @@ -488,10 +452,11 @@ return [{type: this.token, value: value}]; }, nextState: "jsx" }, jsxJsRule, + comments("jsxAttributes"), { token : "entity.other.attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.attribute-equals.xml", @@ -503,31 +468,52 @@ token : "string.attribute-value.xml", regex : "'", stateName : "jsx_attr_q", push : [ {token : "string.attribute-value.xml", regex: "'", next: "pop"}, - jsxJsRule, {include : "reference"}, {defaultToken : "string.attribute-value.xml"} ] }, { token : "string.attribute-value.xml", regex : '"', stateName : "jsx_attr_qq", push : [ - jsxJsRule, {token : "string.attribute-value.xml", regex: '"', next: "pop"}, {include : "reference"}, {defaultToken : "string.attribute-value.xml"} ] - }]; + }, + jsxTag + ]; this.$rules.reference = [{ token : "constant.language.escape.reference.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }]; } +function comments(next) { + return [ + { + token : "comment", // multi line comment + regex : /\/\*/, + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "\\*\\/", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + }, { + token : "comment", + regex : "\\/\\/", + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "$|^", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + } + ]; +} exports.JavaScriptHighlightRules = JavaScriptHighlightRules; }); define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { "use strict"; @@ -1228,13 +1214,13 @@ }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" + regex : /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ }, { token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + regex : /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ }, { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { token : keywordMapper,