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

Unified Diff: Source/devtools/front_end/cm/shell.js

Issue 354833004: DevTools: [CodeMirror] roll CodeMirror to version @e20d175 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 6 years, 6 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
« no previous file with comments | « Source/devtools/front_end/cm/python.js ('k') | Source/devtools/front_end/cm/xml.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/cm/shell.js
diff --git a/Source/devtools/front_end/cm/shell.js b/Source/devtools/front_end/cm/shell.js
index abfd2144546988225e741a5a91fc692c5a2bdd2f..77be75b97d21860843b5aa0522061ccbe74f8a1e 100644
--- a/Source/devtools/front_end/cm/shell.js
+++ b/Source/devtools/front_end/cm/shell.js
@@ -1,3 +1,16 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
CodeMirror.defineMode('shell', function() {
var words = {};
@@ -23,10 +36,15 @@ CodeMirror.defineMode('shell', function() {
'touch vi vim wall wc wget who write yes zsh');
function tokenBase(stream, state) {
+ if (stream.eatSpace()) return null;
var sol = stream.sol();
var ch = stream.next();
+ if (ch === '\\') {
+ stream.next();
+ return null;
+ }
if (ch === '\'' || ch === '"' || ch === '`') {
state.tokens.unshift(tokenString(ch));
return tokenize(stream, state);
@@ -53,7 +71,7 @@ CodeMirror.defineMode('shell', function() {
}
if (/\d/.test(ch)) {
stream.eatWhile(/\d/);
- if(!/\w/.test(stream.peek())) {
+ if(stream.eol() || !/\w/.test(stream.peek())) {
return 'number';
}
}
@@ -109,10 +127,11 @@ CodeMirror.defineMode('shell', function() {
return {
startState: function() {return {tokens:[]};},
token: function(stream, state) {
- if (stream.eatSpace()) return null;
return tokenize(stream, state);
}
};
});
CodeMirror.defineMIME('text/x-sh', 'shell');
+
+});
« no previous file with comments | « Source/devtools/front_end/cm/python.js ('k') | Source/devtools/front_end/cm/xml.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698