update codemirror plugin files

This commit is contained in:
REJack
2020-11-25 09:00:43 +01:00
parent 4bbf746378
commit a2df402653
18 changed files with 148 additions and 72 deletions

View File

@@ -70,6 +70,13 @@ CodeMirror.defineMode('shell', function() {
stream.eatWhile(/\w/);
return 'attribute';
}
if (ch == "<") {
var heredoc = stream.match(/^<-?\s+(.*)/)
if (heredoc) {
state.tokens.unshift(tokenHeredoc(heredoc[1]))
return 'string-2'
}
}
if (/\d/.test(ch)) {
stream.eatWhile(/\d/);
if(stream.eol() || !/\w/.test(stream.peek())) {
@@ -129,6 +136,14 @@ CodeMirror.defineMode('shell', function() {
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) {
return (state.tokens[0] || tokenBase) (stream, state);
};