mirror of
https://github.com/documize/community.git
synced 2025-08-04 13:05:23 +02:00
CodeMirror dependency upgraded to v5.32.0
For handling Markdown and Code section types
This commit is contained in:
parent
3337db6b27
commit
0336f84a83
351 changed files with 3408 additions and 1945 deletions
30
gui/public/codemirror/mode/clike/clike.js
vendored
Executable file → Normal file
30
gui/public/codemirror/mode/clike/clike.js
vendored
Executable file → Normal file
|
@ -33,7 +33,7 @@ function popContext(state) {
|
|||
}
|
||||
|
||||
function typeBefore(stream, state, pos) {
|
||||
if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
|
||||
if (state.prevToken == "variable" || state.prevToken == "type") return true;
|
||||
if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
|
||||
if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
|
||||
numberStart = parserConfig.numberStart || /[\d\.]/,
|
||||
number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
|
||||
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/;
|
||||
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
|
||||
isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/;
|
||||
|
||||
var curPunc, isDefKeyword;
|
||||
|
||||
|
@ -101,9 +102,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
stream.eatWhile(isIdentifierChar);
|
||||
if (namespaceSeparator) while (stream.match(namespaceSeparator))
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
stream.eatWhile(isIdentifierChar);
|
||||
|
||||
var cur = stream.current();
|
||||
if (contains(keywords, cur)) {
|
||||
|
@ -111,7 +112,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
if (contains(defKeywords, cur)) isDefKeyword = true;
|
||||
return "keyword";
|
||||
}
|
||||
if (contains(types, cur)) return "variable-3";
|
||||
if (contains(types, cur)) return "type";
|
||||
if (contains(builtin, cur)) {
|
||||
if (contains(blockKeywords, cur)) curPunc = "newstatement";
|
||||
return "builtin";
|
||||
|
@ -243,6 +244,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
blockCommentContinue: " * ",
|
||||
lineComment: "//",
|
||||
fold: "brace"
|
||||
};
|
||||
|
@ -280,7 +282,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
}
|
||||
|
||||
function pointerHook(_stream, state) {
|
||||
if (state.prevToken == "variable-3") return "variable-3";
|
||||
if (state.prevToken == "type") return "type";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -314,7 +316,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
}
|
||||
|
||||
function cppLooksLikeConstructor(word) {
|
||||
var lastTwo = /(\w+)::(\w+)$/.exec(word);
|
||||
var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
|
||||
return lastTwo && lastTwo[1] == lastTwo[2];
|
||||
}
|
||||
|
||||
|
@ -390,6 +392,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
dontIndentStatements: /^template$/,
|
||||
isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
|
||||
hooks: {
|
||||
"#": cppHook,
|
||||
"*": pointerHook,
|
||||
|
@ -429,7 +432,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
|
||||
"Integer Long Number Object Short String StringBuffer StringBuilder Void"),
|
||||
blockKeywords: words("catch class do else finally for if switch try while"),
|
||||
defKeywords: words("class interface package enum @interface"),
|
||||
defKeywords: words("class interface enum @interface"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
||||
|
@ -513,8 +516,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
||||
),
|
||||
multiLineStrings: true,
|
||||
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
||||
defKeywords: words("class def object package trait type val var"),
|
||||
blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
|
||||
defKeywords: words("class enum def object package trait type val var"),
|
||||
atoms: words("true false null"),
|
||||
indentStatements: false,
|
||||
indentSwitch: false,
|
||||
|
@ -575,7 +578,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
"file import where by get set abstract enum open inner override private public internal " +
|
||||
"protected catch finally out final vararg reified dynamic companion constructor init " +
|
||||
"sealed field property receiver param sparam lateinit data inline noinline tailrec " +
|
||||
"external annotation crossinline const operator infix"
|
||||
"external annotation crossinline const operator infix suspend"
|
||||
),
|
||||
types: words(
|
||||
/* package java.lang */
|
||||
|
@ -587,8 +590,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
intendSwitch: false,
|
||||
indentStatements: false,
|
||||
multiLineStrings: true,
|
||||
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
||||
blockKeywords: words("catch class do else finally for if where try while enum"),
|
||||
defKeywords: words("class val var object package interface fun"),
|
||||
defKeywords: words("class val var object interface fun"),
|
||||
atoms: words("true false null this"),
|
||||
hooks: {
|
||||
'"': function(stream, state) {
|
||||
|
@ -771,7 +775,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return "atom";
|
||||
},
|
||||
token: function(_stream, state, style) {
|
||||
if ((style == "variable" || style == "variable-3") &&
|
||||
if ((style == "variable" || style == "type") &&
|
||||
state.prevToken == ".") {
|
||||
return "variable-2";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue