mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 00:36:33 +01:00
codemirror updated to 5.47.0
This commit is contained in:
24
libraries/codemirror/mode/scheme/scheme.js
vendored
24
libraries/codemirror/mode/scheme/scheme.js
vendored
@@ -73,7 +73,8 @@ CodeMirror.defineMode("scheme", function () {
|
||||
indentStack: null,
|
||||
indentation: 0,
|
||||
mode: false,
|
||||
sExprComment: false
|
||||
sExprComment: false,
|
||||
sExprQuote: false
|
||||
};
|
||||
},
|
||||
|
||||
@@ -121,7 +122,7 @@ CodeMirror.defineMode("scheme", function () {
|
||||
state.sExprComment = 0;
|
||||
}else{
|
||||
// if not we just comment the entire of the next token
|
||||
stream.eatWhile(/[^/s]/); // eat non spaces
|
||||
stream.eatWhile(/[^\s\(\)\[\]]/); // eat symbol atom
|
||||
returnType = COMMENT;
|
||||
break;
|
||||
}
|
||||
@@ -133,7 +134,15 @@ CodeMirror.defineMode("scheme", function () {
|
||||
returnType = STRING;
|
||||
|
||||
} else if (ch == "'") {
|
||||
returnType = ATOM;
|
||||
if (stream.peek() == "(" || stream.peek() == "["){
|
||||
if (typeof state.sExprQuote != "number") {
|
||||
state.sExprQuote = 0;
|
||||
} // else already in a quoted expression
|
||||
returnType = ATOM;
|
||||
} else {
|
||||
stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
|
||||
returnType = ATOM;
|
||||
}
|
||||
} else if (ch == '#') {
|
||||
if (stream.eat("|")) { // Multi-line comment
|
||||
state.mode = "comment"; // toggle to comment mode
|
||||
@@ -209,6 +218,7 @@ CodeMirror.defineMode("scheme", function () {
|
||||
stream.backUp(stream.current().length - 1); // undo all the eating
|
||||
|
||||
if(typeof state.sExprComment == "number") state.sExprComment++;
|
||||
if(typeof state.sExprQuote == "number") state.sExprQuote++;
|
||||
|
||||
returnType = BRACKET;
|
||||
} else if (ch == ")" || ch == "]") {
|
||||
@@ -222,6 +232,12 @@ CodeMirror.defineMode("scheme", function () {
|
||||
state.sExprComment = false; // turn off s-expr commenting mode
|
||||
}
|
||||
}
|
||||
if(typeof state.sExprQuote == "number"){
|
||||
if(--state.sExprQuote == 0){
|
||||
returnType = ATOM; // final closing bracket
|
||||
state.sExprQuote = false; // turn off s-expr quote mode
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
|
||||
@@ -231,7 +247,7 @@ CodeMirror.defineMode("scheme", function () {
|
||||
} else returnType = "variable";
|
||||
}
|
||||
}
|
||||
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
|
||||
return (typeof state.sExprComment == "number") ? COMMENT : ((typeof state.sExprQuote == "number") ? ATOM : returnType);
|
||||
},
|
||||
|
||||
indent: function (state) {
|
||||
|
||||
Reference in New Issue
Block a user