mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
upgrade code mirror to 5.65.15 and fix modes requiring multiplex or overlay, fixes #4279
This commit is contained in:
10
libraries/codemirror/mode/clike/clike.js
vendored
10
libraries/codemirror/mode/clike/clike.js
vendored
@@ -218,7 +218,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
|
||||
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
|
||||
return CodeMirror.Pass;
|
||||
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
||||
var closing = firstChar == ctx.type;
|
||||
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
||||
@@ -512,8 +513,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
name: "clike",
|
||||
keywords: words("abstract as async await base break case catch checked class const continue" +
|
||||
" default delegate do else enum event explicit extern finally fixed for" +
|
||||
" foreach goto if implicit in interface internal is lock namespace new" +
|
||||
" operator out override params private protected public readonly ref return sealed" +
|
||||
" foreach goto if implicit in init interface internal is lock namespace new" +
|
||||
" operator out override params private protected public readonly record ref required return sealed" +
|
||||
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
||||
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
||||
" global group into join let orderby partial remove select set value var yield"),
|
||||
@@ -522,7 +523,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
" UInt64 bool byte char decimal double short int long object" +
|
||||
" sbyte float string ushort uint ulong"),
|
||||
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
||||
defKeywords: words("class interface namespace struct var"),
|
||||
defKeywords: words("class interface namespace record struct var"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
@@ -613,6 +614,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
return state.tokenize(stream, state);
|
||||
},
|
||||
"'": function(stream) {
|
||||
if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "string-2"
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
return "atom";
|
||||
},
|
||||
|
||||
8
libraries/codemirror/mode/dart/dart.js
vendored
8
libraries/codemirror/mode/dart/dart.js
vendored
@@ -12,10 +12,10 @@
|
||||
"use strict";
|
||||
|
||||
var keywords = ("this super static final const abstract class extends external factory " +
|
||||
"implements mixin get native set typedef with enum throw rethrow " +
|
||||
"assert break case continue default in return new deferred async await covariant " +
|
||||
"try catch finally do else for if switch while import library export " +
|
||||
"part of show hide is as extension on yield late required").split(" ");
|
||||
"implements mixin get native set typedef with enum throw rethrow assert break case " +
|
||||
"continue default in return new deferred async await covariant try catch finally " +
|
||||
"do else for if switch while import library export part of show hide is as extension " +
|
||||
"on yield late required sealed base interface when inline").split(" ");
|
||||
var blockKeywords = "try catch finally do else for if switch while".split(" ");
|
||||
var atoms = "true false null".split(" ");
|
||||
var builtins = "void bool num int double dynamic var String Null Never".split(" ");
|
||||
|
||||
@@ -779,7 +779,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
if (type == "async" ||
|
||||
(type == "variable" &&
|
||||
(value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
|
||||
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
|
||||
cx.stream.match(/^\s+#?[\w$\xa1-\uffff]/, false))) {
|
||||
cx.marked = "keyword";
|
||||
return cont(classBody);
|
||||
}
|
||||
|
||||
2
libraries/codemirror/mode/nsis/nsis.js
vendored
2
libraries/codemirror/mode/nsis/nsis.js
vendored
@@ -24,7 +24,7 @@ CodeMirror.defineSimpleMode("nsis",{
|
||||
{ regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
|
||||
|
||||
// Compile Time Commands
|
||||
{regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"},
|
||||
{regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|assert|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"},
|
||||
|
||||
// Conditional Compilation
|
||||
{regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true},
|
||||
|
||||
3
libraries/codemirror/mode/pegjs/pegjs.js
vendored
3
libraries/codemirror/mode/pegjs/pegjs.js
vendored
@@ -31,8 +31,6 @@ CodeMirror.defineMode("pegjs", function (config) {
|
||||
};
|
||||
},
|
||||
token: function (stream, state) {
|
||||
if (stream)
|
||||
|
||||
//check for state changes
|
||||
if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) {
|
||||
state.stringType = stream.peek();
|
||||
@@ -43,7 +41,6 @@ CodeMirror.defineMode("pegjs", function (config) {
|
||||
state.inComment = true;
|
||||
}
|
||||
|
||||
//return state
|
||||
if (state.inString) {
|
||||
while (state.inString && !stream.eol()) {
|
||||
if (stream.peek() === state.stringType) {
|
||||
|
||||
6
libraries/codemirror/mode/python/python.js
vendored
6
libraries/codemirror/mode/python/python.js
vendored
@@ -20,7 +20,7 @@
|
||||
"def", "del", "elif", "else", "except", "finally",
|
||||
"for", "from", "global", "if", "import",
|
||||
"lambda", "pass", "raise", "return",
|
||||
"try", "while", "with", "yield", "in"];
|
||||
"try", "while", "with", "yield", "in", "False", "True"];
|
||||
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
|
||||
"classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
|
||||
"enumerate", "eval", "filter", "float", "format", "frozenset",
|
||||
@@ -60,7 +60,7 @@
|
||||
if (py3) {
|
||||
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
||||
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
||||
myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
|
||||
myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
|
||||
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
|
||||
var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i");
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@
|
||||
myKeywords = myKeywords.concat(["exec", "print"]);
|
||||
myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
|
||||
"file", "intern", "long", "raw_input", "reduce", "reload",
|
||||
"unichr", "unicode", "xrange", "False", "True", "None"]);
|
||||
"unichr", "unicode", "xrange", "None"]);
|
||||
var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
||||
}
|
||||
var keywords = wordRegexp(myKeywords);
|
||||
|
||||
23
libraries/codemirror/mode/sparql/sparql.js
vendored
23
libraries/codemirror/mode/sparql/sparql.js
vendored
@@ -33,6 +33,9 @@ CodeMirror.defineMode("sparql", function(config) {
|
||||
"true", "false", "with",
|
||||
"data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]);
|
||||
var operatorChars = /[*+\-<>=&|\^\/!\?]/;
|
||||
var PN_CHARS = "[A-Za-z_\\-0-9]";
|
||||
var PREFIX_START = new RegExp("[A-Za-z]");
|
||||
var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
@@ -71,20 +74,18 @@ CodeMirror.defineMode("sparql", function(config) {
|
||||
stream.eatWhile(/[a-z\d\-]/i);
|
||||
return "meta";
|
||||
}
|
||||
else {
|
||||
stream.eatWhile(/[_\w\d]/);
|
||||
if (stream.eat(":")) {
|
||||
else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
|
||||
eatPnLocal(stream);
|
||||
return "atom";
|
||||
}
|
||||
var word = stream.current();
|
||||
if (ops.test(word))
|
||||
return "builtin";
|
||||
else if (keywords.test(word))
|
||||
return "keyword";
|
||||
else
|
||||
return "variable";
|
||||
}
|
||||
stream.eatWhile(/[_\w\d]/);
|
||||
var word = stream.current();
|
||||
if (ops.test(word))
|
||||
return "builtin";
|
||||
else if (keywords.test(word))
|
||||
return "keyword";
|
||||
else
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function eatPnLocal(stream) {
|
||||
|
||||
26
libraries/codemirror/mode/sql/sql.js
vendored
26
libraries/codemirror/mode/sql/sql.js
vendored
File diff suppressed because one or more lines are too long
2
libraries/codemirror/mode/yaml/yaml.js
vendored
2
libraries/codemirror/mode/yaml/yaml.js
vendored
@@ -85,7 +85,7 @@ CodeMirror.defineMode("yaml", function() {
|
||||
}
|
||||
|
||||
/* pairs (associative arrays) -> key */
|
||||
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) {
|
||||
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^\s,\[\]{}#&*!|>'"%@`])[^#:]*(?=:($|\s))/)) {
|
||||
state.pair = true;
|
||||
state.keyCol = stream.indentation();
|
||||
return "atom";
|
||||
|
||||
Reference in New Issue
Block a user