shell.js (CodeMirror-5.58.2) | : | shell.js (CodeMirror-5.58.3) | ||
---|---|---|---|---|
skipping to change at line 73 | skipping to change at line 73 | |||
return tokenize(stream, state); | return tokenize(stream, state); | |||
} | } | |||
if (ch === '+' || ch === '=') { | if (ch === '+' || ch === '=') { | |||
return 'operator'; | return 'operator'; | |||
} | } | |||
if (ch === '-') { | if (ch === '-') { | |||
stream.eat('-'); | stream.eat('-'); | |||
stream.eatWhile(/\w/); | stream.eatWhile(/\w/); | |||
return 'attribute'; | return 'attribute'; | |||
} | } | |||
if (ch == "<") { | ||||
var heredoc = stream.match(/^<-?\s+(.*)/) | ||||
if (heredoc) { | ||||
state.tokens.unshift(tokenHeredoc(heredoc[1])) | ||||
return 'string-2' | ||||
} | ||||
} | ||||
if (/\d/.test(ch)) { | if (/\d/.test(ch)) { | |||
stream.eatWhile(/\d/); | stream.eatWhile(/\d/); | |||
if(stream.eol() || !/\w/.test(stream.peek())) { | if(stream.eol() || !/\w/.test(stream.peek())) { | |||
return 'number'; | return 'number'; | |||
} | } | |||
} | } | |||
stream.eatWhile(/[\w-]/); | stream.eatWhile(/[\w-]/); | |||
var cur = stream.current(); | var cur = stream.current(); | |||
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; | if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; | |||
return words.hasOwnProperty(cur) ? words[cur] : null; | return words.hasOwnProperty(cur) ? words[cur] : null; | |||
skipping to change at line 132 | skipping to change at line 139 | |||
var ch = stream.next() | var ch = stream.next() | |||
if (/['"({]/.test(ch)) { | if (/['"({]/.test(ch)) { | |||
state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string"); | state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string"); | |||
return tokenize(stream, state); | return tokenize(stream, state); | |||
} | } | |||
if (!/\d/.test(ch)) stream.eatWhile(/\w/); | if (!/\d/.test(ch)) stream.eatWhile(/\w/); | |||
state.tokens.shift(); | state.tokens.shift(); | |||
return 'def'; | return 'def'; | |||
}; | }; | |||
function tokenHeredoc(delim) { | ||||
return function(stream, state) { | ||||
if (stream.sol() && stream.string == delim) state.tokens.shift() | ||||
stream.skipToEnd() | ||||
return "string-2" | ||||
} | ||||
} | ||||
function tokenize(stream, state) { | function tokenize(stream, state) { | |||
return (state.tokens[0] || tokenBase) (stream, state); | return (state.tokens[0] || tokenBase) (stream, state); | |||
}; | }; | |||
return { | return { | |||
startState: function() {return {tokens:[]};}, | startState: function() {return {tokens:[]};}, | |||
token: function(stream, state) { | token: function(stream, state) { | |||
return tokenize(stream, state); | return tokenize(stream, state); | |||
}, | }, | |||
closeBrackets: "()[]{}''\"\"``", | closeBrackets: "()[]{}''\"\"``", | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 15 lines changed or added |