Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Unified Diff: third_party/WebKit/Source/devtools/front_end/cm_modes/clike.js

Issue 2862603003: Revert of DevTools: Roll CodeMirror to 5.25.1
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ee7b077ee8b22f9be44cd8a07ac1457f4beb4775..a37921fdae7eda419b2f429189efaac1df4b4510 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 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,7 +64,8 @@
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 || /[+\-*&%=<>!?|\/]/;
+ isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
+ endStatement = parserConfig.endStatement || /^[;:,]$/;
var curPunc, isDefKeyword;
@@ -176,8 +177,7 @@
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
- if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
- while (state.context.type == "statement") popContext(state);
+ if (endStatement.test(curPunc)) 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,19 +425,17 @@
"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 @interface"),
+ "try volatile while"),
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 @interface"),
+ defKeywords: words("class interface package enum"),
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";
}
@@ -493,11 +491,14 @@
/* 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 " +
@@ -518,7 +519,6 @@
atoms: words("true false null"),
indentStatements: false,
indentSwitch: false,
- isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
@@ -575,7 +575,7 @@
"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 suspend"
+ "external annotation crossinline const operator infix"
),
types: words(
/* package java.lang */
@@ -587,7 +587,6 @@
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"),

Powered by Google App Engine
This is Rietveld 408576698