updated codemirror to 5.57.0

This commit is contained in:
zadam 2020-09-20 21:41:40 +02:00
parent 7f9bcc162e
commit 71323500b7
36 changed files with 1104 additions and 700 deletions

View File

@ -118,16 +118,24 @@
} }
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) { function clear(cm) {
cm.off("cursorActivity", doMatchBrackets);
if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) { if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
cm.state.matchBrackets.currentlyHighlighted(); cm.state.matchBrackets.currentlyHighlighted();
cm.state.matchBrackets.currentlyHighlighted = null; cm.state.matchBrackets.currentlyHighlighted = null;
} }
} }
if (old && old != CodeMirror.Init) {
cm.off("cursorActivity", doMatchBrackets);
cm.off("focus", doMatchBrackets)
cm.off("blur", clear)
clear(cm);
}
if (val) { if (val) {
cm.state.matchBrackets = typeof val == "object" ? val : {}; cm.state.matchBrackets = typeof val == "object" ? val : {};
cm.on("cursorActivity", doMatchBrackets); cm.on("cursorActivity", doMatchBrackets);
cm.on("focus", doMatchBrackets)
cm.on("blur", clear)
} }
}); });

View File

@ -12,10 +12,13 @@
"use strict"; "use strict";
var GUTTER_ID = "CodeMirror-lint-markers"; var GUTTER_ID = "CodeMirror-lint-markers";
function showTooltip(e, content) { function showTooltip(cm, e, content) {
var tt = document.createElement("div"); var tt = document.createElement("div");
tt.className = "CodeMirror-lint-tooltip"; tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
tt.appendChild(content.cloneNode(true)); tt.appendChild(content.cloneNode(true));
if (cm.state.lint.options.selfContain)
cm.getWrapperElement().appendChild(tt);
else
document.body.appendChild(tt); document.body.appendChild(tt);
function position(e) { function position(e) {
@ -38,8 +41,8 @@
setTimeout(function() { rm(tt); }, 600); setTimeout(function() { rm(tt); }, 600);
} }
function showTooltipFor(e, content, node) { function showTooltipFor(cm, e, content, node) {
var tooltip = showTooltip(e, content); var tooltip = showTooltip(cm, e, content);
function hide() { function hide() {
CodeMirror.off(node, "mouseout", hide); CodeMirror.off(node, "mouseout", hide);
if (tooltip) { hideTooltip(tooltip); tooltip = null; } if (tooltip) { hideTooltip(tooltip); tooltip = null; }
@ -78,7 +81,7 @@
state.marked.length = 0; state.marked.length = 0;
} }
function makeMarker(labels, severity, multiple, tooltips) { function makeMarker(cm, labels, severity, multiple, tooltips) {
var marker = document.createElement("div"), inner = marker; var marker = document.createElement("div"), inner = marker;
marker.className = "CodeMirror-lint-marker-" + severity; marker.className = "CodeMirror-lint-marker-" + severity;
if (multiple) { if (multiple) {
@ -87,7 +90,7 @@
} }
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) { if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
showTooltipFor(e, labels, inner); showTooltipFor(cm, e, labels, inner);
}); });
return marker; return marker;
@ -186,7 +189,7 @@
} }
if (state.hasGutter) if (state.hasGutter)
cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1, cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, anns.length > 1,
state.options.tooltips)); state.options.tooltips));
} }
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
@ -199,14 +202,14 @@
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
} }
function popupTooltips(annotations, e) { function popupTooltips(cm, annotations, e) {
var target = e.target || e.srcElement; var target = e.target || e.srcElement;
var tooltip = document.createDocumentFragment(); var tooltip = document.createDocumentFragment();
for (var i = 0; i < annotations.length; i++) { for (var i = 0; i < annotations.length; i++) {
var ann = annotations[i]; var ann = annotations[i];
tooltip.appendChild(annotationTooltip(ann)); tooltip.appendChild(annotationTooltip(ann));
} }
showTooltipFor(e, tooltip, target); showTooltipFor(cm, e, tooltip, target);
} }
function onMouseOver(cm, e) { function onMouseOver(cm, e) {
@ -220,7 +223,7 @@
var ann = spans[i].__annotation; var ann = spans[i].__annotation;
if (ann) annotations.push(ann); if (ann) annotations.push(ann);
} }
if (annotations.length) popupTooltips(annotations, e); if (annotations.length) popupTooltips(cm, annotations, e);
} }
CodeMirror.defineOption("lint", false, function(cm, val, old) { CodeMirror.defineOption("lint", false, function(cm, val, old) {

View File

@ -16,8 +16,8 @@
var countDown = n; var countDown = n;
return function() { if (--countDown == 0) cont(); }; return function() { if (--countDown == 0) cont(); };
} }
function ensureDeps(mode, cont) { function ensureDeps(mode, cont, options) {
var deps = CodeMirror.modes[mode].dependencies; var modeObj = CodeMirror.modes[mode], deps = modeObj && modeObj.dependencies;
if (!deps) return cont(); if (!deps) return cont();
var missing = []; var missing = [];
for (var i = 0; i < deps.length; ++i) { for (var i = 0; i < deps.length; ++i) {
@ -27,16 +27,18 @@
if (!missing.length) return cont(); if (!missing.length) return cont();
var split = splitCallback(cont, missing.length); var split = splitCallback(cont, missing.length);
for (var i = 0; i < missing.length; ++i) for (var i = 0; i < missing.length; ++i)
CodeMirror.requireMode(missing[i], split); CodeMirror.requireMode(missing[i], split, options);
} }
CodeMirror.requireMode = function(mode, cont) { CodeMirror.requireMode = function(mode, cont, options) {
if (typeof mode != "string") mode = mode.name; if (typeof mode != "string") mode = mode.name;
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont, options);
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
var file = CodeMirror.modeURL.replace(/%N/g, mode); var file = options && options.path ? options.path(mode) : CodeMirror.modeURL.replace(/%N/g, mode);
if (env == "plain") { if (options && options.loadMode) {
options.loadMode(file, function() { ensureDeps(mode, cont, options) })
} else if (env == "plain") {
var script = document.createElement("script"); var script = document.createElement("script");
script.src = file; script.src = file;
var others = document.getElementsByTagName("script")[0]; var others = document.getElementsByTagName("script")[0];
@ -44,7 +46,7 @@
CodeMirror.on(script, "load", function() { CodeMirror.on(script, "load", function() {
ensureDeps(mode, function() { ensureDeps(mode, function() {
for (var i = 0; i < list.length; ++i) list[i](); for (var i = 0; i < list.length; ++i) list[i]();
}); }, options);
}); });
others.parentNode.insertBefore(script, others); others.parentNode.insertBefore(script, others);
} else if (env == "cjs") { } else if (env == "cjs") {
@ -55,10 +57,10 @@
} }
}; };
CodeMirror.autoLoadMode = function(instance, mode) { CodeMirror.autoLoadMode = function(instance, mode, options) {
if (!CodeMirror.modes.hasOwnProperty(mode)) if (!CodeMirror.modes.hasOwnProperty(mode))
CodeMirror.requireMode(mode, function() { CodeMirror.requireMode(mode, function() {
instance.setOption("mode", instance.getOption("mode")); instance.setOption("mode", instance.getOption("mode"));
}); }, options);
}; };
}); });

View File

@ -90,7 +90,9 @@
var state = cm.state.matchHighlighter; var state = cm.state.matchHighlighter;
cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style)); cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));
if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) { if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) {
var searchFor = hasBoundary ? new RegExp("\\b" + query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") + "\\b") : query; var searchFor = hasBoundary ? new RegExp((/\w/.test(query.charAt(0)) ? "\\b" : "") +
query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") +
(/\w/.test(query.charAt(query.length - 1)) ? "\\b" : "")) : query;
state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, false, state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, false,
{className: "CodeMirror-selection-highlight-scrollbar"}); {className: "CodeMirror-selection-highlight-scrollbar"});
} }

View File

@ -3,7 +3,7 @@
.CodeMirror { .CodeMirror {
/* Set height, width, borders, and global font properties here */ /* Set height, width, borders, and global font properties here */
font-family: monospace; font-family: monospace;
height: auto; height: 300px;
color: black; color: black;
direction: ltr; direction: ltr;
} }
@ -164,17 +164,17 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-scroll { .CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */ overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */ /* 50px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */ /* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px; margin-bottom: -50px; margin-right: -50px;
padding-bottom: 30px; padding-bottom: 50px;
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;
border-right: 30px solid transparent; border-right: 50px solid transparent;
} }
/* The fake, visible scrollbars. Used to force redraw during scrolling /* The fake, visible scrollbars. Used to force redraw during scrolling
@ -212,7 +212,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
height: 100%; height: 100%;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
margin-bottom: -30px; margin-bottom: -50px;
} }
.CodeMirror-gutter-wrapper { .CodeMirror-gutter-wrapper {
position: absolute; position: absolute;

File diff suppressed because it is too large Load Diff

View File

@ -270,6 +270,25 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"static else struct switch extern typedef union for goto while enum const " + "static else struct switch extern typedef union for goto while enum const " +
"volatile inline restrict asm fortran"; "volatile inline restrict asm fortran";
// Keywords from https://en.cppreference.com/w/cpp/keyword includes C++20.
var cppKeywords = "alignas alignof and and_eq audit axiom bitand bitor catch " +
"class compl concept constexpr const_cast decltype delete dynamic_cast " +
"explicit export final friend import module mutable namespace new noexcept " +
"not not_eq operator or or_eq override private protected public " +
"reinterpret_cast requires static_assert static_cast template this " +
"thread_local throw try typeid typename using virtual xor xor_eq";
var objCKeywords = "bycopy byref in inout oneway out self super atomic nonatomic retain copy " +
"readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd " +
"@interface @implementation @end @protocol @encode @property @synthesize @dynamic @class " +
"@public @package @private @protected @required @optional @try @catch @finally @import " +
"@selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available";
var objCBuiltins = "FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION " +
" NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER " +
"NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION " +
"NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"
// Do not use this. Use the cTypes function below. This is global just to avoid // Do not use this. Use the cTypes function below. This is global just to avoid
// excessive calls when cTypes is being called multiple times during a parse. // excessive calls when cTypes is being called multiple times during a parse.
var basicCTypes = words("int long char short double float unsigned signed " + var basicCTypes = words("int long char short double float unsigned signed " +
@ -420,13 +439,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def(["text/x-c++src", "text/x-c++hdr"], { def(["text/x-c++src", "text/x-c++hdr"], {
name: "clike", name: "clike",
// Keywords from https://en.cppreference.com/w/cpp/keyword includes C++20. keywords: words(cKeywords + " " + cppKeywords),
keywords: words(cKeywords + "alignas alignof and and_eq audit axiom bitand bitor catch " +
"class compl concept constexpr const_cast decltype delete dynamic_cast " +
"explicit export final friend import module mutable namespace new noexcept " +
"not not_eq operator or or_eq override private protected public " +
"reinterpret_cast requires static_assert static_cast template this " +
"thread_local throw try typeid typename using virtual xor xor_eq"),
types: cTypes, types: cTypes,
blockKeywords: words(cBlockKeywords + " class try catch"), blockKeywords: words(cBlockKeywords + " class try catch"),
defKeywords: words(cDefKeywords + " class namespace"), defKeywords: words(cDefKeywords + " class namespace"),
@ -676,11 +689,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
state.tokenize = tokenKotlinString(stream.match('""')); state.tokenize = tokenKotlinString(stream.match('""'));
return state.tokenize(stream, state); return state.tokenize(stream, state);
}, },
"/": function(stream, state) {
if (!stream.eat("*")) return false;
state.tokenize = tokenNestedComment(1);
return state.tokenize(stream, state)
},
indent: function(state, ctx, textAfter, indentUnit) { indent: function(state, ctx, textAfter, indentUnit) {
var firstChar = textAfter && textAfter.charAt(0); var firstChar = textAfter && textAfter.charAt(0);
if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "") if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
return state.indented; return state.indented;
if (state.prevToken == "operator" && textAfter != "}" || if ((state.prevToken == "operator" && textAfter != "}" && state.context.type != "}") ||
state.prevToken == "variable" && firstChar == "." || state.prevToken == "variable" && firstChar == "." ||
(state.prevToken == "}" || state.prevToken == ")") && firstChar == ".") (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
return indentUnit * 2 + ctx.indented; return indentUnit * 2 + ctx.indented;
@ -764,16 +782,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-objectivec", { def("text/x-objectivec", {
name: "clike", name: "clike",
keywords: words(cKeywords + " bycopy byref in inout oneway out self super atomic nonatomic retain copy " + keywords: words(cKeywords + " " + objCKeywords),
"readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd " +
"@interface @implementation @end @protocol @encode @property @synthesize @dynamic @class " +
"@public @package @private @protected @required @optional @try @catch @finally @import " +
"@selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available"),
types: objCTypes, types: objCTypes,
builtin: words("FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINED " + builtin: words(objCBuiltins),
"NS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER " +
"NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN " +
"NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"),
blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"), blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"), defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
dontIndentStatements: /^@.*$/, dontIndentStatements: /^@.*$/,
@ -787,6 +798,46 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
modeProps: {fold: ["brace", "include"]} modeProps: {fold: ["brace", "include"]}
}); });
def("text/x-objectivec++", {
name: "clike",
keywords: words(cKeywords + " " + objCKeywords + " " + cppKeywords),
types: objCTypes,
builtin: words(objCBuiltins),
blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),
defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class class namespace"),
dontIndentStatements: /^@.*$|^template$/,
typeFirstDefinitions: true,
atoms: words("YES NO NULL Nil nil true false nullptr"),
isReservedIdentifier: cIsReservedIdentifier,
hooks: {
"#": cppHook,
"*": pointerHook,
"u": cpp11StringHook,
"U": cpp11StringHook,
"L": cpp11StringHook,
"R": cpp11StringHook,
"0": cpp14Literal,
"1": cpp14Literal,
"2": cpp14Literal,
"3": cpp14Literal,
"4": cpp14Literal,
"5": cpp14Literal,
"6": cpp14Literal,
"7": cpp14Literal,
"8": cpp14Literal,
"9": cpp14Literal,
token: function(stream, state, style) {
if (style == "variable" && stream.peek() == "(" &&
(state.prevToken == ";" || state.prevToken == null ||
state.prevToken == "}") &&
cppLooksLikeConstructor(stream.current()))
return "def";
}
},
namespaceSeparator: "::",
modeProps: {fold: ["brace", "include"]}
});
def("text/x-squirrel", { def("text/x-squirrel", {
name: "clike", name: "clike",
keywords: words("base break clone continue const default delete enum extends function in class" + keywords: words("base break clone continue const default delete enum extends function in class" +

View File

@ -442,117 +442,149 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"monochrome", "min-monochrome", "max-monochrome", "resolution", "monochrome", "min-monochrome", "max-monochrome", "resolution",
"min-resolution", "max-resolution", "scan", "grid", "orientation", "min-resolution", "max-resolution", "scan", "grid", "orientation",
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
"pointer", "any-pointer", "hover", "any-hover" "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme"
], mediaFeatures = keySet(mediaFeatures_); ], mediaFeatures = keySet(mediaFeatures_);
var mediaValueKeywords_ = [ var mediaValueKeywords_ = [
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
"interlace", "progressive" "interlace", "progressive",
"dark", "light"
], mediaValueKeywords = keySet(mediaValueKeywords_); ], mediaValueKeywords = keySet(mediaValueKeywords_);
var propertyKeywords_ = [ var propertyKeywords_ = [
"align-content", "align-items", "align-self", "alignment-adjust", "align-content", "align-items", "align-self", "alignment-adjust",
"alignment-baseline", "anchor-point", "animation", "animation-delay", "alignment-baseline", "all", "anchor-point", "animation", "animation-delay",
"animation-direction", "animation-duration", "animation-fill-mode", "animation-direction", "animation-duration", "animation-fill-mode",
"animation-iteration-count", "animation-name", "animation-play-state", "animation-iteration-count", "animation-name", "animation-play-state",
"animation-timing-function", "appearance", "azimuth", "backface-visibility", "animation-timing-function", "appearance", "azimuth", "backdrop-filter",
"background", "background-attachment", "background-blend-mode", "background-clip", "backface-visibility", "background", "background-attachment",
"background-color", "background-image", "background-origin", "background-position", "background-blend-mode", "background-clip", "background-color",
"background-repeat", "background-size", "baseline-shift", "binding", "background-image", "background-origin", "background-position",
"bleed", "bookmark-label", "bookmark-level", "bookmark-state", "background-position-x", "background-position-y", "background-repeat",
"bookmark-target", "border", "border-bottom", "border-bottom-color", "background-size", "baseline-shift", "binding", "bleed", "block-size",
"border-bottom-left-radius", "border-bottom-right-radius", "bookmark-label", "bookmark-level", "bookmark-state", "bookmark-target",
"border-bottom-style", "border-bottom-width", "border-collapse", "border", "border-bottom", "border-bottom-color", "border-bottom-left-radius",
"border-color", "border-image", "border-image-outset", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width",
"border-collapse", "border-color", "border-image", "border-image-outset",
"border-image-repeat", "border-image-slice", "border-image-source", "border-image-repeat", "border-image-slice", "border-image-source",
"border-image-width", "border-left", "border-left-color", "border-image-width", "border-left", "border-left-color", "border-left-style",
"border-left-style", "border-left-width", "border-radius", "border-right", "border-left-width", "border-radius", "border-right", "border-right-color",
"border-right-color", "border-right-style", "border-right-width", "border-right-style", "border-right-width", "border-spacing", "border-style",
"border-spacing", "border-style", "border-top", "border-top-color", "border-top", "border-top-color", "border-top-left-radius",
"border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-right-radius", "border-top-style", "border-top-width",
"border-top-width", "border-width", "bottom", "box-decoration-break", "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing",
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "break-after", "break-before", "break-inside", "caption-side", "caret-color",
"caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count", "clear", "clip", "color", "color-profile", "column-count", "column-fill",
"column-fill", "column-gap", "column-rule", "column-rule-color", "column-gap", "column-rule", "column-rule-color", "column-rule-style",
"column-rule-style", "column-rule-width", "column-span", "column-width", "column-rule-width", "column-span", "column-width", "columns", "contain",
"columns", "content", "counter-increment", "counter-reset", "crop", "cue", "content", "counter-increment", "counter-reset", "crop", "cue", "cue-after",
"cue-after", "cue-before", "cursor", "direction", "display", "cue-before", "cursor", "direction", "display", "dominant-baseline",
"dominant-baseline", "drop-initial-after-adjust", "drop-initial-after-adjust", "drop-initial-after-align",
"drop-initial-after-align", "drop-initial-before-adjust", "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size",
"drop-initial-before-align", "drop-initial-size", "drop-initial-value", "drop-initial-value", "elevation", "empty-cells", "fit", "fit-position",
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow",
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into",
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings", "font", "font-family", "font-feature-settings", "font-kerning",
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust", "font-language-override", "font-optical-sizing", "font-size",
"font-stretch", "font-style", "font-synthesis", "font-variant", "font-size-adjust", "font-stretch", "font-style", "font-synthesis",
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant", "font-variant-alternates", "font-variant-caps",
"font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric",
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "font-variant-position", "font-variation-settings", "font-weight", "gap",
"grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows",
"grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", "grid-column", "grid-column-end", "grid-column-gap", "grid-column-start",
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", "grid-row-start",
"grid-template-rows", "hanging-punctuation", "height", "hyphens", "grid-template", "grid-template-areas", "grid-template-columns",
"icon", "image-orientation", "image-rendering", "image-resolution", "grid-template-rows", "hanging-punctuation", "height", "hyphens", "icon",
"inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing", "image-orientation", "image-rendering", "image-resolution", "inline-box-align",
"line-break", "line-height", "line-stacking", "line-stacking-ruby", "inset", "inset-block", "inset-block-end", "inset-block-start", "inset-inline",
"inset-inline-end", "inset-inline-start", "isolation", "justify-content",
"justify-items", "justify-self", "left", "letter-spacing", "line-break",
"line-height", "line-height-step", "line-stacking", "line-stacking-ruby",
"line-stacking-shift", "line-stacking-strategy", "list-style", "line-stacking-shift", "line-stacking-strategy", "list-style",
"list-style-image", "list-style-position", "list-style-type", "margin", "list-style-image", "list-style-position", "list-style-type", "margin",
"margin-bottom", "margin-left", "margin-right", "margin-top", "margin-bottom", "margin-left", "margin-right", "margin-top", "marks",
"marks", "marquee-direction", "marquee-loop", "marquee-direction", "marquee-loop", "marquee-play-count", "marquee-speed",
"marquee-play-count", "marquee-speed", "marquee-style", "max-height", "marquee-style", "mask-clip", "mask-composite", "mask-image", "mask-mode",
"max-width", "min-height", "min-width", "mix-blend-mode", "move-to", "nav-down", "nav-index", "mask-origin", "mask-position", "mask-repeat", "mask-size","mask-type",
"nav-left", "nav-right", "nav-up", "object-fit", "object-position", "max-block-size", "max-height", "max-inline-size",
"opacity", "order", "orphans", "outline", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width",
"outline-color", "outline-offset", "outline-style", "outline-width", "mix-blend-mode", "move-to", "nav-down", "nav-index", "nav-left", "nav-right",
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y", "nav-up", "object-fit", "object-position", "offset", "offset-anchor",
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top", "offset-distance", "offset-path", "offset-position", "offset-rotate",
"page", "page-break-after", "page-break-before", "page-break-inside", "opacity", "order", "orphans", "outline", "outline-color", "outline-offset",
"page-policy", "pause", "pause-after", "pause-before", "perspective", "outline-style", "outline-width", "overflow", "overflow-style",
"perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position", "overflow-wrap", "overflow-x", "overflow-y", "padding", "padding-bottom",
"presentation-level", "punctuation-trim", "quotes", "region-break-after", "padding-left", "padding-right", "padding-top", "page", "page-break-after",
"region-break-before", "region-break-inside", "region-fragment", "page-break-before", "page-break-inside", "page-policy", "pause",
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness", "pause-after", "pause-before", "perspective", "perspective-origin", "pitch",
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang", "pitch-range", "place-content", "place-items", "place-self", "play-during",
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin", "position", "presentation-level", "punctuation-trim", "quotes",
"shape-outside", "size", "speak", "speak-as", "speak-header", "region-break-after", "region-break-before", "region-break-inside",
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set", "region-fragment", "rendering-intent", "resize", "rest", "rest-after",
"tab-size", "table-layout", "target", "target-name", "target-new", "rest-before", "richness", "right", "rotate", "rotation", "rotation-point",
"target-position", "text-align", "text-align-last", "text-decoration", "row-gap", "ruby-align", "ruby-overhang", "ruby-position", "ruby-span",
"scale", "scroll-behavior", "scroll-margin", "scroll-margin-block",
"scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom",
"scroll-margin-inline", "scroll-margin-inline-end",
"scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right",
"scroll-margin-top", "scroll-padding", "scroll-padding-block",
"scroll-padding-block-end", "scroll-padding-block-start",
"scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end",
"scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right",
"scroll-padding-top", "scroll-snap-align", "scroll-snap-type",
"shape-image-threshold", "shape-inside", "shape-margin", "shape-outside",
"size", "speak", "speak-as", "speak-header", "speak-numeral",
"speak-punctuation", "speech-rate", "stress", "string-set", "tab-size",
"table-layout", "target", "target-name", "target-new", "target-position",
"text-align", "text-align-last", "text-combine-upright", "text-decoration",
"text-decoration-color", "text-decoration-line", "text-decoration-skip", "text-decoration-color", "text-decoration-line", "text-decoration-skip",
"text-decoration-style", "text-emphasis", "text-emphasis-color", "text-decoration-skip-ink", "text-decoration-style", "text-emphasis",
"text-emphasis-position", "text-emphasis-style", "text-height", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style",
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow", "text-height", "text-indent", "text-justify", "text-orientation",
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position", "text-outline", "text-overflow", "text-rendering", "text-shadow",
"text-wrap", "top", "transform", "transform-origin", "transform-style", "text-size-adjust", "text-space-collapse", "text-transform",
"transition", "transition-delay", "transition-duration", "text-underline-position", "text-wrap", "top", "touch-action", "transform", "transform-origin",
"transition-property", "transition-timing-function", "unicode-bidi", "transform-style", "transition", "transition-delay", "transition-duration",
"user-select", "vertical-align", "visibility", "voice-balance", "voice-duration", "transition-property", "transition-timing-function", "translate",
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", "unicode-bidi", "user-select", "vertical-align", "visibility", "voice-balance",
"voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break", "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate",
"word-spacing", "word-wrap", "z-index", "voice-stress", "voice-volume", "volume", "white-space", "widows", "width",
"will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index",
// SVG-specific // SVG-specific
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color", "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events", "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
"color-interpolation", "color-interpolation-filters", "color-interpolation", "color-interpolation-filters",
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering", "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke", "marker", "marker-end", "marker-mid", "marker-start", "paint-order", "shape-rendering", "stroke",
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal", "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
"glyph-orientation-vertical", "text-anchor", "writing-mode" "glyph-orientation-vertical", "text-anchor", "writing-mode",
], propertyKeywords = keySet(propertyKeywords_); ], propertyKeywords = keySet(propertyKeywords_);
var nonStandardPropertyKeywords_ = [ var nonStandardPropertyKeywords_ = [
"border-block", "border-block-color", "border-block-end",
"border-block-end-color", "border-block-end-style", "border-block-end-width",
"border-block-start", "border-block-start-color", "border-block-start-style",
"border-block-start-width", "border-block-style", "border-block-width",
"border-inline", "border-inline-color", "border-inline-end",
"border-inline-end-color", "border-inline-end-style",
"border-inline-end-width", "border-inline-start", "border-inline-start-color",
"border-inline-start-style", "border-inline-start-width",
"border-inline-style", "border-inline-width", "margin-block",
"margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end",
"margin-inline-start", "padding-block", "padding-block-end",
"padding-block-start", "padding-inline", "padding-inline-end",
"padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color",
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color", "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside", "scrollbar-track-color", "searchfield-cancel-button", "searchfield-decoration",
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-button", "searchfield-results-decoration", "shape-inside", "zoom"
"searchfield-results-decoration", "zoom"
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
var fontProperties_ = [ var fontProperties_ = [
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings", "font-display", "font-family", "src", "unicode-range", "font-variant",
"font-stretch", "font-weight", "font-style" "font-feature-settings", "font-stretch", "font-weight", "font-style"
], fontProperties = keySet(fontProperties_); ], fontProperties = keySet(fontProperties_);
var counterDescriptors_ = [ var counterDescriptors_ = [
@ -594,7 +626,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
"arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary",
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
@ -618,7 +650,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
"help", "hidden", "hide", "higher", "highlight", "highlighttext", "help", "hidden", "hide", "higher", "highlight", "highlighttext",
@ -633,7 +665,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d", "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d",
"media-controls-background", "media-current-time-display", "media-controls-background", "media-current-time-display",
"media-fullscreen-button", "media-mute-button", "media-play-button", "media-fullscreen-button", "media-mute-button", "media-play-button",
"media-return-to-realtime-button", "media-rewind-button", "media-return-to-realtime-button", "media-rewind-button",
@ -642,13 +674,13 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"media-volume-slider-container", "media-volume-sliderthumb", "medium", "media-volume-slider-container", "media-volume-sliderthumb", "medium",
"menu", "menulist", "menulist-button", "menulist-text", "menu", "menulist", "menulist-button", "menulist-text",
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize", "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize",
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote", "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter", "painted", "page", "paused", "persian", "perspective", "pinch-zoom", "plus-darker", "plus-lighter",
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
"progress", "push-button", "radial-gradient", "radio", "read-only", "progress", "push-button", "radial-gradient", "radio", "read-only",
"read-write", "read-write-plaintext-only", "rectangle", "region", "read-write", "read-write-plaintext-only", "rectangle", "region",
@ -666,8 +698,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali", "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "square-button", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub",
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
"table-caption", "table-cell", "table-column", "table-column-group", "table-caption", "table-cell", "table-column", "table-column-group",
"table-footer-group", "table-header-group", "table-row", "table-row-group", "table-footer-group", "table-header-group", "table-row", "table-row-group",
"tamil", "tamil",
@ -677,10 +709,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
"trad-chinese-formal", "trad-chinese-informal", "transform", "trad-chinese-formal", "trad-chinese-informal", "transform",
"translate", "translate3d", "translateX", "translateY", "translateZ", "translate", "translate3d", "translateX", "translateY", "translateZ",
"transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up", "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up",
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted",
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
"xx-large", "xx-small" "xx-large", "xx-small"

View File

@ -46,7 +46,7 @@
var word = stream.current(); var word = stream.current();
if (funcs.test(word)) return "builtin"; if (funcs.test(word)) return "builtin";
if (preds.test(word)) return "def"; if (preds.test(word)) return "def";
if (keywords.test(word)) return "keyword"; if (keywords.test(word) || systemKeywords.test(word)) return "keyword";
return "variable"; return "variable";
} }
}; };
@ -67,6 +67,7 @@
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]); var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]); var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]); var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
var systemKeywords = wordRegexp(["access", "active", "assign", "all", "alter", "as", "catalog", "change", "copy", "create", "constraint", "constraints", "current", "database", "databases", "dbms", "default", "deny", "drop", "element", "elements", "exists", "from", "grant", "graph", "graphs", "if", "index", "indexes", "label", "labels", "management", "match", "name", "names", "new", "node", "nodes", "not", "of", "on", "or", "password", "populated", "privileges", "property", "read", "relationship", "relationships", "remove", "replace", "required", "revoke", "role", "roles", "set", "show", "start", "status", "stop", "suspended", "to", "traverse", "type", "types", "user", "users", "with", "write"]);
var operatorChars = /[*+\-<>=&|~%^]/; var operatorChars = /[*+\-<>=&|~%^]/;
return { return {

View File

@ -15,10 +15,10 @@
"implements mixin get native set typedef with enum throw rethrow " + "implements mixin get native set typedef with enum throw rethrow " +
"assert break case continue default in return new deferred async await covariant " + "assert break case continue default in return new deferred async await covariant " +
"try catch finally do else for if switch while import library export " + "try catch finally do else for if switch while import library export " +
"part of show hide is as").split(" "); "part of show hide is as extension on yield late required").split(" ");
var blockKeywords = "try catch finally do else for if switch while".split(" "); var blockKeywords = "try catch finally do else for if switch while".split(" ");
var atoms = "true false null".split(" "); var atoms = "true false null".split(" ");
var builtins = "void bool num int double dynamic var String".split(" "); var builtins = "void bool num int double dynamic var String Null Never".split(" ");
function set(words) { function set(words) {
var obj = {}; var obj = {};

View File

@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE // Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@ -13,189 +13,227 @@
CodeMirror.defineMode("elm", function() { CodeMirror.defineMode("elm", function() {
function switchState(source, setState, f) { function switchState(source, setState, f)
{
setState(f); setState(f);
return f(source, setState); return f(source, setState);
} }
// These should all be Unicode extended, as per the Haskell 2010 report var lowerRE = /[a-z]/;
var smallRE = /[a-z_]/; var upperRE = /[A-Z]/;
var largeRE = /[A-Z]/; var innerRE = /[a-zA-Z0-9_]/;
var digitRE = /[0-9]/; var digitRE = /[0-9]/;
var hexitRE = /[0-9A-Fa-f]/; var hexRE = /[0-9A-Fa-f]/;
var octitRE = /[0-7]/; var symbolRE = /[-&*+.\\/<>=?^|:]/;
var idRE = /[a-z_A-Z0-9\']/; var specialRE = /[(),[\]{}]/;
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/; var spacesRE = /[ \v\f]/; // newlines are handled in tokenizer
var specialRE = /[(),;[\]`{}]/;
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
function normal() { function normal()
return function (source, setState) { {
if (source.eatWhile(whiteCharRE)) { return function(source, setState)
{
if (source.eatWhile(spacesRE))
{
return null; return null;
} }
var ch = source.next(); var char = source.next();
if (specialRE.test(ch)) {
if (ch == '{' && source.eat('-')) { if (specialRE.test(char))
var t = "comment"; {
if (source.eat('#')) t = "meta"; return (char === '{' && source.eat('-'))
return switchState(source, setState, ncomment(t, 1)); ? switchState(source, setState, chompMultiComment(1))
} : (char === '[' && source.match('glsl|'))
return null; ? switchState(source, setState, chompGlsl)
: 'builtin';
} }
if (ch == '\'') { if (char === '\'')
if (source.eat('\\')) {
source.next(); // should handle other escapes here return switchState(source, setState, chompChar);
else
source.next();
if (source.eat('\''))
return "string";
return "error";
} }
if (ch == '"') { if (char === '"')
return switchState(source, setState, stringLiteral); {
return source.eat('"')
? source.eat('"')
? switchState(source, setState, chompMultiString)
: 'string'
: switchState(source, setState, chompSingleString);
} }
if (largeRE.test(ch)) { if (upperRE.test(char))
source.eatWhile(idRE); {
if (source.eat('.')) source.eatWhile(innerRE);
return "qualifier"; return 'variable-2';
return "variable-2";
} }
if (smallRE.test(ch)) { if (lowerRE.test(char))
{
var isDef = source.pos === 1; var isDef = source.pos === 1;
source.eatWhile(idRE); source.eatWhile(innerRE);
return isDef ? "type" : "variable"; return isDef ? "def" : "variable";
} }
if (digitRE.test(ch)) { if (digitRE.test(char))
if (ch == '0') { {
if (source.eat(/[xX]/)) { if (char === '0')
source.eatWhile(hexitRE); // should require at least 1 {
return "integer"; if (source.eat(/[xX]/))
} {
if (source.eat(/[oO]/)) { source.eatWhile(hexRE); // should require at least 1
source.eatWhile(octitRE); // should require at least 1
return "number"; return "number";
} }
} }
else
{
source.eatWhile(digitRE); source.eatWhile(digitRE);
var t = "number"; }
if (source.eat('.')) { if (source.eat('.'))
t = "number"; {
source.eatWhile(digitRE); // should require at least 1 source.eatWhile(digitRE); // should require at least 1
} }
if (source.eat(/[eE]/)) { if (source.eat(/[eE]/))
t = "number"; {
source.eat(/[-+]/); source.eat(/[-+]/);
source.eatWhile(digitRE); // should require at least 1 source.eatWhile(digitRE); // should require at least 1
} }
return t; return "number";
} }
if (symbolRE.test(ch)) { if (symbolRE.test(char))
if (ch == '-' && source.eat(/-/)) { {
source.eatWhile(/-/); if (char === '-' && source.eat('-'))
if (!source.eat(symbolRE)) { {
source.skipToEnd(); source.skipToEnd();
return "comment"; return "comment";
} }
}
source.eatWhile(symbolRE); source.eatWhile(symbolRE);
return "builtin"; return "keyword";
}
if (char === '_')
{
return "keyword";
} }
return "error"; return "error";
} }
} }
function ncomment(type, nest) { function chompMultiComment(nest)
if (nest == 0) { {
if (nest == 0)
{
return normal(); return normal();
} }
return function(source, setState) { return function(source, setState)
var currNest = nest; {
while (!source.eol()) { while (!source.eol())
var ch = source.next(); {
if (ch == '{' && source.eat('-')) { var char = source.next();
++currNest; if (char == '{' && source.eat('-'))
} else if (ch == '-' && source.eat('}')) { {
--currNest; ++nest;
if (currNest == 0) { }
else if (char == '-' && source.eat('}'))
{
--nest;
if (nest === 0)
{
setState(normal()); setState(normal());
return type; return 'comment';
} }
} }
} }
setState(ncomment(type, currNest)); setState(chompMultiComment(nest));
return type; return 'comment';
} }
} }
function stringLiteral(source, setState) { function chompMultiString(source, setState)
while (!source.eol()) { {
var ch = source.next(); while (!source.eol())
if (ch == '"') { {
var char = source.next();
if (char === '"' && source.eat('"') && source.eat('"'))
{
setState(normal()); setState(normal());
return "string"; return 'string';
}
if (ch == '\\') {
if (source.eol() || source.eat(whiteCharRE)) {
setState(stringGap);
return "string";
}
if (!source.eat('&')) source.next(); // should handle other escapes here
} }
} }
setState(normal()); return 'string';
return "error";
} }
function stringGap(source, setState) { function chompSingleString(source, setState)
if (source.eat('\\')) { {
return switchState(source, setState, stringLiteral); while (source.skipTo('\\"')) { source.next(); source.next(); }
} if (source.skipTo('"'))
{
source.next(); source.next();
setState(normal()); setState(normal());
return "error"; return 'string';
}
source.skipToEnd();
setState(normal());
return 'error';
} }
function chompChar(source, setState)
{
while (source.skipTo("\\'")) { source.next(); source.next(); }
if (source.skipTo("'"))
{
source.next();
setState(normal());
return 'string';
}
source.skipToEnd();
setState(normal());
return 'error';
}
var wellKnownWords = (function() { function chompGlsl(source, setState)
var wkw = {}; {
while (!source.eol())
var keywords = [ {
"case", "of", "as", var char = source.next();
"if", "then", "else", if (char === '|' && source.eat(']'))
"let", "in", {
"infix", "infixl", "infixr", setState(normal());
"type", "alias", return 'string';
"input", "output", "foreign", "loopback", }
"module", "where", "import", "exposing", }
"_", "..", "|", ":", "=", "\\", "\"", "->", "<-" return 'string';
]; }
for (var i = keywords.length; i--;)
wkw[keywords[i]] = "keyword";
return wkw;
})();
var wellKnownWords = {
case: 1,
of: 1,
as: 1,
if: 1,
then: 1,
else: 1,
let: 1,
in: 1,
type: 1,
alias: 1,
module: 1,
where: 1,
import: 1,
exposing: 1,
port: 1
};
return { return {
startState: function () { return { f: normal() }; }, startState: function () { return { f: normal() }; },
copyState: function (s) { return { f: s.f }; }, copyState: function (s) { return { f: s.f }; },
token: function(stream, state) { token: function(stream, state) {
var t = state.f(stream, function(s) { state.f = s; }); var type = state.f(stream, function(s) { state.f = s; });
var w = stream.current(); var word = stream.current();
return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t; return (wellKnownWords.hasOwnProperty(word)) ? 'keyword' : type;
} }
}; };

View File

@ -62,7 +62,7 @@
if (!parserConfig || !parserConfig.base) return handlebars; if (!parserConfig || !parserConfig.base) return handlebars;
return CodeMirror.multiplexingMode( return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, parserConfig.base), CodeMirror.getMode(config, parserConfig.base),
{open: "{{", close: "}}", mode: handlebars, parseDelimiters: true} {open: "{{", close: /\}\}\}?/, mode: handlebars, parseDelimiters: true}
); );
}); });

View File

@ -98,9 +98,15 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} else if (ch == "`") { } else if (ch == "`") {
state.tokenize = tokenQuasi; state.tokenize = tokenQuasi;
return tokenQuasi(stream, state); return tokenQuasi(stream, state);
} else if (ch == "#") { } else if (ch == "#" && stream.peek() == "!") {
stream.skipToEnd(); stream.skipToEnd();
return ret("error", "error"); return ret("meta", "meta");
} else if (ch == "#" && stream.eatWhile(wordRE)) {
return ret("variable", "property")
} else if (ch == "<" && stream.match("!--") ||
(ch == "-" && stream.match("->") && !/\S/.test(stream.string.slice(0, stream.start)))) {
stream.skipToEnd()
return ret("comment", "comment")
} else if (isOperatorChar.test(ch)) { } else if (isOperatorChar.test(ch)) {
if (ch != ">" || !state.lexical || state.lexical.type != ">") { if (ch != ">" || !state.lexical || state.lexical.type != ">") {
if (stream.eat("=")) { if (stream.eat("=")) {
@ -110,6 +116,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (ch == ">") stream.eat(ch) if (ch == ">") stream.eat(ch)
} }
} }
if (ch == "?" && stream.eat(".")) return ret(".")
return ret("operator", "operator", stream.current()); return ret("operator", "operator", stream.current());
} else if (wordRE.test(ch)) { } else if (wordRE.test(ch)) {
stream.eatWhile(wordRE); stream.eatWhile(wordRE);
@ -414,7 +421,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} }
function parenExpr(type) { function parenExpr(type) {
if (type != "(") return pass() if (type != "(") return pass()
return cont(pushlex(")"), expression, expect(")"), poplex) return cont(pushlex(")"), maybeexpression, expect(")"), poplex)
} }
function expressionInner(type, value, noComma) { function expressionInner(type, value, noComma) {
if (cx.state.fatArrowAt == cx.stream.start) { if (cx.state.fatArrowAt == cx.stream.start) {
@ -443,7 +450,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} }
function maybeoperatorComma(type, value) { function maybeoperatorComma(type, value) {
if (type == ",") return cont(expression); if (type == ",") return cont(maybeexpression);
return maybeoperatorNoComma(type, value, false); return maybeoperatorNoComma(type, value, false);
} }
function maybeoperatorNoComma(type, value, noComma) { function maybeoperatorNoComma(type, value, noComma) {
@ -452,7 +459,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
if (type == "operator") { if (type == "operator") {
if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me); if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false)) if (isTS && value == "<" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/, false))
return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me); return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
if (value == "?") return cont(expression, expect(":"), expr); if (value == "?") return cont(expression, expect(":"), expr);
return cont(expr); return cont(expr);
@ -754,11 +761,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} }
if (type == "variable" || cx.style == "keyword") { if (type == "variable" || cx.style == "keyword") {
cx.marked = "property"; cx.marked = "property";
return cont(isTS ? classfield : functiondef, classBody); return cont(classfield, classBody);
} }
if (type == "number" || type == "string") return cont(isTS ? classfield : functiondef, classBody); if (type == "number" || type == "string") return cont(classfield, classBody);
if (type == "[") if (type == "[")
return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody) return cont(expression, maybetype, expect("]"), classfield, classBody)
if (value == "*") { if (value == "*") {
cx.marked = "keyword"; cx.marked = "keyword";
return cont(classBody); return cont(classBody);

View File

@ -127,16 +127,14 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
} }
if (inArray(state) && ch === ']') { if (inArray(state) && ch === ']') {
if (currentScope(state) === "if") { state.scopes.pop(); } while (state.scopes.length && currentScope(state) !== "[") { state.scopes.pop(); }
while (currentScope(state) === "for") { state.scopes.pop(); }
state.scopes.pop(); state.scopes.pop();
state.nestedArrays--; state.nestedArrays--;
state.leavingExpr = true; state.leavingExpr = true;
} }
if (inGenerator(state) && ch === ')') { if (inGenerator(state) && ch === ')') {
if (currentScope(state) === "if") { state.scopes.pop(); } while (state.scopes.length && currentScope(state) !== "(") { state.scopes.pop(); }
while (currentScope(state) === "for") { state.scopes.pop(); }
state.scopes.pop(); state.scopes.pop();
state.nestedGenerators--; state.nestedGenerators--;
state.leavingExpr = true; state.leavingExpr = true;
@ -186,16 +184,14 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
if (stream.match(/^\.?\d/, false)) { if (stream.match(/^\.?\d/, false)) {
var imMatcher = RegExp(/^im\b/); var imMatcher = RegExp(/^im\b/);
var numberLiteral = false; var numberLiteral = false;
// Floats
if (stream.match(/^(?:(?:\d[_\d]*)?\.(?!\.)(?:\d[_\d]*)?|\d[_\d]*\.(?!\.)(?:\d[_\d]*))?([Eef][\+\-]?[_\d]+)?/i)) { numberLiteral = true; }
if (stream.match(/^0x\.[0-9a-f_]+p[\+\-]?[_\d]+/i)) { numberLiteral = true; } if (stream.match(/^0x\.[0-9a-f_]+p[\+\-]?[_\d]+/i)) { numberLiteral = true; }
// Integers // Integers
if (stream.match(/^0x[0-9a-f_]+/i)) { numberLiteral = true; } // Hex if (stream.match(/^0x[0-9a-f_]+/i)) { numberLiteral = true; } // Hex
if (stream.match(/^0b[01_]+/i)) { numberLiteral = true; } // Binary if (stream.match(/^0b[01_]+/i)) { numberLiteral = true; } // Binary
if (stream.match(/^0o[0-7_]+/i)) { numberLiteral = true; } // Octal if (stream.match(/^0o[0-7_]+/i)) { numberLiteral = true; } // Octal
if (stream.match(/^[1-9][_\d]*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal // Floats
// Zero by itself with no other piece of number. if (stream.match(/^(?:(?:\d[_\d]*)?\.(?!\.)(?:\d[_\d]*)?|\d[_\d]*\.(?!\.)(?:\d[_\d]*))?([Eef][\+\-]?[_\d]+)?/i)) { numberLiteral = true; }
if (stream.match(/^0(?![\dx])/i)) { numberLiteral = true; } if (stream.match(/^\d[_\d]*(e[\+\-]?\d+)?/i)) { numberLiteral = true; } // Decimal
if (numberLiteral) { if (numberLiteral) {
// Integer literals may be "long" // Integer literals may be "long"
stream.match(imMatcher); stream.match(imMatcher);
@ -405,9 +401,9 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
indent: function(state, textAfter) { indent: function(state, textAfter) {
var delta = 0; var delta = 0;
if ( textAfter === ']' || textAfter === ')' || textAfter === "end" || if ( textAfter === ']' || textAfter === ')' || /^end\b/.test(textAfter) ||
textAfter === "else" || textAfter === "catch" || textAfter === "elseif" || /^else/.test(textAfter) || /^catch\b/.test(textAfter) || /^elseif\b/.test(textAfter) ||
textAfter === "finally" ) { /^finally/.test(textAfter) ) {
delta = -1; delta = -1;
} }
return (state.scopes.length + delta) * config.indentUnit; return (state.scopes.length + delta) * config.indentUnit;

View File

@ -48,6 +48,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (modeCfg.fencedCodeBlockHighlighting === undefined) if (modeCfg.fencedCodeBlockHighlighting === undefined)
modeCfg.fencedCodeBlockHighlighting = true; modeCfg.fencedCodeBlockHighlighting = true;
if (modeCfg.fencedCodeBlockDefaultMode === undefined)
modeCfg.fencedCodeBlockDefaultMode = 'text/plain';
if (modeCfg.xml === undefined) if (modeCfg.xml === undefined)
modeCfg.xml = true; modeCfg.xml = true;
@ -87,9 +90,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
, listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/ , listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
, taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE , taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/ , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/ , setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/
, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/ , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/ , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/
, linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
, punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/ , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
, expandedTab = " " // CommonMark specifies tab as 4 spaces , expandedTab = " " // CommonMark specifies tab as 4 spaces
@ -162,12 +165,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (state.indentationDiff === null) { if (state.indentationDiff === null) {
state.indentationDiff = state.indentation; state.indentationDiff = state.indentation;
if (prevLineIsList) { 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; state.list = null;
// While this list item's marker's indentation is less than the deepest // While this list item's marker's indentation is less than the deepest
// list item's content's indentation,pop the deepest list item // list item's content's indentation,pop the deepest list item
@ -226,6 +223,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// Add this list item's content's indentation to the stack // Add this list item's content's indentation to the stack
state.listStack.push(state.indentation); state.listStack.push(state.indentation);
// Reset inline styles which shouldn't propagate aross list items
state.em = false;
state.strong = false;
state.code = false;
state.strikethrough = false;
if (modeCfg.taskLists && stream.match(taskListRE, false)) { if (modeCfg.taskLists && stream.match(taskListRE, false)) {
state.taskList = true; state.taskList = true;
@ -237,7 +239,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.quote = 0; state.quote = 0;
state.fencedEndRE = new RegExp(match[1] + "+ *$"); state.fencedEndRE = new RegExp(match[1] + "+ *$");
// try switching mode // try switching mode
state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]); state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );
if (state.localMode) state.localState = CodeMirror.startState(state.localMode); if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
state.f = state.block = local; state.f = state.block = local;
if (modeCfg.highlightFormatting) state.formatting = "code-block"; if (modeCfg.highlightFormatting) state.formatting = "code-block";

View File

@ -24,7 +24,7 @@
{name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
{name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
{name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]}, {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
{name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists.txt$/}, {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/},
{name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
{name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
@ -55,7 +55,7 @@
{name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
{name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i}, {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history)\.md$/i},
{name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
{name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/}, {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
{name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
@ -70,7 +70,7 @@
{name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]}, {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
{name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
{name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
{name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript", "application/javascript;env=frontend", "application/javascript;env=backend"], {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
{name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
@ -84,7 +84,7 @@
{name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
{name: "mIRC", mime: "text/mirc", mode: "mirc"}, {name: "mIRC", mime: "text/mirc", mode: "mirc"},
{name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
{name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]}, {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]},
{name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]}, {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
@ -94,7 +94,8 @@
{name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]}, {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
{name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"], {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
mode: "ntriples", ext: ["nt", "nq"]}, 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"], alias: ["objective-c", "objc"]},
{name: "Objective-C++", mime: "text/x-objectivec++", mode: "clike", ext: ["mm"], alias: ["objective-c++", "objc++"]},
{name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
{name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
{name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]}, {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
@ -134,7 +135,7 @@
{name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
{name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
{name: "SQLite", mimes: ["text/x-sqlite", "text/x-sqlite;schema=trilium"], mode: "sql"}, {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
{name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]}, {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
{name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]}, {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
{name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]}, {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
@ -143,7 +144,7 @@
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]}, {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
{name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
{name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
{name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
{name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
{name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
{name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
@ -189,6 +190,7 @@
}; };
CodeMirror.findModeByExtension = function(ext) { CodeMirror.findModeByExtension = function(ext) {
ext = ext.toLowerCase();
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
var info = CodeMirror.modeInfo[i]; var info = CodeMirror.modeInfo[i];
if (info.ext) for (var j = 0; j < info.ext.length; j++) if (info.ext) for (var j = 0; j < info.ext.length; j++)

View File

@ -31,7 +31,7 @@ CodeMirror.defineSimpleMode("nsis",{
{regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true}, {regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
// Runtime Commands // 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|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*(?: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|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|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|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|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)?)\b/, token: "keyword", indent: true},
{regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true}, {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},

View File

@ -17,7 +17,7 @@ CodeMirror.defineMode("octave", function() {
} }
var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"); var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]");
var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;]'); var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;\\.]');
var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"); var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))");
var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"); var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))");
var tripleDelimiters = new RegExp("^((>>=)|(<<=))"); var tripleDelimiters = new RegExp("^((>>=)|(<<=))");

View File

@ -50,7 +50,11 @@ CodeMirror.defineMode("pascal", function() {
state.tokenize = tokenComment; state.tokenize = tokenComment;
return tokenComment(stream, state); return tokenComment(stream, state);
} }
if (/[\[\]{}\(\),;\:\.]/.test(ch)) { if (ch == "{") {
state.tokenize = tokenCommentBraces;
return tokenCommentBraces(stream, state);
}
if (/[\[\]\(\),;\:\.]/.test(ch)) {
return null; return null;
} }
if (/\d/.test(ch)) { if (/\d/.test(ch)) {
@ -98,6 +102,17 @@ CodeMirror.defineMode("pascal", function() {
return "comment"; return "comment";
} }
function tokenCommentBraces(stream, state) {
var ch;
while (ch = stream.next()) {
if (ch == "}") {
state.tokenize = null;
break;
}
}
return "comment";
}
// Interface // Interface
return { return {

View File

@ -38,7 +38,7 @@ CodeMirror.defineMode('powershell', function() {
/param|process|return|switch|throw|trap|try|until|where|while/ /param|process|return|switch|throw|trap|try|until|where|while/
], { suffix: notCharacterOrDash }); ], { suffix: notCharacterOrDash });
var punctuation = /[\[\]{},;`\.]|@[({]/; var punctuation = /[\[\]{},;`\\\.]|@[({]/;
var wordOperators = buildRegexp([ var wordOperators = buildRegexp([
'f', 'f',
/b?not/, /b?not/,

View File

@ -62,7 +62,10 @@
}; };
CodeMirror.defineMode("protobuf", function() { CodeMirror.defineMode("protobuf", function() {
return {token: tokenBase}; return {
token: tokenBase,
fold: "brace"
};
}); });
CodeMirror.defineMIME("text/x-protobuf", "protobuf"); CodeMirror.defineMIME("text/x-protobuf", "protobuf");

View File

@ -545,12 +545,12 @@ CodeMirror.defineMode("pug", function (config) {
|| javaScriptArguments(stream, state) || javaScriptArguments(stream, state)
|| callArguments(stream, state) || callArguments(stream, state)
|| yieldStatement(stream, state) || yieldStatement(stream)
|| doctype(stream, state) || doctype(stream)
|| interpolation(stream, state) || interpolation(stream, state)
|| caseStatement(stream, state) || caseStatement(stream, state)
|| when(stream, state) || when(stream, state)
|| defaultStatement(stream, state) || defaultStatement(stream)
|| extendsStatement(stream, state) || extendsStatement(stream, state)
|| append(stream, state) || append(stream, state)
|| prepend(stream, state) || prepend(stream, state)
@ -565,16 +565,16 @@ CodeMirror.defineMode("pug", function (config) {
|| tag(stream, state) || tag(stream, state)
|| filter(stream, state) || filter(stream, state)
|| code(stream, state) || code(stream, state)
|| id(stream, state) || id(stream)
|| className(stream, state) || className(stream)
|| attrs(stream, state) || attrs(stream, state)
|| attributesBlock(stream, state) || attributesBlock(stream, state)
|| indent(stream, state) || indent(stream)
|| text(stream, state) || text(stream, state)
|| comment(stream, state) || comment(stream, state)
|| colon(stream, state) || colon(stream)
|| dot(stream, state) || dot(stream, state)
|| fail(stream, state); || fail(stream);
return tok === true ? null : tok; return tok === true ? null : tok;
} }

View File

@ -42,7 +42,7 @@
var ERRORCLASS = "error"; var ERRORCLASS = "error";
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/; var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
// (Backwards-compatiblity with old, cumbersome config system) // (Backwards-compatibility with old, cumbersome config system)
var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters, var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/] parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]
for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1) for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
@ -98,11 +98,11 @@
return tokenBaseInner(stream, state); return tokenBaseInner(stream, state);
} }
function tokenBaseInner(stream, state) { function tokenBaseInner(stream, state, inFormat) {
if (stream.eatSpace()) return null; if (stream.eatSpace()) return null;
// Handle Comments // Handle Comments
if (stream.match(/^#.*/)) return "comment"; if (!inFormat && stream.match(/^#.*/)) return "comment";
// Handle Number Literals // Handle Number Literals
if (stream.match(/^[0-9\.]/, false)) { if (stream.match(/^[0-9\.]/, false)) {
@ -177,7 +177,7 @@
// Handle non-detected items // Handle non-detected items
stream.next(); stream.next();
return ERRORCLASS; return inFormat ? null :ERRORCLASS;
} }
function formatStringFactory(delimiter, tokenOuter) { function formatStringFactory(delimiter, tokenOuter) {
@ -189,7 +189,7 @@
function tokenNestedExpr(depth) { function tokenNestedExpr(depth) {
return function(stream, state) { return function(stream, state) {
var inner = tokenBaseInner(stream, state) var inner = tokenBaseInner(stream, state, true)
if (inner == "punctuation") { if (inner == "punctuation") {
if (stream.current() == "{") { if (stream.current() == "{") {
state.tokenize = tokenNestedExpr(depth + 1) state.tokenize = tokenNestedExpr(depth + 1)

View File

@ -25,8 +25,8 @@ CodeMirror.defineSimpleMode("rust",{
{regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/, {regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/,
token: "number"}, token: "number"},
{regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]}, {regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type|union)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]},
{regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"}, {regex: /(?:abstract|alignof|as|async|await|box|break|continue|const|crate|do|dyn|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"},
{regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"}, {regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"},
{regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"}, {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"},
{regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, {regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/,

View File

@ -88,7 +88,7 @@
define('def', 'source2 nosource2 page pageno pagesize', ['ALL']); define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
//proc and datastep //proc and datastep
define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']); define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddfm ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau random ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni rcorr read recfm register regr remote remove rename repeat repeated replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover sub subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']);
define('operator', 'and not ', ['inDataStep', 'inProc']); define('operator', 'and not ', ['inDataStep', 'inProc']);
// Main function // Main function

View File

@ -21,7 +21,6 @@
"@inject": paramData, "@inject": paramData,
"@inject?": paramData, "@inject?": paramData,
"@state": paramData, "@state": paramData,
"@state?": paramData,
"template": { soyState: "templ-def", variableScope: true}, "template": { soyState: "templ-def", variableScope: true},
"literal": { }, "literal": { },
"msg": {}, "msg": {},
@ -35,9 +34,9 @@
"switch": {}, "switch": {},
"case": { noEndTag: true, reduceIndent: true}, "case": { noEndTag: true, reduceIndent: true},
"default": { noEndTag: true, reduceIndent: true}, "default": { noEndTag: true, reduceIndent: true},
"foreach": { variableScope: true, soyState: "var-def" }, "foreach": { variableScope: true, soyState: "for-loop" },
"ifempty": { noEndTag: true, reduceIndent: true}, "ifempty": { noEndTag: true, reduceIndent: true},
"for": { variableScope: true, soyState: "var-def" }, "for": { variableScope: true, soyState: "for-loop" },
"call": { soyState: "templ-ref" }, "call": { soyState: "templ-ref" },
"param": { soyState: "param-ref"}, "param": { soyState: "param-ref"},
"print": { noEndTag: true }, "print": { noEndTag: true },
@ -126,16 +125,55 @@
this.scope = scope; this.scope = scope;
} }
function expression(stream, state) {
var match;
if (stream.match(/[[]/)) {
state.soyState.push("list-literal");
state.context = new Context(state.context, "list-literal", state.variables);
state.lookupVariables = false;
return null;
} else if (stream.match(/map\b/)) {
state.soyState.push("map-literal");
return "keyword";
} else if (stream.match(/record\b/)) {
state.soyState.push("record-literal");
return "keyword";
} else if (stream.match(/([\w]+)(?=\()/)) {
return "variable callee";
} else if (match = stream.match(/^["']/)) {
state.soyState.push("string");
state.quoteKind = match[0];
return "string";
} else if (stream.match(/^[(]/)) {
state.soyState.push("open-parentheses");
return null;
} else if (stream.match(/(null|true|false)(?!\w)/) ||
stream.match(/0x([0-9a-fA-F]{2,})/) ||
stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
return "atom";
} else if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
// Tokenize filter, binary, null propagator, and equality operators.
return "operator";
} else if (match = stream.match(/^\$([\w]+)/)) {
return ref(state.variables, match[1], !state.lookupVariables);
} else if (match = stream.match(/^\w+/)) {
return /^(?:as|and|or|not|in|if)$/.test(match[0]) ? "keyword" : null;
}
stream.next();
return null;
}
return { return {
startState: function() { startState: function() {
return { return {
soyState: [], soyState: [],
templates: null,
variables: prepend(null, 'ij'), variables: prepend(null, 'ij'),
scopes: null, scopes: null,
indent: 0, indent: 0,
quoteKind: null, quoteKind: null,
context: null, context: null,
lookupVariables: true, // Is unknown variables considered an error
localStates: [{ localStates: [{
mode: modes.html, mode: modes.html,
state: CodeMirror.startState(modes.html) state: CodeMirror.startState(modes.html)
@ -147,11 +185,11 @@
return { return {
tag: state.tag, // Last seen Soy tag. tag: state.tag, // Last seen Soy tag.
soyState: state.soyState.concat([]), soyState: state.soyState.concat([]),
templates: state.templates,
variables: state.variables, variables: state.variables,
context: state.context, context: state.context,
indent: state.indent, // Indentation of the following line. indent: state.indent, // Indentation of the following line.
quoteKind: state.quoteKind, quoteKind: state.quoteKind,
lookupVariables: state.lookupVariables,
localStates: state.localStates.map(function(localState) { localStates: state.localStates.map(function(localState) {
return { return {
mode: localState.mode, mode: localState.mode,
@ -203,7 +241,6 @@
switch (last(state.soyState)) { switch (last(state.soyState)) {
case "templ-def": case "templ-def":
if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) { if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) {
state.templates = prepend(state.templates, match[1]);
state.soyState.pop(); state.soyState.pop();
return "def"; return "def";
} }
@ -220,6 +257,11 @@
// Otherwise // Otherwise
return "variable"; return "variable";
} }
if (match = stream.match(/^\$([\w]+)/)) {
state.soyState.pop();
return ref(state.variables, match[1], !state.lookupVariables);
}
stream.next(); stream.next();
return null; return null;
@ -249,17 +291,71 @@
stream.next(); stream.next();
return null; return null;
case "param-type": case "open-parentheses":
if (stream.peek() == "}") { if (stream.match(/[)]/)) {
state.soyState.pop(); state.soyState.pop();
return null; return null;
} }
if (stream.eatWhile(/^([\w]+|[?])/)) { return expression(stream, state);
case "param-type":
var peekChar = stream.peek();
if ("}]=>,".indexOf(peekChar) != -1) {
state.soyState.pop();
return null;
} else if (peekChar == "[") {
state.soyState.push('param-type-record');
return null;
} else if (peekChar == "(") {
state.soyState.push('param-type-template');
return null;
} else if (peekChar == "<") {
state.soyState.push('param-type-parameter');
return null;
} else if (match = stream.match(/^([\w]+|[?])/)) {
return "type"; return "type";
} }
stream.next(); stream.next();
return null; return null;
case "param-type-record":
var peekChar = stream.peek();
if (peekChar == "]") {
state.soyState.pop();
return null;
}
if (stream.match(/^\w+/)) {
state.soyState.push('param-type');
return "property";
}
stream.next();
return null;
case "param-type-parameter":
if (stream.match(/^[>]/)) {
state.soyState.pop();
return null;
}
if (stream.match(/^[<,]/)) {
state.soyState.push('param-type');
return null;
}
stream.next();
return null;
case "param-type-template":
if (stream.match(/[>]/)) {
state.soyState.pop();
state.soyState.push('param-type');
return null;
}
if (stream.match(/^\w+/)) {
state.soyState.push('param-type');
return "def";
}
stream.next();
return null;
case "var-def": case "var-def":
if (match = stream.match(/^\$([\w]+)/)) { if (match = stream.match(/^\$([\w]+)/)) {
state.variables = prepend(state.variables, match[1]); state.variables = prepend(state.variables, match[1]);
@ -269,6 +365,96 @@
stream.next(); stream.next();
return null; return null;
case "for-loop":
if (stream.match(/\bin\b/)) {
state.soyState.pop();
return "keyword";
}
if (stream.peek() == "$") {
state.soyState.push('var-def');
return null;
}
stream.next();
return null;
case "record-literal":
if (stream.match(/^[)]/)) {
state.soyState.pop();
return null;
}
if (stream.match(/[(,]/)) {
state.soyState.push("map-value")
state.soyState.push("record-key")
return null;
}
stream.next()
return null;
case "map-literal":
if (stream.match(/^[)]/)) {
state.soyState.pop();
return null;
}
if (stream.match(/[(,]/)) {
state.soyState.push("map-value")
state.soyState.push("map-value")
return null;
}
stream.next()
return null;
case "list-literal":
if (stream.match(/\]/)) {
state.soyState.pop();
state.lookupVariables = true;
popcontext(state);
return null;
}
if (stream.match(/\bfor\b/)) {
state.lookupVariables = true;
state.soyState.push('for-loop');
return "keyword";
}
return expression(stream, state);
case "record-key":
if (stream.match(/[\w]+/)) {
return "property";
}
if (stream.match(/^[:]/)) {
state.soyState.pop();
return null;
}
stream.next();
return null;
case "map-value":
if (stream.peek() == ")" || stream.peek() == "," || stream.match(/^[:)]/)) {
state.soyState.pop();
return null;
}
return expression(stream, state);
case "import":
if (stream.eat(";")) {
state.soyState.pop();
state.indent -= 2 * config.indentUnit;
return null;
}
if (stream.match(/\w+(?=\s+as)/)) {
return "variable";
}
if (match = stream.match(/\w+/)) {
return /(from|as)/.test(match[0]) ? "keyword" : "def";
}
if (match = stream.match(/^["']/)) {
state.soyState.push("string");
state.quoteKind = match[0];
return "string";
}
stream.next();
return null;
case "tag": case "tag":
var endTag = state.tag[0] == "/"; var endTag = state.tag[0] == "/";
var tagName = endTag ? state.tag.substring(1) : state.tag; var tagName = endTag ? state.tag.substring(1) : state.tag;
@ -288,7 +474,7 @@
state.soyState.pop(); state.soyState.pop();
return "keyword"; return "keyword";
} else if (stream.match(/^([\w?]+)(?==)/)) { } else if (stream.match(/^([\w?]+)(?==)/)) {
if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { if (state.context && state.context.tag == tagName && stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) {
var kind = match[1]; var kind = match[1];
state.context.kind = kind; state.context.kind = kind;
var mode = modes[kind] || modes.html; var mode = modes[kind] || modes.html;
@ -302,34 +488,11 @@
}); });
} }
return "attribute"; return "attribute";
} else if (match = stream.match(/([\w]+)(?=\()/)) {
return "variable callee";
} else if (match = stream.match(/^["']/)) {
state.soyState.push("string");
state.quoteKind = match;
return "string";
} }
if (stream.match(/(null|true|false)(?!\w)/) || return expression(stream, state);
stream.match(/0x([0-9a-fA-F]{2,})/) ||
stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
return "atom";
}
if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
// Tokenize filter, binary, null propagator, and equality operators.
return "operator";
}
if (match = stream.match(/^\$([\w]+)/)) {
return ref(state.variables, match[1]);
}
if (match = stream.match(/^\w+/)) {
return /^(?:as|and|or|not|in)$/.test(match[0]) ? "keyword" : null;
}
stream.next();
return null;
case "literal": case "literal":
if (stream.match(/^(?=\{\/literal})/)) { if (stream.match(/^(?=\{\/literal})/)) {
state.indent -= config.indentUnit;
state.soyState.pop(); state.soyState.pop();
return this.token(stream, state); return this.token(stream, state);
} }
@ -389,6 +552,10 @@
state.indent += 2 * config.indentUnit; state.indent += 2 * config.indentUnit;
state.soyState.push("tag"); state.soyState.push("tag");
return "keyword"; return "keyword";
} else if (!state.context && stream.match(/\bimport\b/)) {
state.soyState.push("import");
state.indent += 2 * config.indentUnit;
return "keyword";
} }
return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);

View File

@ -65,6 +65,14 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// charset casting: _utf8'str', N'str', n'str' // charset casting: _utf8'str', N'str', n'str'
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
return "keyword"; return "keyword";
} else if (support.escapeConstant && (ch == "e" || ch == "E")
&& (stream.peek() == "'" || (stream.peek() == '"' && support.doubleQuote))) {
// escape constant: E'str', e'str'
// ref: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
state.tokenize = function(stream, state) {
return (state.tokenize = tokenLiteral(stream.next(), true))(stream, state);
}
return "keyword";
} else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
// 1-line comment // 1-line comment
stream.skipToEnd(); stream.skipToEnd();
@ -88,7 +96,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
return null return null
// .table_name (ODBC) // .table_name (ODBC)
// // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
if (support.ODBCdotTable && stream.match(/^[\w\d_]+/)) if (support.ODBCdotTable && stream.match(/^[\w\d_$#]+/))
return "variable-2"; return "variable-2";
} else if (operatorChars.test(ch)) { } else if (operatorChars.test(ch)) {
// operators // operators
@ -122,7 +130,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
} }
// 'string', with char specified in quote escaped by '\' // 'string', with char specified in quote escaped by '\'
function tokenLiteral(quote) { function tokenLiteral(quote, backslashEscapes) {
return function(stream, state) { return function(stream, state) {
var escaped = false, ch; var escaped = false, ch;
while ((ch = stream.next()) != null) { while ((ch = stream.next()) != null) {
@ -130,7 +138,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
state.tokenize = tokenBase; state.tokenize = tokenBase;
break; break;
} }
escaped = backslashStringEscapes && !escaped && ch == "\\"; escaped = (backslashStringEscapes || backslashEscapes) && !escaped && ch == "\\";
} }
return "string"; return "string";
}; };
@ -413,8 +421,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"), builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
atoms: set("false true null unknown"), atoms: set("false true null unknown"),
operatorChars: /^[*\/+\-%<>!=&|^\/#@?~]/, operatorChars: /^[*\/+\-%<>!=&|^\/#@?~]/,
backslashStringEscapes: false,
dateSQL: set("date time timestamp"), dateSQL: set("date time timestamp"),
support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast") support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")
}); });
// Google's SQL-like query language, GQL // Google's SQL-like query language, GQL

View File

@ -103,7 +103,7 @@
// Do we look like '\command' ? If so, attempt to apply the plugin 'command' // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
if (source.match(/^\\[a-zA-Z@]+/)) { if (source.match(/^\\[a-zA-Z@]+/)) {
var cmdName = source.current().slice(1); var cmdName = source.current().slice(1);
plug = plugins[cmdName] || plugins["DEFAULT"]; plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
plug = new plug(); plug = new plug();
pushCommand(state, plug); pushCommand(state, plug);
setState(state, beginParams); setState(state, beginParams);

View File

@ -76,7 +76,7 @@
if (ch == "#") { if (ch == "#") {
stream.next(); stream.next();
// Hex color // Hex color
if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b/i)) { if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b(?!-)/i)) {
return ["atom", "atom"]; return ["atom", "atom"];
} }
// ID selector // ID selector

View File

@ -131,7 +131,8 @@ CodeMirror.defineMode("tcl", function() {
token: function(stream, state) { token: function(stream, state) {
if (stream.eatSpace()) return null; if (stream.eatSpace()) return null;
return state.tokenize(stream, state); return state.tokenize(stream, state);
} },
lineComment: "#"
}; };
}); });
CodeMirror.defineMIME("text/x-tcl", "tcl"); CodeMirror.defineMIME("text/x-tcl", "tcl");

View File

@ -369,7 +369,8 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
blockCommentStart: "/*", blockCommentStart: "/*",
blockCommentEnd: "*/", blockCommentEnd: "*/",
lineComment: "//" lineComment: "//",
fold: "indent"
}; };
}); });

41
libraries/codemirror/mode/wast/wast.js vendored Normal file
View File

@ -0,0 +1,41 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineSimpleMode('wast', {
start: [
{regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
{regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|func|param|result|local|global|module|table|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]/, token: "keyword"},
{regex: /\b(anyfunc|[fi](32|64))\b/, token: "atom"},
{regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
{regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
{regex: /\(;.*?/, token: "comment", next: "comment"},
{regex: /;;.*$/, token: "comment"},
{regex: /\(/, indent: true},
{regex: /\)/, dedent: true},
],
comment: [
{regex: /.*?;\)/, token: "comment", next: "start"},
{regex: /.*/, token: "comment"},
],
meta: {
dontIndentStates: ['comment'],
},
});
// https://github.com/WebAssembly/design/issues/981 mentions text/webassembly,
// which seems like a reasonable choice, although it's not standard right now.
CodeMirror.defineMIME("text/webassembly", "wast");
});

View File

@ -390,6 +390,17 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
skipAttribute: function(state) { skipAttribute: function(state) {
if (state.state == attrValueState) if (state.state == attrValueState)
state.state = attrState state.state = attrState
},
xmlCurrentTag: function(state) {
return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
},
xmlCurrentContext: function(state) {
var context = []
for (var cx = state.context; cx; cx = cx.prev)
if (cx.tagName) context.push(cx.tagName)
return context.reverse()
} }
}; };
}); });

View File

@ -45,7 +45,7 @@
return innerMode.token(stream, state.inner) return innerMode.token(stream, state.inner)
} }
} else if (state.state == FRONTMATTER) { } else if (state.state == FRONTMATTER) {
var end = stream.sol() && stream.match(/---/, false) var end = stream.sol() && stream.match(/(---|\.\.\.)/, false)
var style = yamlMode.token(stream, state.inner) var style = yamlMode.token(stream, state.inner)
if (end) { if (end) {
state.state = BODY state.state = BODY

14
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.44.2-beta", "version": "0.44.3-beta",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -11,9 +11,9 @@
"dev": true "dev": true
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.10.5", "version": "7.11.5",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz",
"integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==", "integrity": "sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==",
"dev": true "dev": true
}, },
"@babel/runtime": { "@babel/runtime": {
@ -5355,9 +5355,9 @@
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
}, },
"jsdoc": { "jsdoc": {
"version": "3.6.5", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.5.tgz", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.6.tgz",
"integrity": "sha512-SbY+i9ONuxSK35cgVHaI8O9senTE4CDYAmGSDJ5l3+sfe62Ff4gy96osy6OW84t4K4A8iGnMrlRrsSItSNp3RQ==", "integrity": "sha512-znR99e1BHeyEkSvgDDpX0sTiTu+8aQyDl9DawrkOGZTTW8hv0deIFXx87114zJ7gRaDZKVQD/4tr1ifmJp9xhQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/parser": "^7.9.4", "@babel/parser": "^7.9.4",

View File

@ -33,7 +33,6 @@
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"csurf": "1.11.0", "csurf": "1.11.0",
"dayjs": "1.8.36", "dayjs": "1.8.36",
"debug": "4.1.1",
"ejs": "3.1.5", "ejs": "3.1.5",
"electron-debug": "3.1.0", "electron-debug": "3.1.0",
"electron-dl": "3.0.2", "electron-dl": "3.0.2",
@ -82,7 +81,7 @@
"electron-rebuild": "2.0.3", "electron-rebuild": "2.0.3",
"esm": "3.2.25", "esm": "3.2.25",
"jasmine": "3.6.1", "jasmine": "3.6.1",
"jsdoc": "3.6.5", "jsdoc": "3.6.6",
"lorem-ipsum": "2.0.3", "lorem-ipsum": "2.0.3",
"rcedit": "2.2.0", "rcedit": "2.2.0",
"webpack": "5.0.0-beta.32", "webpack": "5.0.0-beta.32",