| 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 a684e8c233ad293ee677cb53d13bd53c9acba7ca..76c67cd2b7d3a2a18cd0d196fadcbf3069fae4b9 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 @@ CodeMirror.defineMode('shell', function() {
|
| return null;
|
| }
|
| if (ch === '\'' || ch === '"' || ch === '`') {
|
| - state.tokens.unshift(tokenString(ch));
|
| + state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
|
| return tokenize(stream, state);
|
| }
|
| if (ch === '#') {
|
| @@ -81,26 +81,29 @@ CodeMirror.defineMode('shell', function() {
|
| return words.hasOwnProperty(cur) ? words[cur] : null;
|
| }
|
|
|
| - function tokenString(quote) {
|
| + function tokenString(quote, style) {
|
| + var close = quote == "(" ? ")" : quote
|
| return function(stream, state) {
|
| var next, end = false, escaped = false;
|
| while ((next = stream.next()) != null) {
|
| - if (next === quote && !escaped) {
|
| + if (next === close && !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 (quote === '`' || quote === ')' ? 'quote' : 'string');
|
| + if (end || !escaped) state.tokens.shift();
|
| + return style;
|
| };
|
| };
|
|
|
| @@ -108,8 +111,8 @@ CodeMirror.defineMode('shell', function() {
|
| if (state.tokens.length > 1) stream.eat('$');
|
| var ch = stream.next(), hungry = /\w/;
|
| if (ch === '{') hungry = /[^}]/;
|
| - if (ch === '(') {
|
| - state.tokens[0] = tokenString(')');
|
| + if (/['"(]/.test(ch)) {
|
| + state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : "string");
|
| return tokenize(stream, state);
|
| }
|
| if (!/\d/.test(ch)) {
|
| @@ -129,6 +132,7 @@ CodeMirror.defineMode('shell', function() {
|
| token: function(stream, state) {
|
| return tokenize(stream, state);
|
| },
|
| + closeBrackets: "()[]{}''\"\"``",
|
| lineComment: '#',
|
| fold: "brace"
|
| };
|
|
|