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

Unified Diff: third_party/WebKit/Source/devtools/front_end/cm_modes/shell.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/shell.js
diff --git a/third_party/WebKit/Source/devtools/front_end/cm_modes/shell.js b/third_party/WebKit/Source/devtools/front_end/cm_modes/shell.js
index 76c67cd2b7d3a2a18cd0d196fadcbf3069fae4b9..a684e8c233ad293ee677cb53d13bd53c9acba7ca 100644
--- a/third_party/WebKit/Source/devtools/front_end/cm_modes/shell.js
+++ b/third_party/WebKit/Source/devtools/front_end/cm_modes/shell.js
@@ -46,7 +46,7 @@
return null;
}
if (ch === '\'' || ch === '"' || ch === '`') {
- state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
+ state.tokens.unshift(tokenString(ch));
return tokenize(stream, state);
}
if (ch === '#') {
@@ -81,29 +81,26 @@
return words.hasOwnProperty(cur) ? words[cur] : null;
}
- function tokenString(quote, style) {
- var close = quote == "(" ? ")" : quote
+ function tokenString(quote) {
return function(stream, state) {
var next, end = false, escaped = false;
while ((next = stream.next()) != null) {
- if (next === close && !escaped) {
+ if (next === quote && !escaped) {
end = true;
break;
}
- if (next === '$' && !escaped && quote !== "'") {
+ if (next === '$' && !escaped && quote !== '\'') {
escaped = true;
stream.backUp(1);
state.tokens.unshift(tokenDollar);
break;
}
- if (!escaped && next === "(" && quote === "(") {
- state.tokens.unshift(tokenString(quote, style))
- return tokenize(stream, state)
- }
escaped = !escaped && next === '\\';
}
- if (end || !escaped) state.tokens.shift();
- return style;
+ if (end || !escaped) {
+ state.tokens.shift();
+ }
+ return (quote === '`' || quote === ')' ? 'quote' : 'string');
};
};
@@ -111,8 +108,8 @@
if (state.tokens.length > 1) stream.eat('$');
var ch = stream.next(), hungry = /\w/;
if (ch === '{') hungry = /[^}]/;
- if (/['"(]/.test(ch)) {
- state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : "string");
+ if (ch === '(') {
+ state.tokens[0] = tokenString(')');
return tokenize(stream, state);
}
if (!/\d/.test(ch)) {
@@ -132,7 +129,6 @@
token: function(stream, state) {
return tokenize(stream, state);
},
- closeBrackets: "()[]{}''\"\"``",
lineComment: '#',
fold: "brace"
};

Powered by Google App Engine
This is Rietveld 408576698