mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
CodeMirror upgrade to 5.38.0
This commit is contained in:
parent
36be6243ad
commit
cfe30dcde5
52 changed files with 905 additions and 413 deletions
47
gui/public/codemirror/mode/clike/clike.js
vendored
47
gui/public/codemirror/mode/clike/clike.js
vendored
|
@ -374,7 +374,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
blockKeywords: words("case do else for if switch while struct"),
|
||||
defKeywords: words("struct"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("null true false"),
|
||||
atoms: words("NULL true false"),
|
||||
hooks: {"#": cppHook, "*": pointerHook},
|
||||
modeProps: {fold: ["brace", "include"]}
|
||||
});
|
||||
|
@ -390,7 +390,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
||||
defKeywords: words("class namespace struct enum union"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
atoms: words("true false NULL"),
|
||||
dontIndentStatements: /^template$/,
|
||||
isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
|
||||
hooks: {
|
||||
|
@ -489,6 +489,27 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return "string";
|
||||
}
|
||||
|
||||
function tokenNestedComment(depth) {
|
||||
return function (stream, state) {
|
||||
var ch
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "*" && stream.eat("/")) {
|
||||
if (depth == 1) {
|
||||
state.tokenize = null
|
||||
break
|
||||
} else {
|
||||
state.tokenize = tokenNestedComment(depth - 1)
|
||||
return state.tokenize(stream, state)
|
||||
}
|
||||
} else if (ch == "/" && stream.eat("*")) {
|
||||
state.tokenize = tokenNestedComment(depth + 1)
|
||||
return state.tokenize(stream, state)
|
||||
}
|
||||
}
|
||||
return "comment"
|
||||
}
|
||||
}
|
||||
|
||||
def("text/x-scala", {
|
||||
name: "clike",
|
||||
keywords: words(
|
||||
|
@ -544,6 +565,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
"/": function(stream, state) {
|
||||
if (!stream.eat("*")) return false
|
||||
state.tokenize = tokenNestedComment(1)
|
||||
return state.tokenize(stream, state)
|
||||
}
|
||||
},
|
||||
modeProps: {closeBrackets: {triples: '"'}}
|
||||
|
@ -570,31 +597,37 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
name: "clike",
|
||||
keywords: words(
|
||||
/*keywords*/
|
||||
"package as typealias class interface this super val " +
|
||||
"var fun for is in This throw return " +
|
||||
"package as typealias class interface this super val operator " +
|
||||
"var fun for is in This throw return annotation " +
|
||||
"break continue object if else while do try when !in !is as? " +
|
||||
|
||||
/*soft keywords*/
|
||||
"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 suspend"
|
||||
"external annotation crossinline const operator infix suspend actual expect setparam"
|
||||
),
|
||||
types: words(
|
||||
/* package java.lang */
|
||||
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
||||
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
|
||||
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
||||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
||||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray " +
|
||||
"ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy " +
|
||||
"LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
|
||||
),
|
||||
intendSwitch: false,
|
||||
indentStatements: false,
|
||||
multiLineStrings: true,
|
||||
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
||||
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 interface fun"),
|
||||
atoms: words("true false null this"),
|
||||
hooks: {
|
||||
"@": function(stream) {
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
return "meta";
|
||||
},
|
||||
'"': function(stream, state) {
|
||||
state.tokenize = tokenKotlinString(stream.match('""'));
|
||||
return state.tokenize(stream, state);
|
||||
|
|
10
gui/public/codemirror/mode/clike/test.js
vendored
10
gui/public/codemirror/mode/clike/test.js
vendored
|
@ -56,4 +56,14 @@
|
|||
MTCPP("ctor_dtor",
|
||||
"[def Foo::Foo]() {}",
|
||||
"[def Foo::~Foo]() {}");
|
||||
|
||||
var mode_scala = CodeMirror.getMode({indentUnit: 2}, "text/x-scala");
|
||||
function MTSCALA(name) { test.mode("scala_" + name, mode_scala, Array.prototype.slice.call(arguments, 1)); }
|
||||
MTSCALA("nested_comments",
|
||||
"[comment /*]",
|
||||
"[comment But wait /* this is a nested comment */ for real]",
|
||||
"[comment /**** let * me * show * you ****/]",
|
||||
"[comment ///// let / me / show / you /////]",
|
||||
"[comment */]");
|
||||
|
||||
})();
|
||||
|
|
18
gui/public/codemirror/mode/css/css.js
vendored
18
gui/public/codemirror/mode/css/css.js
vendored
|
@ -77,9 +77,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
return ret("qualifier", "qualifier");
|
||||
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
||||
return ret(null, ch);
|
||||
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
||||
(ch == "d" && stream.match("omain(")) ||
|
||||
(ch == "r" && stream.match("egexp("))) {
|
||||
} else if (((ch == "u" || ch == "U") && stream.match(/rl(-prefix)?\(/i)) ||
|
||||
((ch == "d" || ch == "D") && stream.match("omain(", true, true)) ||
|
||||
((ch == "r" || ch == "R") && stream.match("egexp(", true, true))) {
|
||||
stream.backUp(1);
|
||||
state.tokenize = tokenParenthesized;
|
||||
return ret("property", "word");
|
||||
|
@ -162,16 +162,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
return pushContext(state, stream, "block");
|
||||
} else if (type == "}" && state.context.prev) {
|
||||
return popContext(state);
|
||||
} else if (supportsAtComponent && /@component/.test(type)) {
|
||||
} else if (supportsAtComponent && /@component/i.test(type)) {
|
||||
return pushContext(state, stream, "atComponentBlock");
|
||||
} else if (/^@(-moz-)?document$/.test(type)) {
|
||||
} else if (/^@(-moz-)?document$/i.test(type)) {
|
||||
return pushContext(state, stream, "documentTypes");
|
||||
} else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
|
||||
} else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
|
||||
return pushContext(state, stream, "atBlock");
|
||||
} else if (/^@(font-face|counter-style)/.test(type)) {
|
||||
} else if (/^@(font-face|counter-style)/i.test(type)) {
|
||||
state.stateArg = type;
|
||||
return "restricted_atBlock_before";
|
||||
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
||||
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
|
||||
return "keyframes";
|
||||
} else if (type && type.charAt(0) == "@") {
|
||||
return pushContext(state, stream, "at");
|
||||
|
@ -793,7 +793,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
},
|
||||
"@": function(stream) {
|
||||
if (stream.eat("{")) return [null, "interpolation"];
|
||||
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
||||
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
if (stream.match(/^\s*:/, false))
|
||||
return ["variable-2", "variable-definition"];
|
||||
|
|
3
gui/public/codemirror/mode/css/test.js
vendored
3
gui/public/codemirror/mode/css/test.js
vendored
|
@ -24,6 +24,9 @@
|
|||
MT("atMediaUnknownFeatureValueKeyword",
|
||||
"[def @media] ([property orientation]: [error upsidedown]) { }");
|
||||
|
||||
MT("atMediaUppercase",
|
||||
"[def @MEDIA] ([property orienTAtion]: [keyword landScape]) { }");
|
||||
|
||||
MT("tagSelector",
|
||||
"[tag foo] { }");
|
||||
|
||||
|
|
13
gui/public/codemirror/mode/haskell/haskell.js
vendored
13
gui/public/codemirror/mode/haskell/haskell.js
vendored
|
@ -197,13 +197,14 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
|
|||
"\.\.", ":", "::", "=", "\\", "<-", "->", "@", "~", "=>");
|
||||
|
||||
setType("builtin")(
|
||||
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
|
||||
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
|
||||
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<*", "<=",
|
||||
"<$>", "<*>", "=<<", "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*",
|
||||
"*>", "**");
|
||||
|
||||
setType("builtin")(
|
||||
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
|
||||
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
|
||||
"IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
|
||||
"Applicative", "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum",
|
||||
"Eq", "False", "FilePath", "Float", "Floating", "Fractional", "Functor",
|
||||
"GT", "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
|
||||
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
|
||||
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
|
||||
"String", "True");
|
||||
|
@ -223,7 +224,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
|
|||
"lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
|
||||
"mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
|
||||
"minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
|
||||
"otherwise", "pi", "pred", "print", "product", "properFraction",
|
||||
"otherwise", "pi", "pred", "print", "product", "properFraction", "pure",
|
||||
"putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
|
||||
"readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
|
||||
"realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
|
||||
|
|
|
@ -14,7 +14,16 @@
|
|||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
||||
var closeComment = parserConfig.closeComment || "--%>"
|
||||
return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
|
||||
open: parserConfig.openComment || "<%--",
|
||||
close: closeComment,
|
||||
delimStyle: "comment",
|
||||
mode: {token: function(stream) {
|
||||
stream.skipTo(closeComment) || stream.skipToEnd()
|
||||
return "comment"
|
||||
}}
|
||||
}, {
|
||||
open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
|
||||
close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
|
||||
mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
|
||||
|
|
2
gui/public/codemirror/mode/index.html
vendored
2
gui/public/codemirror/mode/index.html
vendored
|
@ -80,7 +80,7 @@ option.</p>
|
|||
<li><a href="javascript/index.html">JavaScript</a> (<a href="jsx/index.html">JSX</a>)</li>
|
||||
<li><a href="jinja2/index.html">Jinja2</a></li>
|
||||
<li><a href="julia/index.html">Julia</a></li>
|
||||
<li><a href="kotlin/index.html">Kotlin</a></li>
|
||||
<li><a href="clike/index.html">Kotlin</a></li>
|
||||
<li><a href="css/less.html">LESS</a></li>
|
||||
<li><a href="livescript/index.html">LiveScript</a></li>
|
||||
<li><a href="lua/index.html">Lua</a></li>
|
||||
|
|
217
gui/public/codemirror/mode/javascript/javascript.js
vendored
217
gui/public/codemirror/mode/javascript/javascript.js
vendored
|
@ -26,7 +26,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
|
||||
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
||||
|
||||
var jsKeywords = {
|
||||
return {
|
||||
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
||||
"return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
|
||||
"debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
|
||||
|
@ -38,33 +38,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
||||
"await": C
|
||||
};
|
||||
|
||||
// Extend the 'normal' keywords with the TypeScript language extensions
|
||||
if (isTS) {
|
||||
var type = {type: "variable", style: "type"};
|
||||
var tsKeywords = {
|
||||
// object-like things
|
||||
"interface": kw("class"),
|
||||
"implements": C,
|
||||
"namespace": C,
|
||||
|
||||
// scope modifiers
|
||||
"public": kw("modifier"),
|
||||
"private": kw("modifier"),
|
||||
"protected": kw("modifier"),
|
||||
"abstract": kw("modifier"),
|
||||
"readonly": kw("modifier"),
|
||||
|
||||
// types
|
||||
"string": type, "number": type, "boolean": type, "any": type
|
||||
};
|
||||
|
||||
for (var attr in tsKeywords) {
|
||||
jsKeywords[attr] = tsKeywords[attr];
|
||||
}
|
||||
}
|
||||
|
||||
return jsKeywords;
|
||||
}();
|
||||
|
||||
var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
|
||||
|
@ -102,17 +75,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return ret(ch);
|
||||
} else if (ch == "=" && stream.eat(">")) {
|
||||
return ret("=>", "operator");
|
||||
} else if (ch == "0" && stream.eat(/x/i)) {
|
||||
stream.eatWhile(/[\da-f]/i);
|
||||
return ret("number", "number");
|
||||
} else if (ch == "0" && stream.eat(/o/i)) {
|
||||
stream.eatWhile(/[0-7]/i);
|
||||
return ret("number", "number");
|
||||
} else if (ch == "0" && stream.eat(/b/i)) {
|
||||
stream.eatWhile(/[01]/i);
|
||||
} else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) {
|
||||
return ret("number", "number");
|
||||
} else if (/\d/.test(ch)) {
|
||||
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
||||
stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/);
|
||||
return ret("number", "number");
|
||||
} else if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
|
@ -123,7 +89,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return ret("comment", "comment");
|
||||
} else if (expressionAllowed(stream, state, 1)) {
|
||||
readRegexp(stream);
|
||||
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
||||
stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
|
||||
return ret("regexp", "string-2");
|
||||
} else {
|
||||
stream.eat("=");
|
||||
|
@ -153,7 +119,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
var kw = keywords[word]
|
||||
return ret(kw.type, kw.style, word)
|
||||
}
|
||||
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\(\w]/, false))
|
||||
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
|
||||
return ret("async", "keyword", word)
|
||||
}
|
||||
return ret("variable", "variable", word)
|
||||
|
@ -292,35 +258,68 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
pass.apply(null, arguments);
|
||||
return true;
|
||||
}
|
||||
function inList(name, list) {
|
||||
for (var v = list; v; v = v.next) if (v.name == name) return true
|
||||
return false;
|
||||
}
|
||||
function register(varname) {
|
||||
function inList(list) {
|
||||
for (var v = list; v; v = v.next)
|
||||
if (v.name == varname) return true;
|
||||
return false;
|
||||
}
|
||||
var state = cx.state;
|
||||
cx.marked = "def";
|
||||
if (state.context) {
|
||||
if (inList(state.localVars)) return;
|
||||
state.localVars = {name: varname, next: state.localVars};
|
||||
} else {
|
||||
if (inList(state.globalVars)) return;
|
||||
if (parserConfig.globalVars)
|
||||
state.globalVars = {name: varname, next: state.globalVars};
|
||||
if (state.lexical.info == "var" && state.context && state.context.block) {
|
||||
// FIXME function decls are also not block scoped
|
||||
var newContext = registerVarScoped(varname, state.context)
|
||||
if (newContext != null) {
|
||||
state.context = newContext
|
||||
return
|
||||
}
|
||||
} else if (!inList(varname, state.localVars)) {
|
||||
state.localVars = new Var(varname, state.localVars)
|
||||
return
|
||||
}
|
||||
}
|
||||
// Fall through means this is global
|
||||
if (parserConfig.globalVars && !inList(varname, state.globalVars))
|
||||
state.globalVars = new Var(varname, state.globalVars)
|
||||
}
|
||||
function registerVarScoped(varname, context) {
|
||||
if (!context) {
|
||||
return null
|
||||
} else if (context.block) {
|
||||
var inner = registerVarScoped(varname, context.prev)
|
||||
if (!inner) return null
|
||||
if (inner == context.prev) return context
|
||||
return new Context(inner, context.vars, true)
|
||||
} else if (inList(varname, context.vars)) {
|
||||
return context
|
||||
} else {
|
||||
return new Context(context.prev, new Var(varname, context.vars), false)
|
||||
}
|
||||
}
|
||||
|
||||
function isModifier(name) {
|
||||
return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
|
||||
}
|
||||
|
||||
// Combinators
|
||||
|
||||
var defaultVars = {name: "this", next: {name: "arguments"}};
|
||||
function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
|
||||
function Var(name, next) { this.name = name; this.next = next }
|
||||
|
||||
var defaultVars = new Var("this", new Var("arguments", null))
|
||||
function pushcontext() {
|
||||
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
||||
cx.state.localVars = defaultVars;
|
||||
cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
|
||||
cx.state.localVars = defaultVars
|
||||
}
|
||||
function pushblockcontext() {
|
||||
cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
|
||||
cx.state.localVars = null
|
||||
}
|
||||
function popcontext() {
|
||||
cx.state.localVars = cx.state.context.vars;
|
||||
cx.state.context = cx.state.context.prev;
|
||||
cx.state.localVars = cx.state.context.vars
|
||||
cx.state.context = cx.state.context.prev
|
||||
}
|
||||
popcontext.lex = true
|
||||
function pushlex(type, info) {
|
||||
var result = function() {
|
||||
var state = cx.state, indent = state.indented;
|
||||
|
@ -352,12 +351,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
|
||||
function statement(type, value) {
|
||||
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
||||
if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
|
||||
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
|
||||
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
||||
if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
|
||||
if (type == "debugger") return cont(expect(";"));
|
||||
if (type == "{") return cont(pushlex("}"), block, poplex);
|
||||
if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
|
||||
if (type == ";") return cont();
|
||||
if (type == "if") {
|
||||
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
||||
|
@ -366,44 +365,51 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
if (type == "function") return cont(functiondef);
|
||||
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
||||
if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), className, poplex); }
|
||||
if (type == "variable") {
|
||||
if (isTS && value == "type") {
|
||||
cx.marked = "keyword"
|
||||
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
||||
} else if (isTS && value == "declare") {
|
||||
if (isTS && value == "declare") {
|
||||
cx.marked = "keyword"
|
||||
return cont(statement)
|
||||
} else if (isTS && (value == "module" || value == "enum") && cx.stream.match(/^\s*\w/, false)) {
|
||||
} else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
|
||||
cx.marked = "keyword"
|
||||
return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
||||
if (value == "enum") return cont(enumdef);
|
||||
else if (value == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
||||
else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
||||
} else if (isTS && value == "namespace") {
|
||||
cx.marked = "keyword"
|
||||
return cont(pushlex("form"), expression, block, poplex)
|
||||
} else if (isTS && value == "abstract") {
|
||||
cx.marked = "keyword"
|
||||
return cont(statement)
|
||||
} else {
|
||||
return cont(pushlex("stat"), maybelabel);
|
||||
}
|
||||
}
|
||||
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"),
|
||||
block, poplex, poplex);
|
||||
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
|
||||
block, poplex, poplex, popcontext);
|
||||
if (type == "case") return cont(expression, expect(":"));
|
||||
if (type == "default") return cont(expect(":"));
|
||||
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
||||
statement, poplex, popcontext);
|
||||
if (type == "class") return cont(pushlex("form"), className, poplex);
|
||||
if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
|
||||
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
||||
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
||||
if (type == "async") return cont(statement)
|
||||
if (value == "@") return cont(expression, statement)
|
||||
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
||||
}
|
||||
function expression(type) {
|
||||
return expressionInner(type, false);
|
||||
function maybeCatchBinding(type) {
|
||||
if (type == "(") return cont(funarg, expect(")"))
|
||||
}
|
||||
function expressionNoComma(type) {
|
||||
return expressionInner(type, true);
|
||||
function expression(type, value) {
|
||||
return expressionInner(type, value, false);
|
||||
}
|
||||
function expressionNoComma(type, value) {
|
||||
return expressionInner(type, value, true);
|
||||
}
|
||||
function parenExpr(type) {
|
||||
if (type != "(") return pass()
|
||||
return cont(pushlex(")"), expression, expect(")"), poplex)
|
||||
}
|
||||
function expressionInner(type, noComma) {
|
||||
function expressionInner(type, value, noComma) {
|
||||
if (cx.state.fatArrowAt == cx.stream.start) {
|
||||
var body = noComma ? arrowBodyNoComma : arrowBody;
|
||||
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
|
||||
|
@ -413,7 +419,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
||||
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
||||
if (type == "function") return cont(functiondef, maybeop);
|
||||
if (type == "class") return cont(pushlex("form"), classExpression, poplex);
|
||||
if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
|
||||
if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
|
||||
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
||||
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
||||
|
@ -421,6 +427,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
||||
if (type == "quasi") return pass(quasi, maybeop);
|
||||
if (type == "new") return cont(maybeTarget(noComma));
|
||||
if (type == "import") return cont(expression);
|
||||
return cont();
|
||||
}
|
||||
function maybeexpression(type) {
|
||||
|
@ -511,10 +518,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return cont(afterprop);
|
||||
} else if (type == "jsonld-keyword") {
|
||||
return cont(afterprop);
|
||||
} else if (type == "modifier") {
|
||||
} else if (isTS && isModifier(value)) {
|
||||
cx.marked = "keyword"
|
||||
return cont(objprop)
|
||||
} else if (type == "[") {
|
||||
return cont(expression, expect("]"), afterprop);
|
||||
return cont(expression, maybetype, expect("]"), afterprop);
|
||||
} else if (type == "spread") {
|
||||
return cont(expressionNoComma, afterprop);
|
||||
} else if (value == "*") {
|
||||
|
@ -579,19 +587,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
}
|
||||
function typeexpr(type, value) {
|
||||
if (value == "keyof" || value == "typeof") {
|
||||
cx.marked = "keyword"
|
||||
return cont(value == "keyof" ? typeexpr : expressionNoComma)
|
||||
}
|
||||
if (type == "variable" || value == "void") {
|
||||
if (value == "keyof") {
|
||||
cx.marked = "keyword"
|
||||
return cont(typeexpr)
|
||||
} else {
|
||||
cx.marked = "type"
|
||||
return cont(afterType)
|
||||
}
|
||||
cx.marked = "type"
|
||||
return cont(afterType)
|
||||
}
|
||||
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
|
||||
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
|
||||
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
|
||||
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
|
||||
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
|
||||
}
|
||||
function maybeReturnType(type) {
|
||||
if (type == "=>") return cont(typeexpr)
|
||||
|
@ -608,15 +616,16 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return cont(expression, maybetype, expect("]"), typeprop)
|
||||
}
|
||||
}
|
||||
function typearg(type) {
|
||||
if (type == "variable") return cont(typearg)
|
||||
else if (type == ":") return cont(typeexpr)
|
||||
function typearg(type, value) {
|
||||
if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
|
||||
if (type == ":") return cont(typeexpr)
|
||||
return pass(typeexpr)
|
||||
}
|
||||
function afterType(type, value) {
|
||||
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
||||
if (value == "|" || type == ".") return cont(typeexpr)
|
||||
if (value == "|" || type == "." || value == "&") return cont(typeexpr)
|
||||
if (type == "[") return cont(expect("]"), afterType)
|
||||
if (value == "extends") return cont(typeexpr)
|
||||
if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
|
||||
}
|
||||
function maybeTypeArgs(_, value) {
|
||||
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
||||
|
@ -627,11 +636,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
function maybeTypeDefault(_, value) {
|
||||
if (value == "=") return cont(typeexpr)
|
||||
}
|
||||
function vardef() {
|
||||
function vardef(_, value) {
|
||||
if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
|
||||
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
||||
}
|
||||
function pattern(type, value) {
|
||||
if (type == "modifier") return cont(pattern)
|
||||
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
|
||||
if (type == "variable") { register(value); return cont(); }
|
||||
if (type == "spread") return cont(pattern);
|
||||
if (type == "[") return contCommasep(pattern, "]");
|
||||
|
@ -656,7 +666,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
function maybeelse(type, value) {
|
||||
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
||||
}
|
||||
function forspec(type) {
|
||||
function forspec(type, value) {
|
||||
if (value == "await") return cont(forspec);
|
||||
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
||||
}
|
||||
function forspec1(type) {
|
||||
|
@ -685,7 +696,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
function funarg(type, value) {
|
||||
if (value == "@") cont(expression, funarg)
|
||||
if (type == "spread" || type == "modifier") return cont(funarg);
|
||||
if (type == "spread") return cont(funarg);
|
||||
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
|
||||
return pass(pattern, maybetype, maybeAssign);
|
||||
}
|
||||
function classExpression(type, value) {
|
||||
|
@ -698,14 +710,16 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
function classNameAfter(type, value) {
|
||||
if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
|
||||
if (value == "extends" || value == "implements" || (isTS && type == ","))
|
||||
if (value == "extends" || value == "implements" || (isTS && type == ",")) {
|
||||
if (value == "implements") cx.marked = "keyword";
|
||||
return cont(isTS ? typeexpr : expression, classNameAfter);
|
||||
}
|
||||
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
||||
}
|
||||
function classBody(type, value) {
|
||||
if (type == "modifier" || type == "async" ||
|
||||
if (type == "async" ||
|
||||
(type == "variable" &&
|
||||
(value == "static" || value == "get" || value == "set") &&
|
||||
(value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
|
||||
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
|
||||
cx.marked = "keyword";
|
||||
return cont(classBody);
|
||||
|
@ -715,7 +729,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return cont(isTS ? classfield : functiondef, classBody);
|
||||
}
|
||||
if (type == "[")
|
||||
return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody)
|
||||
return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
|
||||
if (value == "*") {
|
||||
cx.marked = "keyword";
|
||||
return cont(classBody);
|
||||
|
@ -742,6 +756,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
function afterImport(type) {
|
||||
if (type == "string") return cont();
|
||||
if (type == "(") return pass(expression);
|
||||
return pass(importSpec, maybeMoreImports, maybeFrom);
|
||||
}
|
||||
function importSpec(type, value) {
|
||||
|
@ -763,6 +778,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
if (type == "]") return cont();
|
||||
return pass(commasep(expressionNoComma, "]"));
|
||||
}
|
||||
function enumdef() {
|
||||
return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
|
||||
}
|
||||
function enummember() {
|
||||
return pass(pattern, maybeAssign);
|
||||
}
|
||||
|
||||
function isContinuedStatement(state, textAfter) {
|
||||
return state.lastType == "operator" || state.lastType == "," ||
|
||||
|
@ -786,7 +807,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
cc: [],
|
||||
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
||||
localVars: parserConfig.localVars,
|
||||
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
||||
context: parserConfig.localVars && new Context(null, null, false),
|
||||
indented: basecolumn || 0
|
||||
};
|
||||
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
||||
|
@ -827,7 +848,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
lexical = lexical.prev;
|
||||
var type = lexical.type, closing = firstChar == type;
|
||||
|
||||
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
||||
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
|
||||
else if (type == "form" && firstChar == "{") return lexical.indented;
|
||||
else if (type == "form") return lexical.indented + indentUnit;
|
||||
else if (type == "stat")
|
||||
|
|
59
gui/public/codemirror/mode/javascript/test.js
vendored
59
gui/public/codemirror/mode/javascript/test.js
vendored
|
@ -63,6 +63,12 @@
|
|||
MT("import_trailing_comma",
|
||||
"[keyword import] {[def foo], [def bar],} [keyword from] [string 'baz']")
|
||||
|
||||
MT("import_dynamic",
|
||||
"[keyword import]([string 'baz']).[property then]")
|
||||
|
||||
MT("import_dynamic",
|
||||
"[keyword const] [def t] [operator =] [keyword import]([string 'baz']).[property then]")
|
||||
|
||||
MT("const",
|
||||
"[keyword function] [def f]() {",
|
||||
" [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];",
|
||||
|
@ -71,12 +77,44 @@
|
|||
MT("for/of",
|
||||
"[keyword for]([keyword let] [def of] [keyword of] [variable something]) {}");
|
||||
|
||||
MT("for await",
|
||||
"[keyword for] [keyword await]([keyword let] [def of] [keyword of] [variable something]) {}");
|
||||
|
||||
MT("generator",
|
||||
"[keyword function*] [def repeat]([def n]) {",
|
||||
" [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])",
|
||||
" [keyword yield] [variable-2 i];",
|
||||
"}");
|
||||
|
||||
MT("let_scoping",
|
||||
"[keyword function] [def scoped]([def n]) {",
|
||||
" { [keyword var] [def i]; } [variable-2 i];",
|
||||
" { [keyword let] [def j]; [variable-2 j]; } [variable j];",
|
||||
" [keyword if] ([atom true]) { [keyword const] [def k]; [variable-2 k]; } [variable k];",
|
||||
"}");
|
||||
|
||||
MT("switch_scoping",
|
||||
"[keyword switch] ([variable x]) {",
|
||||
" [keyword default]:",
|
||||
" [keyword let] [def j];",
|
||||
" [keyword return] [variable-2 j]",
|
||||
"}",
|
||||
"[variable j];")
|
||||
|
||||
MT("leaving_scope",
|
||||
"[keyword function] [def a]() {",
|
||||
" {",
|
||||
" [keyword const] [def x] [operator =] [number 1]",
|
||||
" [keyword if] ([atom true]) {",
|
||||
" [keyword let] [def y] [operator =] [number 2]",
|
||||
" [keyword var] [def z] [operator =] [number 3]",
|
||||
" [variable console].[property log]([variable-2 x], [variable-2 y], [variable-2 z])",
|
||||
" }",
|
||||
" [variable console].[property log]([variable-2 x], [variable y], [variable-2 z])",
|
||||
" }",
|
||||
" [variable console].[property log]([variable x], [variable y], [variable-2 z])",
|
||||
"}")
|
||||
|
||||
MT("quotedStringAddition",
|
||||
"[keyword let] [def f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];");
|
||||
|
||||
|
@ -230,6 +268,8 @@
|
|||
"[keyword const] [def async] [operator =] {[property a]: [number 1]};",
|
||||
"[keyword const] [def foo] [operator =] [string-2 `bar ${][variable async].[property a][string-2 }`];")
|
||||
|
||||
MT("bigint", "[number 1n] [operator +] [number 0x1afn] [operator +] [number 0o064n] [operator +] [number 0b100n];")
|
||||
|
||||
MT("async_comment",
|
||||
"[keyword async] [comment /**/] [keyword function] [def foo]([def args]) { [keyword return] [atom true]; }");
|
||||
|
||||
|
@ -383,6 +423,25 @@
|
|||
" }",
|
||||
"}")
|
||||
|
||||
TS("type as variable",
|
||||
"[variable type] [operator =] [variable x] [keyword as] [type Bar];");
|
||||
|
||||
TS("enum body",
|
||||
"[keyword export] [keyword const] [keyword enum] [def CodeInspectionResultType] {",
|
||||
" [def ERROR] [operator =] [string 'problem_type_error'],",
|
||||
" [def WARNING] [operator =] [string 'problem_type_warning'],",
|
||||
" [def META],",
|
||||
"}")
|
||||
|
||||
TS("parenthesized type",
|
||||
"[keyword class] [def Foo] {",
|
||||
" [property x] [operator =] [keyword new] [variable A][operator <][type B], [type string][operator |](() [operator =>] [type void])[operator >]();",
|
||||
" [keyword private] [property bar]();",
|
||||
"}")
|
||||
|
||||
TS("abstract class",
|
||||
"[keyword export] [keyword abstract] [keyword class] [def Foo] {}")
|
||||
|
||||
var jsonld_mode = CodeMirror.getMode(
|
||||
{indentUnit: 2},
|
||||
{name: "javascript", jsonld: true}
|
||||
|
|
2
gui/public/codemirror/mode/jsx/jsx.js
vendored
2
gui/public/codemirror/mode/jsx/jsx.js
vendored
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
|
||||
CodeMirror.defineMode("jsx", function(config, modeConfig) {
|
||||
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
|
||||
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false, allowMissingTagName: true})
|
||||
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
|
||||
|
||||
function flatXMLIndent(state) {
|
||||
|
|
3
gui/public/codemirror/mode/jsx/test.js
vendored
3
gui/public/codemirror/mode/jsx/test.js
vendored
|
@ -11,6 +11,9 @@
|
|||
MT("openclose",
|
||||
"([bracket&tag <][tag foo][bracket&tag >]hello [atom &][bracket&tag </][tag foo][bracket&tag >][operator ++])")
|
||||
|
||||
MT("openclosefragment",
|
||||
"([bracket&tag <><][tag foo][bracket&tag >]hello [atom &][bracket&tag </][tag foo][bracket&tag ></>][operator ++])")
|
||||
|
||||
MT("attr",
|
||||
"([bracket&tag <][tag foo] [attribute abc]=[string 'value'][bracket&tag >]hello [atom &][bracket&tag </][tag foo][bracket&tag >][operator ++])")
|
||||
|
||||
|
|
17
gui/public/codemirror/mode/markdown/markdown.js
vendored
17
gui/public/codemirror/mode/markdown/markdown.js
vendored
|
@ -90,7 +90,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
|
||||
, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
|
||||
, linkDefRE = /^\s*\[[^\]]+?\]:\s*\S+(\s*\S*\s*)?$/ // naive link-definition
|
||||
, linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
|
||||
, punctuation = /[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/
|
||||
, expandedTab = " " // CommonMark specifies tab as 4 spaces
|
||||
|
||||
|
@ -113,6 +113,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
function blankLine(state) {
|
||||
// Reset linkTitle state
|
||||
state.linkTitle = false;
|
||||
state.linkHref = false;
|
||||
state.linkText = false;
|
||||
// Reset EM state
|
||||
state.em = false;
|
||||
// Reset STRONG state
|
||||
|
@ -151,6 +153,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
if (state.indentationDiff === null) {
|
||||
state.indentationDiff = state.indentation;
|
||||
if (prevLineIsList) {
|
||||
// Reset inline styles which shouldn't propagate aross list items
|
||||
state.em = false;
|
||||
state.strong = false;
|
||||
state.code = false;
|
||||
state.strikethrough = false;
|
||||
|
||||
state.list = null;
|
||||
// While this list item's marker's indentation is less than the deepest
|
||||
// list item's content's indentation,pop the deepest list item
|
||||
|
@ -526,7 +534,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
return type + tokenTypes.linkEmail;
|
||||
}
|
||||
|
||||
if (modeCfg.xml && ch === '<' && stream.match(/^(!--|[a-z]+(?:\s+[a-z_:.\-]+(?:\s*=\s*[^ >]+)?)*\s*>)/i, false)) {
|
||||
if (modeCfg.xml && ch === '<' && stream.match(/^(!--|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*>)/i, false)) {
|
||||
var end = stream.string.indexOf(">", stream.pos);
|
||||
if (end != -1) {
|
||||
var atts = stream.string.substring(stream.start, end);
|
||||
|
@ -611,7 +619,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
}
|
||||
|
||||
if (ch === ' ') {
|
||||
if (stream.match(/ +$/, false)) {
|
||||
if (stream.match(/^ +$/, false)) {
|
||||
state.trailingSpace++;
|
||||
} else if (state.trailingSpace) {
|
||||
state.trailingSpaceNewLine = true;
|
||||
|
@ -777,6 +785,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
formatting: false,
|
||||
linkText: s.linkText,
|
||||
linkTitle: s.linkTitle,
|
||||
linkHref: s.linkHref,
|
||||
code: s.code,
|
||||
em: s.em,
|
||||
strong: s.strong,
|
||||
|
@ -856,6 +865,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
return mode;
|
||||
}, "xml");
|
||||
|
||||
CodeMirror.defineMIME("text/markdown", "markdown");
|
||||
|
||||
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
||||
|
||||
});
|
||||
|
|
|
@ -71,12 +71,12 @@ CodeMirror.defineMode('mathematica', function(_config, _parserConfig) {
|
|||
}
|
||||
|
||||
// usage
|
||||
if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/, true, false)) {
|
||||
if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/, true, false)) {
|
||||
return 'meta';
|
||||
}
|
||||
|
||||
// message
|
||||
if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
|
||||
if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
|
||||
return 'string-2';
|
||||
}
|
||||
|
||||
|
|
11
gui/public/codemirror/mode/meta.js
vendored
11
gui/public/codemirror/mode/meta.js
vendored
|
@ -17,7 +17,7 @@
|
|||
{name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
|
||||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
|
||||
{name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
|
||||
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]},
|
||||
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
|
||||
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
|
||||
{name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
|
||||
{name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]},
|
||||
|
@ -64,7 +64,7 @@
|
|||
{name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
|
||||
{name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
|
||||
{name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
|
||||
{name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"], alias: ["xhtml"]},
|
||||
{name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]},
|
||||
{name: "HTTP", mime: "message/http", mode: "http"},
|
||||
{name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
|
||||
{name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
|
||||
|
@ -94,14 +94,14 @@
|
|||
{name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
|
||||
{name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
|
||||
mode: "ntriples", ext: ["nt", "nq"]},
|
||||
{name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"], alias: ["objective-c", "objc"]},
|
||||
{name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"], alias: ["objective-c", "objc"]},
|
||||
{name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
|
||||
{name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
|
||||
{name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
|
||||
{name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
|
||||
{name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
|
||||
{name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
|
||||
{name: "PHP", mime: ["application/x-httpd-php", "text/x-php"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
|
||||
{name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
|
||||
{name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
|
||||
{name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
|
||||
{name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
|
||||
|
@ -128,6 +128,7 @@
|
|||
{name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
|
||||
{name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
|
||||
{name: "Solr", mime: "text/x-solr", mode: "solr"},
|
||||
{name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
|
||||
{name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
|
||||
{name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
|
||||
{name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
|
||||
|
@ -137,7 +138,7 @@
|
|||
{name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
|
||||
{name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
|
||||
{name: "sTeX", mime: "text/x-stex", mode: "stex"},
|
||||
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]},
|
||||
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
|
||||
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
|
||||
{name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
|
||||
{name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
|
||||
|
|
19
gui/public/codemirror/mode/mllike/index.html
vendored
19
gui/public/codemirror/mode/mllike/index.html
vendored
|
@ -132,6 +132,25 @@ let () =
|
|||
|
||||
(* A Hundred Lines of Caml - http://caml.inria.fr/about/taste.en.html *)
|
||||
(* OCaml page on Wikipedia - http://en.wikipedia.org/wiki/OCaml *)
|
||||
|
||||
module type S = sig type t end
|
||||
|
||||
let x = {|
|
||||
this is a long string
|
||||
with many lines and stuff
|
||||
|}
|
||||
|
||||
let b = 0b00110
|
||||
let h = 0x123abcd
|
||||
let e = 1e-10
|
||||
let i = 1.
|
||||
let x = 30_000
|
||||
let o = 0o1234
|
||||
|
||||
[1; 2; 3] (* lists *)
|
||||
|
||||
1 @ 2
|
||||
1. +. 2.
|
||||
</textarea>
|
||||
|
||||
<h2>F# mode</h2>
|
||||
|
|
234
gui/public/codemirror/mode/mllike/mllike.js
vendored
234
gui/public/codemirror/mode/mllike/mllike.js
vendored
|
@ -13,31 +13,26 @@
|
|||
|
||||
CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
||||
var words = {
|
||||
'let': 'keyword',
|
||||
'rec': 'keyword',
|
||||
'in': 'keyword',
|
||||
'of': 'keyword',
|
||||
'and': 'keyword',
|
||||
'if': 'keyword',
|
||||
'then': 'keyword',
|
||||
'else': 'keyword',
|
||||
'for': 'keyword',
|
||||
'to': 'keyword',
|
||||
'while': 'keyword',
|
||||
'as': 'keyword',
|
||||
'do': 'keyword',
|
||||
'done': 'keyword',
|
||||
'else': 'keyword',
|
||||
'end': 'keyword',
|
||||
'exception': 'keyword',
|
||||
'fun': 'keyword',
|
||||
'function': 'keyword',
|
||||
'val': 'keyword',
|
||||
'functor': 'keyword',
|
||||
'if': 'keyword',
|
||||
'in': 'keyword',
|
||||
'include': 'keyword',
|
||||
'let': 'keyword',
|
||||
'of': 'keyword',
|
||||
'open': 'keyword',
|
||||
'rec': 'keyword',
|
||||
'struct': 'keyword',
|
||||
'then': 'keyword',
|
||||
'type': 'keyword',
|
||||
'mutable': 'keyword',
|
||||
'match': 'keyword',
|
||||
'with': 'keyword',
|
||||
'try': 'keyword',
|
||||
'open': 'builtin',
|
||||
'ignore': 'builtin',
|
||||
'begin': 'keyword',
|
||||
'end': 'keyword'
|
||||
'val': 'keyword',
|
||||
'while': 'keyword',
|
||||
'with': 'keyword'
|
||||
};
|
||||
|
||||
var extraWords = parserConfig.extraWords || {};
|
||||
|
@ -54,6 +49,13 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|||
state.tokenize = tokenString;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (ch === '{') {
|
||||
if (stream.eat('|')) {
|
||||
state.longString = true;
|
||||
state.tokenize = tokenLongString;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
if (ch === '(') {
|
||||
if (stream.eat('*')) {
|
||||
state.commentLevel++;
|
||||
|
@ -61,7 +63,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
if (ch === '~') {
|
||||
if (ch === '~' || ch === '?') {
|
||||
stream.eatWhile(/\w/);
|
||||
return 'variable-2';
|
||||
}
|
||||
|
@ -74,13 +76,24 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|||
return 'comment';
|
||||
}
|
||||
if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\d]/);
|
||||
if (stream.eat('.')) {
|
||||
stream.eatWhile(/[\d]/);
|
||||
if (ch === '0' && stream.eat(/[bB]/)) {
|
||||
stream.eatWhile(/[01]/);
|
||||
} if (ch === '0' && stream.eat(/[xX]/)) {
|
||||
stream.eatWhile(/[0-9a-fA-F]/)
|
||||
} if (ch === '0' && stream.eat(/[oO]/)) {
|
||||
stream.eatWhile(/[0-7]/);
|
||||
} else {
|
||||
stream.eatWhile(/[\d_]/);
|
||||
if (stream.eat('.')) {
|
||||
stream.eatWhile(/[\d]/);
|
||||
}
|
||||
if (stream.eat(/[eE]/)) {
|
||||
stream.eatWhile(/[\d\-+]/);
|
||||
}
|
||||
}
|
||||
return 'number';
|
||||
}
|
||||
if ( /[+\-*&%=<>!?|]/.test(ch)) {
|
||||
if ( /[+\-*&%=<>!?|@\.~:]/.test(ch)) {
|
||||
return 'operator';
|
||||
}
|
||||
if (/[\w\xa1-\uffff]/.test(ch)) {
|
||||
|
@ -119,8 +132,20 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|||
return 'comment';
|
||||
}
|
||||
|
||||
function tokenLongString(stream, state) {
|
||||
var prev, next;
|
||||
while (state.longString && (next = stream.next()) != null) {
|
||||
if (prev === '|' && next === '}') state.longString = false;
|
||||
prev = next;
|
||||
}
|
||||
if (!state.longString) {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
return 'string';
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
|
||||
startState: function() {return {tokenize: tokenBase, commentLevel: 0, longString: false};},
|
||||
token: function(stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
return state.tokenize(stream, state);
|
||||
|
@ -135,14 +160,64 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|||
CodeMirror.defineMIME('text/x-ocaml', {
|
||||
name: 'mllike',
|
||||
extraWords: {
|
||||
'succ': 'keyword',
|
||||
'and': 'keyword',
|
||||
'assert': 'keyword',
|
||||
'begin': 'keyword',
|
||||
'class': 'keyword',
|
||||
'constraint': 'keyword',
|
||||
'done': 'keyword',
|
||||
'downto': 'keyword',
|
||||
'external': 'keyword',
|
||||
'function': 'keyword',
|
||||
'initializer': 'keyword',
|
||||
'lazy': 'keyword',
|
||||
'match': 'keyword',
|
||||
'method': 'keyword',
|
||||
'module': 'keyword',
|
||||
'mutable': 'keyword',
|
||||
'new': 'keyword',
|
||||
'nonrec': 'keyword',
|
||||
'object': 'keyword',
|
||||
'private': 'keyword',
|
||||
'sig': 'keyword',
|
||||
'to': 'keyword',
|
||||
'try': 'keyword',
|
||||
'value': 'keyword',
|
||||
'virtual': 'keyword',
|
||||
'when': 'keyword',
|
||||
|
||||
// builtins
|
||||
'raise': 'builtin',
|
||||
'failwith': 'builtin',
|
||||
'true': 'builtin',
|
||||
'false': 'builtin',
|
||||
|
||||
// Pervasives builtins
|
||||
'asr': 'builtin',
|
||||
'land': 'builtin',
|
||||
'lor': 'builtin',
|
||||
'lsl': 'builtin',
|
||||
'lsr': 'builtin',
|
||||
'lxor': 'builtin',
|
||||
'mod': 'builtin',
|
||||
'or': 'builtin',
|
||||
|
||||
// More Pervasives
|
||||
'raise_notrace': 'builtin',
|
||||
'trace': 'builtin',
|
||||
'exit': 'builtin',
|
||||
'print_string': 'builtin',
|
||||
'print_endline': 'builtin',
|
||||
'true': 'atom',
|
||||
'false': 'atom',
|
||||
'raise': 'keyword'
|
||||
|
||||
'int': 'type',
|
||||
'float': 'type',
|
||||
'bool': 'type',
|
||||
'char': 'type',
|
||||
'string': 'type',
|
||||
'unit': 'type',
|
||||
|
||||
// Modules
|
||||
'List': 'builtin'
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -150,18 +225,21 @@ CodeMirror.defineMIME('text/x-fsharp', {
|
|||
name: 'mllike',
|
||||
extraWords: {
|
||||
'abstract': 'keyword',
|
||||
'as': 'keyword',
|
||||
'assert': 'keyword',
|
||||
'base': 'keyword',
|
||||
'begin': 'keyword',
|
||||
'class': 'keyword',
|
||||
'default': 'keyword',
|
||||
'delegate': 'keyword',
|
||||
'do!': 'keyword',
|
||||
'done': 'keyword',
|
||||
'downcast': 'keyword',
|
||||
'downto': 'keyword',
|
||||
'elif': 'keyword',
|
||||
'exception': 'keyword',
|
||||
'extern': 'keyword',
|
||||
'finally': 'keyword',
|
||||
'for': 'keyword',
|
||||
'function': 'keyword',
|
||||
'global': 'keyword',
|
||||
'inherit': 'keyword',
|
||||
'inline': 'keyword',
|
||||
|
@ -169,38 +247,108 @@ CodeMirror.defineMIME('text/x-fsharp', {
|
|||
'internal': 'keyword',
|
||||
'lazy': 'keyword',
|
||||
'let!': 'keyword',
|
||||
'member' : 'keyword',
|
||||
'match': 'keyword',
|
||||
'member': 'keyword',
|
||||
'module': 'keyword',
|
||||
'mutable': 'keyword',
|
||||
'namespace': 'keyword',
|
||||
'new': 'keyword',
|
||||
'null': 'keyword',
|
||||
'override': 'keyword',
|
||||
'private': 'keyword',
|
||||
'public': 'keyword',
|
||||
'return': 'keyword',
|
||||
'return!': 'keyword',
|
||||
'return': 'keyword',
|
||||
'select': 'keyword',
|
||||
'static': 'keyword',
|
||||
'struct': 'keyword',
|
||||
'to': 'keyword',
|
||||
'try': 'keyword',
|
||||
'upcast': 'keyword',
|
||||
'use': 'keyword',
|
||||
'use!': 'keyword',
|
||||
'val': 'keyword',
|
||||
'use': 'keyword',
|
||||
'void': 'keyword',
|
||||
'when': 'keyword',
|
||||
'yield': 'keyword',
|
||||
'yield!': 'keyword',
|
||||
'yield': 'keyword',
|
||||
|
||||
// Reserved words
|
||||
'atomic': 'keyword',
|
||||
'break': 'keyword',
|
||||
'checked': 'keyword',
|
||||
'component': 'keyword',
|
||||
'const': 'keyword',
|
||||
'constraint': 'keyword',
|
||||
'constructor': 'keyword',
|
||||
'continue': 'keyword',
|
||||
'eager': 'keyword',
|
||||
'event': 'keyword',
|
||||
'external': 'keyword',
|
||||
'fixed': 'keyword',
|
||||
'method': 'keyword',
|
||||
'mixin': 'keyword',
|
||||
'object': 'keyword',
|
||||
'parallel': 'keyword',
|
||||
'process': 'keyword',
|
||||
'protected': 'keyword',
|
||||
'pure': 'keyword',
|
||||
'sealed': 'keyword',
|
||||
'tailcall': 'keyword',
|
||||
'trait': 'keyword',
|
||||
'virtual': 'keyword',
|
||||
'volatile': 'keyword',
|
||||
|
||||
// builtins
|
||||
'List': 'builtin',
|
||||
'Seq': 'builtin',
|
||||
'Map': 'builtin',
|
||||
'Set': 'builtin',
|
||||
'Option': 'builtin',
|
||||
'int': 'builtin',
|
||||
'string': 'builtin',
|
||||
'raise': 'builtin',
|
||||
'failwith': 'builtin',
|
||||
'not': 'builtin',
|
||||
'true': 'builtin',
|
||||
'false': 'builtin'
|
||||
'false': 'builtin',
|
||||
|
||||
'raise': 'builtin',
|
||||
'failwith': 'builtin'
|
||||
},
|
||||
slashComments: true
|
||||
});
|
||||
|
||||
|
||||
CodeMirror.defineMIME('text/x-sml', {
|
||||
name: 'mllike',
|
||||
extraWords: {
|
||||
'abstype': 'keyword',
|
||||
'and': 'keyword',
|
||||
'andalso': 'keyword',
|
||||
'case': 'keyword',
|
||||
'datatype': 'keyword',
|
||||
'fn': 'keyword',
|
||||
'handle': 'keyword',
|
||||
'infix': 'keyword',
|
||||
'infixr': 'keyword',
|
||||
'local': 'keyword',
|
||||
'nonfix': 'keyword',
|
||||
'op': 'keyword',
|
||||
'orelse': 'keyword',
|
||||
'raise': 'keyword',
|
||||
'withtype': 'keyword',
|
||||
'eqtype': 'keyword',
|
||||
'sharing': 'keyword',
|
||||
'sig': 'keyword',
|
||||
'signature': 'keyword',
|
||||
'structure': 'keyword',
|
||||
'where': 'keyword',
|
||||
'true': 'keyword',
|
||||
'false': 'keyword',
|
||||
|
||||
// types
|
||||
'int': 'builtin',
|
||||
'real': 'builtin',
|
||||
'string': 'builtin',
|
||||
'char': 'builtin',
|
||||
'bool': 'builtin'
|
||||
},
|
||||
slashComments: true
|
||||
});
|
||||
|
|
4
gui/public/codemirror/mode/nginx/index.html
vendored
4
gui/public/codemirror/mode/nginx/index.html
vendored
|
@ -1,4 +1,4 @@
|
|||
<!doctype html>
|
||||
<!doctype html>
|
||||
<head>
|
||||
<title>CodeMirror: NGINX mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
|
@ -176,6 +176,6 @@ server {
|
|||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/nginx</code>.</p>
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-nginx-conf</code>.</p>
|
||||
|
||||
</article>
|
||||
|
|
4
gui/public/codemirror/mode/nsis/nsis.js
vendored
4
gui/public/codemirror/mode/nsis/nsis.js
vendored
|
@ -24,14 +24,14 @@ CodeMirror.defineSimpleMode("nsis",{
|
|||
{ regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
|
||||
|
||||
// Compile Time Commands
|
||||
{regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|makensis|searchparse|searchreplace))\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"},
|
||||
|
||||
// Conditional Compilation
|
||||
{regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true},
|
||||
{regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
|
||||
|
||||
// Runtime Commands
|
||||
{regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEDllCharacteristics|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
|
||||
{regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
|
||||
|
||||
|
|
9
gui/public/codemirror/mode/python/index.html
vendored
9
gui/public/codemirror/mode/python/index.html
vendored
|
@ -126,6 +126,15 @@ class ExampleClass(ParentClass):
|
|||
def __init__(self, mixin = 'Hello'):
|
||||
self.mixin = mixin
|
||||
|
||||
# Python 3.6 f-strings (https://www.python.org/dev/peps/pep-0498/)
|
||||
f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.'
|
||||
f'He said his name is {name!r}.'
|
||||
f"""He said his name is {name!r}."""
|
||||
f'{"quoted string"}'
|
||||
f'{{ {4*10} }}'
|
||||
f'This is an error }'
|
||||
f'This is ok }}'
|
||||
fr'x={4*10}\n'
|
||||
</textarea></div>
|
||||
|
||||
|
||||
|
|
113
gui/public/codemirror/mode/python/python.js
vendored
113
gui/public/codemirror/mode/python/python.js
vendored
|
@ -41,7 +41,7 @@
|
|||
CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||
var ERRORCLASS = "error";
|
||||
|
||||
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/;
|
||||
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
|
||||
// (Backwards-compatiblity with old, cumbersome config system)
|
||||
var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
|
||||
parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@])/]
|
||||
|
@ -62,7 +62,7 @@
|
|||
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
||||
myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
|
||||
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
|
||||
var stringPrefixes = new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))", "i");
|
||||
var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i");
|
||||
} else {
|
||||
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
|
||||
myKeywords = myKeywords.concat(["exec", "print"]);
|
||||
|
@ -76,9 +76,10 @@
|
|||
|
||||
// tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
if (stream.sol()) state.indent = stream.indentation()
|
||||
var sol = stream.sol() && state.lastToken != "\\"
|
||||
if (sol) state.indent = stream.indentation()
|
||||
// Handle scope changes
|
||||
if (stream.sol() && top(state).type == "py") {
|
||||
if (sol && top(state).type == "py") {
|
||||
var scopeOffset = top(state).offset;
|
||||
if (stream.eatSpace()) {
|
||||
var lineOffset = stream.indentation();
|
||||
|
@ -100,13 +101,8 @@
|
|||
function tokenBaseInner(stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
|
||||
var ch = stream.peek();
|
||||
|
||||
// Handle Comments
|
||||
if (ch == "#") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (stream.match(/^#.*/)) return "comment";
|
||||
|
||||
// Handle Number Literals
|
||||
if (stream.match(/^[0-9\.]/, false)) {
|
||||
|
@ -146,8 +142,14 @@
|
|||
|
||||
// Handle Strings
|
||||
if (stream.match(stringPrefixes)) {
|
||||
state.tokenize = tokenStringFactory(stream.current());
|
||||
return state.tokenize(stream, state);
|
||||
var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
|
||||
if (!isFmtString) {
|
||||
state.tokenize = tokenStringFactory(stream.current());
|
||||
return state.tokenize(stream, state);
|
||||
} else {
|
||||
state.tokenize = formatStringFactory(stream.current(), state.tokenize);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < operators.length; i++)
|
||||
|
@ -178,6 +180,77 @@
|
|||
return ERRORCLASS;
|
||||
}
|
||||
|
||||
function formatStringFactory(delimiter, tokenOuter) {
|
||||
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
||||
delimiter = delimiter.substr(1);
|
||||
|
||||
var singleline = delimiter.length == 1;
|
||||
var OUTCLASS = "string";
|
||||
|
||||
function tokenFString(stream, state) {
|
||||
// inside f-str Expression
|
||||
if (stream.match(delimiter)) {
|
||||
// expression ends pre-maturally, but very common in editing
|
||||
// Could show error to remind users to close brace here
|
||||
state.tokenize = tokenString
|
||||
return OUTCLASS;
|
||||
} else if (stream.match('{')) {
|
||||
// starting brace, if not eaten below
|
||||
return "punctuation";
|
||||
} else if (stream.match('}')) {
|
||||
// return to regular inside string state
|
||||
state.tokenize = tokenString
|
||||
return "punctuation";
|
||||
} else {
|
||||
// use tokenBaseInner to parse the expression
|
||||
return tokenBaseInner(stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
function tokenString(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^'"\{\}\\]/);
|
||||
if (stream.eat("\\")) {
|
||||
stream.next();
|
||||
if (singleline && stream.eol())
|
||||
return OUTCLASS;
|
||||
} else if (stream.match(delimiter)) {
|
||||
state.tokenize = tokenOuter;
|
||||
return OUTCLASS;
|
||||
} else if (stream.match('{{')) {
|
||||
// ignore {{ in f-str
|
||||
return OUTCLASS;
|
||||
} else if (stream.match('{', false)) {
|
||||
// switch to nested mode
|
||||
state.tokenize = tokenFString
|
||||
if (stream.current()) {
|
||||
return OUTCLASS;
|
||||
} else {
|
||||
// need to return something, so eat the starting {
|
||||
stream.next();
|
||||
return "punctuation";
|
||||
}
|
||||
} else if (stream.match('}}')) {
|
||||
return OUTCLASS;
|
||||
} else if (stream.match('}')) {
|
||||
// single } in f-string is an error
|
||||
return ERRORCLASS;
|
||||
} else {
|
||||
stream.eat(/['"]/);
|
||||
}
|
||||
}
|
||||
if (singleline) {
|
||||
if (parserConf.singleLineStringErrors)
|
||||
return ERRORCLASS;
|
||||
else
|
||||
state.tokenize = tokenOuter;
|
||||
}
|
||||
return OUTCLASS;
|
||||
}
|
||||
tokenString.isString = true;
|
||||
return tokenString;
|
||||
}
|
||||
|
||||
function tokenStringFactory(delimiter) {
|
||||
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
||||
delimiter = delimiter.substr(1);
|
||||
|
@ -258,14 +331,16 @@
|
|||
if (current == ":" && !state.lambda && top(state).type == "py")
|
||||
pushPyScope(state);
|
||||
|
||||
var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
|
||||
if (delimiter_index != -1)
|
||||
pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
||||
if (current.length == 1 && !/string|comment/.test(style)) {
|
||||
var delimiter_index = "[({".indexOf(current);
|
||||
if (delimiter_index != -1)
|
||||
pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
||||
|
||||
delimiter_index = "])}".indexOf(current);
|
||||
if (delimiter_index != -1) {
|
||||
if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
|
||||
else return ERRORCLASS;
|
||||
delimiter_index = "])}".indexOf(current);
|
||||
if (delimiter_index != -1) {
|
||||
if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
|
||||
else return ERRORCLASS;
|
||||
}
|
||||
}
|
||||
if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
|
||||
if (state.scopes.length > 1) state.scopes.pop();
|
||||
|
|
5
gui/public/codemirror/mode/python/test.js
vendored
5
gui/public/codemirror/mode/python/test.js
vendored
|
@ -30,6 +30,9 @@
|
|||
MT("before_equal_sign_" + c, "[variable a] [operator " + c + "=] [variable b]");
|
||||
}
|
||||
|
||||
MT("fValidStringPrefix", "[string f'this is a {formatted} string']");
|
||||
MT("fValidStringPrefix", "[string f'this is a]{[variable formatted]}[string string']");
|
||||
MT("fValidExpressioninFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']");
|
||||
MT("fInvalidFString", "[error f'this is wrong}]");
|
||||
MT("fNestedFString", "[string f'expression ]{[number 100] [operator +] [string f'inner]{[number 5]}[string ']}[string string']");
|
||||
MT("uValidStringPrefix", "[string u'this is an unicode string']");
|
||||
})();
|
||||
|
|
23
gui/public/codemirror/mode/shell/shell.js
vendored
23
gui/public/codemirror/mode/shell/shell.js
vendored
|
@ -84,29 +84,38 @@ CodeMirror.defineMode('shell', function() {
|
|||
function tokenString(quote, style) {
|
||||
var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
|
||||
return function(stream, state) {
|
||||
var next, end = false, escaped = false;
|
||||
var next, escaped = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next === close && !escaped) {
|
||||
end = true;
|
||||
state.tokens.shift();
|
||||
break;
|
||||
}
|
||||
if (next === '$' && !escaped && quote !== "'") {
|
||||
} else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
|
||||
escaped = true;
|
||||
stream.backUp(1);
|
||||
state.tokens.unshift(tokenDollar);
|
||||
break;
|
||||
}
|
||||
if (!escaped && next === quote && quote !== close) {
|
||||
} else if (!escaped && quote !== close && next === quote) {
|
||||
state.tokens.unshift(tokenString(quote, style))
|
||||
return tokenize(stream, state)
|
||||
} else if (!escaped && /['"]/.test(next) && !/['"]/.test(quote)) {
|
||||
state.tokens.unshift(tokenStringStart(next, "string"));
|
||||
stream.backUp(1);
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && next === '\\';
|
||||
}
|
||||
if (end) state.tokens.shift();
|
||||
return style;
|
||||
};
|
||||
};
|
||||
|
||||
function tokenStringStart(quote, style) {
|
||||
return function(stream, state) {
|
||||
state.tokens[0] = tokenString(quote, style)
|
||||
stream.next()
|
||||
return tokenize(stream, state)
|
||||
}
|
||||
}
|
||||
|
||||
var tokenDollar = function(stream, state) {
|
||||
if (state.tokens.length > 1) stream.eat('$');
|
||||
var ch = stream.next()
|
||||
|
|
9
gui/public/codemirror/mode/shell/test.js
vendored
9
gui/public/codemirror/mode/shell/test.js
vendored
|
@ -61,4 +61,13 @@
|
|||
|
||||
MT("nested braces",
|
||||
"[builtin echo] [def ${A[${B}]]}]")
|
||||
|
||||
MT("strings in parens",
|
||||
"[def FOO][operator =]([quote $(<][string \"][def $MYDIR][string \"][quote /myfile grep ][string 'hello$'][quote )])")
|
||||
|
||||
MT ("string ending in dollar",
|
||||
'[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]')
|
||||
|
||||
MT ("quote ending in dollar",
|
||||
"[quote $(echo a$)]")
|
||||
})();
|
||||
|
|
1
gui/public/codemirror/mode/soy/soy.js
vendored
1
gui/public/codemirror/mode/soy/soy.js
vendored
|
@ -22,6 +22,7 @@
|
|||
attributes: textMode,
|
||||
text: textMode,
|
||||
uri: textMode,
|
||||
trusted_resource_uri: textMode,
|
||||
css: CodeMirror.getMode(config, "text/css"),
|
||||
js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit})
|
||||
};
|
||||
|
|
36
gui/public/codemirror/mode/sql/sql.js
vendored
36
gui/public/codemirror/mode/sql/sql.js
vendored
File diff suppressed because one or more lines are too long
12
gui/public/codemirror/mode/stex/stex.js
vendored
12
gui/public/codemirror/mode/stex/stex.js
vendored
|
@ -78,6 +78,14 @@
|
|||
plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
|
||||
plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
|
||||
|
||||
plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
|
||||
plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
|
||||
plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
|
||||
plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
|
||||
plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
|
||||
plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
|
||||
plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
|
||||
|
||||
plugins["DEFAULT"] = function () {
|
||||
this.name = "DEFAULT";
|
||||
this.style = "tag";
|
||||
|
@ -117,6 +125,10 @@
|
|||
setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
|
||||
return "keyword";
|
||||
}
|
||||
if (source.match("\\(")) {
|
||||
setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
|
||||
return "keyword";
|
||||
}
|
||||
if (source.match("$$")) {
|
||||
setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
|
||||
return "keyword";
|
||||
|
|
9
gui/public/codemirror/mode/stex/test.js
vendored
9
gui/public/codemirror/mode/stex/test.js
vendored
|
@ -111,9 +111,18 @@
|
|||
MT("inlineMath",
|
||||
"[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
|
||||
|
||||
MT("inlineMathLatexStyle",
|
||||
"[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text");
|
||||
|
||||
MT("displayMath",
|
||||
"More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
|
||||
|
||||
MT("displayMath environment",
|
||||
"[tag \\begin][bracket {][atom equation][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text");
|
||||
|
||||
MT("displayMath environment with label",
|
||||
"[tag \\begin][bracket {][atom equation][bracket }][tag \\label][bracket {][atom eq1][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text~[tag \\ref][bracket {][atom eq1][bracket }]");
|
||||
|
||||
MT("mathWithComment",
|
||||
"[keyword $][variable-2 x] [comment % $]",
|
||||
"[variable-2 y][keyword $] other text");
|
||||
|
|
2
gui/public/codemirror/mode/stylus/stylus.js
vendored
2
gui/public/codemirror/mode/stylus/stylus.js
vendored
|
@ -76,7 +76,7 @@
|
|||
if (ch == "#") {
|
||||
stream.next();
|
||||
// Hex color
|
||||
if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) {
|
||||
if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b/i)) {
|
||||
return ["atom", "atom"];
|
||||
}
|
||||
// ID selector
|
||||
|
|
13
gui/public/codemirror/mode/swift/swift.js
vendored
13
gui/public/codemirror/mode/swift/swift.js
vendored
|
@ -138,8 +138,17 @@
|
|||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
stream.match(/^(?:[^*]|\*(?!\/))*/)
|
||||
if (stream.match("*/")) state.tokenize.pop()
|
||||
var ch
|
||||
while (true) {
|
||||
stream.match(/^[^/*]+/, true)
|
||||
ch = stream.next()
|
||||
if (!ch) break
|
||||
if (ch === "/" && stream.eat("*")) {
|
||||
state.tokenize.push(tokenComment)
|
||||
} else if (ch === "*" && stream.eat("/")) {
|
||||
state.tokenize.pop()
|
||||
}
|
||||
}
|
||||
return "comment"
|
||||
}
|
||||
|
||||
|
|
7
gui/public/codemirror/mode/swift/test.js
vendored
7
gui/public/codemirror/mode/swift/test.js
vendored
|
@ -142,6 +142,13 @@
|
|||
"[variable print][punctuation (][variable foo][property ._123][punctuation )]",
|
||||
"[variable print][punctuation (]")
|
||||
|
||||
MT("nested_comments",
|
||||
"[comment /*]",
|
||||
"[comment But wait /* this is a nested comment */ for real]",
|
||||
"[comment /**** let * me * show * you ****/]",
|
||||
"[comment ///// let / me / show / you /////]",
|
||||
"[comment */]");
|
||||
|
||||
// TODO: correctly identify when multiple variables are being declared
|
||||
// by use of a comma-separated list.
|
||||
// TODO: correctly identify when variables are being declared in a tuple.
|
||||
|
|
|
@ -82,7 +82,7 @@ CodeMirror.defineMode("velocity", function() {
|
|||
}
|
||||
// variable?
|
||||
else if (ch == "$") {
|
||||
stream.eatWhile(/[\w\d\$_\.{}]/);
|
||||
stream.eatWhile(/[\w\d\$_\.{}-]/);
|
||||
// is it one of the specials?
|
||||
if (specials && specials.propertyIsEnumerable(stream.current())) {
|
||||
return "keyword";
|
||||
|
|
7
gui/public/codemirror/mode/xml/xml.js
vendored
7
gui/public/codemirror/mode/xml/xml.js
vendored
|
@ -52,6 +52,7 @@ var xmlConfig = {
|
|||
doNotIndent: {},
|
||||
allowUnquoted: false,
|
||||
allowMissing: false,
|
||||
allowMissingTagName: false,
|
||||
caseFold: false
|
||||
}
|
||||
|
||||
|
@ -226,6 +227,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
|||
state.tagName = stream.current();
|
||||
setStyle = "tag";
|
||||
return attrState;
|
||||
} else if (config.allowMissingTagName && type == "endTag") {
|
||||
setStyle = "tag bracket";
|
||||
return attrState(type, stream, state);
|
||||
} else {
|
||||
setStyle = "error";
|
||||
return tagNameState;
|
||||
|
@ -244,6 +248,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
|||
setStyle = "tag error";
|
||||
return closeStateErr;
|
||||
}
|
||||
} else if (config.allowMissingTagName && type == "endTag") {
|
||||
setStyle = "tag bracket";
|
||||
return closeState(type, stream, state);
|
||||
} else {
|
||||
setStyle = "error";
|
||||
return closeStateErr;
|
||||
|
|
3
gui/public/codemirror/mode/yaml/yaml.js
vendored
3
gui/public/codemirror/mode/yaml/yaml.js
vendored
|
@ -108,7 +108,8 @@ CodeMirror.defineMode("yaml", function() {
|
|||
literal: false,
|
||||
escaped: false
|
||||
};
|
||||
}
|
||||
},
|
||||
lineComment: "#"
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue