| Index: third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js b/third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js
|
| index a37921fdae7eda419b2f429189efaac1df4b4510..ee7b077ee8b22f9be44cd8a07ac1457f4beb4775 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js
|
| @@ -21,7 +21,7 @@ function Context(indented, column, type, info, align, prev) {
|
| }
|
| function pushContext(state, col, type, info) {
|
| var indent = state.indented;
|
| - if (state.context && state.context.type != "statement" && type != "statement")
|
| + if (state.context && state.context.type == "statement" && type != "statement")
|
| indent = state.context.indented;
|
| return state.context = new Context(indent, col, type, info, null, state.context);
|
| }
|
| @@ -64,8 +64,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
|
| numberStart = parserConfig.numberStart || /[\d\.]/,
|
| number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
|
| - isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
|
| - endStatement = parserConfig.endStatement || /^[;:,]$/;
|
| + isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/;
|
|
|
| var curPunc, isDefKeyword;
|
|
|
| @@ -177,7 +176,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| if (style == "comment" || style == "meta") return style;
|
| if (ctx.align == null) ctx.align = true;
|
|
|
| - if (endStatement.test(curPunc)) while (state.context.type == "statement") popContext(state);
|
| + if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
|
| + while (state.context.type == "statement") popContext(state);
|
| else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
| else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
| else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
| @@ -425,17 +425,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| "do else enum extends final finally float for goto if implements import " +
|
| "instanceof interface native new package private protected public " +
|
| "return static strictfp super switch synchronized this throw throws transient " +
|
| - "try volatile while"),
|
| + "try volatile while @interface"),
|
| types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
|
| "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
|
| blockKeywords: words("catch class do else finally for if switch try while"),
|
| - defKeywords: words("class interface package enum"),
|
| + defKeywords: words("class interface package enum @interface"),
|
| typeFirstDefinitions: true,
|
| atoms: words("true false null"),
|
| - endStatement: /^[;:]$/,
|
| number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
| hooks: {
|
| "@": function(stream) {
|
| + // Don't match the @interface keyword.
|
| + if (stream.match('interface', false)) return false;
|
| +
|
| stream.eatWhile(/[\w\$_]/);
|
| return "meta";
|
| }
|
| @@ -491,14 +493,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| /* scala */
|
| "abstract case catch class def do else extends final finally for forSome if " +
|
| "implicit import lazy match new null object override package private protected return " +
|
| - "sealed super this throw trait try type val var while with yield _ : = => <- <: " +
|
| - "<% >: # @ " +
|
| + "sealed super this throw trait try type val var while with yield _ " +
|
|
|
| /* package scala */
|
| "assert assume require print println printf readLine readBoolean readByte readShort " +
|
| - "readChar readInt readLong readFloat readDouble " +
|
| -
|
| - ":: #:: "
|
| + "readChar readInt readLong readFloat readDouble"
|
| ),
|
| types: words(
|
| "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
| @@ -519,6 +518,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| atoms: words("true false null"),
|
| indentStatements: false,
|
| indentSwitch: false,
|
| + isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
|
| hooks: {
|
| "@": function(stream) {
|
| stream.eatWhile(/[\w\$_]/);
|
| @@ -575,7 +575,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| "file import where by get set abstract enum open inner override private public internal " +
|
| "protected catch finally out final vararg reified dynamic companion constructor init " +
|
| "sealed field property receiver param sparam lateinit data inline noinline tailrec " +
|
| - "external annotation crossinline const operator infix"
|
| + "external annotation crossinline const operator infix suspend"
|
| ),
|
| types: words(
|
| /* package java.lang */
|
| @@ -587,6 +587,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
| intendSwitch: false,
|
| indentStatements: false,
|
| multiLineStrings: true,
|
| + number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
| blockKeywords: words("catch class do else finally for if where try while enum"),
|
| defKeywords: words("class val var object package interface fun"),
|
| atoms: words("true false null this"),
|
|
|