| 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');
|
| +
|
| +});
|
|
|