ll-plus 2.10.24 → 2.10.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/theme-chalk/code-editor-vue3/addon/comment/comment.js +211 -0
- package/theme-chalk/code-editor-vue3/addon/comment/continuecomment.js +114 -0
- package/theme-chalk/code-editor-vue3/addon/dialog/dialog.css +32 -0
- package/theme-chalk/code-editor-vue3/addon/dialog/dialog.js +163 -0
- package/theme-chalk/code-editor-vue3/addon/display/autorefresh.js +47 -0
- package/theme-chalk/code-editor-vue3/addon/display/fullscreen.css +6 -0
- package/theme-chalk/code-editor-vue3/addon/display/fullscreen.js +41 -0
- package/theme-chalk/code-editor-vue3/addon/display/panel.js +133 -0
- package/theme-chalk/code-editor-vue3/addon/display/placeholder.js +78 -0
- package/theme-chalk/code-editor-vue3/addon/display/rulers.js +51 -0
- package/theme-chalk/code-editor-vue3/addon/edit/closebrackets.js +201 -0
- package/theme-chalk/code-editor-vue3/addon/edit/closetag.js +185 -0
- package/theme-chalk/code-editor-vue3/addon/edit/continuelist.js +101 -0
- package/theme-chalk/code-editor-vue3/addon/edit/matchbrackets.js +160 -0
- package/theme-chalk/code-editor-vue3/addon/edit/matchtags.js +66 -0
- package/theme-chalk/code-editor-vue3/addon/edit/trailingspace.js +27 -0
- package/theme-chalk/code-editor-vue3/addon/fold/brace-fold.js +119 -0
- package/theme-chalk/code-editor-vue3/addon/fold/comment-fold.js +59 -0
- package/theme-chalk/code-editor-vue3/addon/fold/foldcode.js +159 -0
- package/theme-chalk/code-editor-vue3/addon/fold/foldgutter.css +20 -0
- package/theme-chalk/code-editor-vue3/addon/fold/foldgutter.js +169 -0
- package/theme-chalk/code-editor-vue3/addon/fold/indent-fold.js +48 -0
- package/theme-chalk/code-editor-vue3/addon/fold/markdown-fold.js +49 -0
- package/theme-chalk/code-editor-vue3/addon/fold/xml-fold.js +184 -0
- package/theme-chalk/code-editor-vue3/addon/hint/anyword-hint.js +41 -0
- package/theme-chalk/code-editor-vue3/addon/hint/css-hint.js +66 -0
- package/theme-chalk/code-editor-vue3/addon/hint/html-hint.js +351 -0
- package/theme-chalk/code-editor-vue3/addon/hint/javascript-hint.js +162 -0
- package/theme-chalk/code-editor-vue3/addon/hint/show-hint.css +37 -0
- package/theme-chalk/code-editor-vue3/addon/hint/show-hint.js +523 -0
- package/theme-chalk/code-editor-vue3/addon/hint/sql-hint.js +304 -0
- package/theme-chalk/code-editor-vue3/addon/hint/xml-hint.js +132 -0
- package/theme-chalk/code-editor-vue3/addon/lint/coffeescript-lint.js +47 -0
- package/theme-chalk/code-editor-vue3/addon/lint/css-lint.js +40 -0
- package/theme-chalk/code-editor-vue3/addon/lint/html-lint.js +59 -0
- package/theme-chalk/code-editor-vue3/addon/lint/javascript-lint.js +65 -0
- package/theme-chalk/code-editor-vue3/addon/lint/json-lint.js +40 -0
- package/theme-chalk/code-editor-vue3/addon/lint/lint.css +79 -0
- package/theme-chalk/code-editor-vue3/addon/lint/lint.js +288 -0
- package/theme-chalk/code-editor-vue3/addon/lint/yaml-lint.js +41 -0
- package/theme-chalk/code-editor-vue3/addon/merge/merge.css +119 -0
- package/theme-chalk/code-editor-vue3/addon/merge/merge.js +1018 -0
- package/theme-chalk/code-editor-vue3/addon/mode/loadmode.js +66 -0
- package/theme-chalk/code-editor-vue3/addon/mode/multiplex.js +136 -0
- package/theme-chalk/code-editor-vue3/addon/mode/multiplex_test.js +49 -0
- package/theme-chalk/code-editor-vue3/addon/mode/overlay.js +90 -0
- package/theme-chalk/code-editor-vue3/addon/mode/simple.js +216 -0
- package/theme-chalk/code-editor-vue3/addon/runmode/colorize.js +40 -0
- package/theme-chalk/code-editor-vue3/addon/runmode/runmode-standalone.js +334 -0
- package/theme-chalk/code-editor-vue3/addon/runmode/runmode.js +76 -0
- package/theme-chalk/code-editor-vue3/addon/runmode/runmode.node.js +329 -0
- package/theme-chalk/code-editor-vue3/addon/scroll/annotatescrollbar.js +128 -0
- package/theme-chalk/code-editor-vue3/addon/scroll/scrollpastend.js +48 -0
- package/theme-chalk/code-editor-vue3/addon/scroll/simplescrollbars.css +66 -0
- package/theme-chalk/code-editor-vue3/addon/scroll/simplescrollbars.js +152 -0
- package/theme-chalk/code-editor-vue3/addon/search/jump-to-line.js +53 -0
- package/theme-chalk/code-editor-vue3/addon/search/match-highlighter.js +167 -0
- package/theme-chalk/code-editor-vue3/addon/search/matchesonscrollbar.css +8 -0
- package/theme-chalk/code-editor-vue3/addon/search/matchesonscrollbar.js +97 -0
- package/theme-chalk/code-editor-vue3/addon/search/search.js +295 -0
- package/theme-chalk/code-editor-vue3/addon/search/searchcursor.js +305 -0
- package/theme-chalk/code-editor-vue3/addon/selection/active-line.js +72 -0
- package/theme-chalk/code-editor-vue3/addon/selection/mark-selection.js +119 -0
- package/theme-chalk/code-editor-vue3/addon/selection/selection-pointer.js +98 -0
- package/theme-chalk/code-editor-vue3/addon/tern/tern.css +87 -0
- package/theme-chalk/code-editor-vue3/addon/tern/tern.js +756 -0
- package/theme-chalk/code-editor-vue3/addon/tern/worker.js +44 -0
- package/theme-chalk/code-editor-vue3/addon/wrap/hardwrap.js +160 -0
- package/theme-chalk/code-editor-vue3/lib/codemirror.css +344 -0
- package/theme-chalk/code-editor-vue3/lib/codemirror.js +9884 -0
- package/theme-chalk/code-editor-vue3/mode/apl/apl.js +174 -0
- package/theme-chalk/code-editor-vue3/mode/asciiarmor/asciiarmor.js +74 -0
- package/theme-chalk/code-editor-vue3/mode/asn.1/asn.1.js +204 -0
- package/theme-chalk/code-editor-vue3/mode/asterisk/asterisk.js +220 -0
- package/theme-chalk/code-editor-vue3/mode/brainfuck/brainfuck.js +85 -0
- package/theme-chalk/code-editor-vue3/mode/clike/clike.js +942 -0
- package/theme-chalk/code-editor-vue3/mode/clojure/clojure.js +293 -0
- package/theme-chalk/code-editor-vue3/mode/cmake/cmake.js +97 -0
- package/theme-chalk/code-editor-vue3/mode/cobol/cobol.js +255 -0
- package/theme-chalk/code-editor-vue3/mode/coffeescript/coffeescript.js +359 -0
- package/theme-chalk/code-editor-vue3/mode/commonlisp/commonlisp.js +125 -0
- package/theme-chalk/code-editor-vue3/mode/crystal/crystal.js +433 -0
- package/theme-chalk/code-editor-vue3/mode/cypher/cypher.js +152 -0
- package/theme-chalk/code-editor-vue3/mode/d/d.js +223 -0
- package/theme-chalk/code-editor-vue3/mode/dart/dart.js +168 -0
- package/theme-chalk/code-editor-vue3/mode/diff/diff.js +47 -0
- package/theme-chalk/code-editor-vue3/mode/django/django.js +356 -0
- package/theme-chalk/code-editor-vue3/mode/dockerfile/dockerfile.js +211 -0
- package/theme-chalk/code-editor-vue3/mode/dtd/dtd.js +142 -0
- package/theme-chalk/code-editor-vue3/mode/dylan/dylan.js +352 -0
- package/theme-chalk/code-editor-vue3/mode/ebnf/ebnf.js +195 -0
- package/theme-chalk/code-editor-vue3/mode/ecl/ecl.js +206 -0
- package/theme-chalk/code-editor-vue3/mode/eiffel/eiffel.js +160 -0
- package/theme-chalk/code-editor-vue3/mode/elm/elm.js +245 -0
- package/theme-chalk/code-editor-vue3/mode/erlang/erlang.js +619 -0
- package/theme-chalk/code-editor-vue3/mode/factor/factor.js +85 -0
- package/theme-chalk/code-editor-vue3/mode/fcl/fcl.js +173 -0
- package/theme-chalk/code-editor-vue3/mode/forth/forth.js +180 -0
- package/theme-chalk/code-editor-vue3/mode/fortran/fortran.js +188 -0
- package/theme-chalk/code-editor-vue3/mode/gas/gas.js +353 -0
- package/theme-chalk/code-editor-vue3/mode/gfm/gfm.js +129 -0
- package/theme-chalk/code-editor-vue3/mode/gherkin/gherkin.js +178 -0
- package/theme-chalk/code-editor-vue3/mode/go/go.js +187 -0
- package/theme-chalk/code-editor-vue3/mode/groovy/groovy.js +245 -0
- package/theme-chalk/code-editor-vue3/mode/haml/haml.js +161 -0
- package/theme-chalk/code-editor-vue3/mode/handlebars/handlebars.js +70 -0
- package/theme-chalk/code-editor-vue3/mode/haskell/haskell.js +268 -0
- package/theme-chalk/code-editor-vue3/mode/haskell-literate/haskell-literate.js +43 -0
- package/theme-chalk/code-editor-vue3/mode/haxe/haxe.js +515 -0
- package/theme-chalk/code-editor-vue3/mode/htmlmixed/htmlmixed.js +153 -0
- package/theme-chalk/code-editor-vue3/mode/http/http.js +113 -0
- package/theme-chalk/code-editor-vue3/mode/idl/idl.js +290 -0
- package/theme-chalk/code-editor-vue3/mode/jinja2/jinja2.js +193 -0
- package/theme-chalk/code-editor-vue3/mode/julia/julia.js +390 -0
- package/theme-chalk/code-editor-vue3/mode/livescript/livescript.js +280 -0
- package/theme-chalk/code-editor-vue3/mode/lua/lua.js +160 -0
- package/theme-chalk/code-editor-vue3/mode/markdown/markdown.js +886 -0
- package/theme-chalk/code-editor-vue3/mode/mathematica/mathematica.js +176 -0
- package/theme-chalk/code-editor-vue3/mode/mbox/mbox.js +129 -0
- package/theme-chalk/code-editor-vue3/mode/meta.js +221 -0
- package/theme-chalk/code-editor-vue3/mode/mirc/mirc.js +193 -0
- package/theme-chalk/code-editor-vue3/mode/mllike/mllike.js +359 -0
- package/theme-chalk/code-editor-vue3/mode/modelica/modelica.js +245 -0
- package/theme-chalk/code-editor-vue3/mode/mscgen/mscgen.js +175 -0
- package/theme-chalk/code-editor-vue3/mode/mumps/mumps.js +148 -0
- package/theme-chalk/code-editor-vue3/mode/nginx/nginx.js +178 -0
- package/theme-chalk/code-editor-vue3/mode/nsis/nsis.js +95 -0
- package/theme-chalk/code-editor-vue3/mode/ntriples/ntriples.js +195 -0
- package/theme-chalk/code-editor-vue3/mode/octave/octave.js +139 -0
- package/theme-chalk/code-editor-vue3/mode/oz/oz.js +252 -0
- package/theme-chalk/code-editor-vue3/mode/pascal/pascal.js +136 -0
- package/theme-chalk/code-editor-vue3/mode/pegjs/pegjs.js +111 -0
- package/theme-chalk/code-editor-vue3/mode/perl/perl.js +836 -0
- package/theme-chalk/code-editor-vue3/mode/php/php.js +234 -0
- package/theme-chalk/code-editor-vue3/mode/pig/pig.js +178 -0
- package/theme-chalk/code-editor-vue3/mode/powershell/powershell.js +398 -0
- package/theme-chalk/code-editor-vue3/mode/properties/properties.js +78 -0
- package/theme-chalk/code-editor-vue3/mode/protobuf/protobuf.js +72 -0
- package/theme-chalk/code-editor-vue3/mode/pug/pug.js +591 -0
- package/theme-chalk/code-editor-vue3/mode/puppet/puppet.js +220 -0
- package/theme-chalk/code-editor-vue3/mode/python/python.js +402 -0
- package/theme-chalk/code-editor-vue3/mode/q/q.js +139 -0
- package/theme-chalk/code-editor-vue3/mode/r/r.js +190 -0
- package/theme-chalk/code-editor-vue3/mode/rpm/changes/index.html +66 -0
- package/theme-chalk/code-editor-vue3/mode/rpm/rpm.js +109 -0
- package/theme-chalk/code-editor-vue3/mode/rst/rst.js +557 -0
- package/theme-chalk/code-editor-vue3/mode/ruby/ruby.js +303 -0
- package/theme-chalk/code-editor-vue3/mode/rust/rust.js +72 -0
- package/theme-chalk/code-editor-vue3/mode/sas/sas.js +303 -0
- package/theme-chalk/code-editor-vue3/mode/sass/sass.js +459 -0
- package/theme-chalk/code-editor-vue3/mode/scheme/scheme.js +284 -0
- package/theme-chalk/code-editor-vue3/mode/shell/shell.js +168 -0
- package/theme-chalk/code-editor-vue3/mode/sieve/sieve.js +193 -0
- package/theme-chalk/code-editor-vue3/mode/slim/slim.js +575 -0
- package/theme-chalk/code-editor-vue3/mode/smalltalk/smalltalk.js +168 -0
- package/theme-chalk/code-editor-vue3/mode/smarty/smarty.js +225 -0
- package/theme-chalk/code-editor-vue3/mode/solr/solr.js +104 -0
- package/theme-chalk/code-editor-vue3/mode/soy/soy.js +665 -0
- package/theme-chalk/code-editor-vue3/mode/sparql/sparql.js +184 -0
- package/theme-chalk/code-editor-vue3/mode/spreadsheet/spreadsheet.js +112 -0
- package/theme-chalk/code-editor-vue3/mode/sql/sql.js +525 -0
- package/theme-chalk/code-editor-vue3/mode/stex/stex.js +264 -0
- package/theme-chalk/code-editor-vue3/mode/stylus/stylus.js +775 -0
- package/theme-chalk/code-editor-vue3/mode/swift/swift.js +221 -0
- package/theme-chalk/code-editor-vue3/mode/tcl/tcl.js +140 -0
- package/theme-chalk/code-editor-vue3/mode/textile/textile.js +469 -0
- package/theme-chalk/code-editor-vue3/mode/tiddlywiki/tiddlywiki.css +14 -0
- package/theme-chalk/code-editor-vue3/mode/tiddlywiki/tiddlywiki.js +308 -0
- package/theme-chalk/code-editor-vue3/mode/tiki/tiki.css +26 -0
- package/theme-chalk/code-editor-vue3/mode/tiki/tiki.js +312 -0
- package/theme-chalk/code-editor-vue3/mode/toml/toml.js +88 -0
- package/theme-chalk/code-editor-vue3/mode/tornado/tornado.js +68 -0
- package/theme-chalk/code-editor-vue3/mode/troff/troff.js +84 -0
- package/theme-chalk/code-editor-vue3/mode/ttcn/ttcn.js +283 -0
- package/theme-chalk/code-editor-vue3/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- package/theme-chalk/code-editor-vue3/mode/turtle/turtle.js +162 -0
- package/theme-chalk/code-editor-vue3/mode/twig/twig.js +141 -0
- package/theme-chalk/code-editor-vue3/mode/vb/vb.js +275 -0
- package/theme-chalk/code-editor-vue3/mode/vbscript/vbscript.js +350 -0
- package/theme-chalk/code-editor-vue3/mode/velocity/velocity.js +202 -0
- package/theme-chalk/code-editor-vue3/mode/verilog/verilog.js +781 -0
- package/theme-chalk/code-editor-vue3/mode/vhdl/vhdl.js +189 -0
- package/theme-chalk/code-editor-vue3/mode/wast/wast.js +132 -0
- package/theme-chalk/code-editor-vue3/mode/webidl/webidl.js +195 -0
- package/theme-chalk/code-editor-vue3/mode/xml/xml.js +417 -0
- package/theme-chalk/code-editor-vue3/mode/xquery/xquery.js +448 -0
- package/theme-chalk/code-editor-vue3/mode/yacas/yacas.js +204 -0
- package/theme-chalk/code-editor-vue3/mode/yaml/yaml.js +120 -0
- package/theme-chalk/code-editor-vue3/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
- package/theme-chalk/code-editor-vue3/mode/z80/z80.js +116 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
|
3
|
+
|
|
4
|
+
(function(mod) {
|
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
6
|
+
mod(require("../../lib/codemirror"));
|
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
8
|
+
define(["../../lib/codemirror"], mod);
|
|
9
|
+
else // Plain browser env
|
|
10
|
+
mod(CodeMirror);
|
|
11
|
+
})(function(CodeMirror) {
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
CodeMirror.defineMode("crystal", function(config) {
|
|
15
|
+
function wordRegExp(words, end) {
|
|
16
|
+
return new RegExp((end ? "" : "^") + "(?:" + words.join("|") + ")" + (end ? "$" : "\\b"));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function chain(tokenize, stream, state) {
|
|
20
|
+
state.tokenize.push(tokenize);
|
|
21
|
+
return tokenize(stream, state);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var operators = /^(?:[-+/%|&^]|\*\*?|[<>]{2})/;
|
|
25
|
+
var conditionalOperators = /^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/;
|
|
26
|
+
var indexingOperators = /^(?:\[\][?=]?)/;
|
|
27
|
+
var anotherOperators = /^(?:\.(?:\.{2})?|->|[?:])/;
|
|
28
|
+
var idents = /^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
|
|
29
|
+
var types = /^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
|
|
30
|
+
var keywords = wordRegExp([
|
|
31
|
+
"abstract", "alias", "as", "asm", "begin", "break", "case", "class", "def", "do",
|
|
32
|
+
"else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if",
|
|
33
|
+
"include", "instance_sizeof", "lib", "macro", "module", "next", "of", "out", "pointerof",
|
|
34
|
+
"private", "protected", "rescue", "return", "require", "select", "sizeof", "struct",
|
|
35
|
+
"super", "then", "type", "typeof", "uninitialized", "union", "unless", "until", "when", "while", "with",
|
|
36
|
+
"yield", "__DIR__", "__END_LINE__", "__FILE__", "__LINE__"
|
|
37
|
+
]);
|
|
38
|
+
var atomWords = wordRegExp(["true", "false", "nil", "self"]);
|
|
39
|
+
var indentKeywordsArray = [
|
|
40
|
+
"def", "fun", "macro",
|
|
41
|
+
"class", "module", "struct", "lib", "enum", "union",
|
|
42
|
+
"do", "for"
|
|
43
|
+
];
|
|
44
|
+
var indentKeywords = wordRegExp(indentKeywordsArray);
|
|
45
|
+
var indentExpressionKeywordsArray = ["if", "unless", "case", "while", "until", "begin", "then"];
|
|
46
|
+
var indentExpressionKeywords = wordRegExp(indentExpressionKeywordsArray);
|
|
47
|
+
var dedentKeywordsArray = ["end", "else", "elsif", "rescue", "ensure"];
|
|
48
|
+
var dedentKeywords = wordRegExp(dedentKeywordsArray);
|
|
49
|
+
var dedentPunctualsArray = ["\\)", "\\}", "\\]"];
|
|
50
|
+
var dedentPunctuals = new RegExp("^(?:" + dedentPunctualsArray.join("|") + ")$");
|
|
51
|
+
var nextTokenizer = {
|
|
52
|
+
"def": tokenFollowIdent, "fun": tokenFollowIdent, "macro": tokenMacroDef,
|
|
53
|
+
"class": tokenFollowType, "module": tokenFollowType, "struct": tokenFollowType,
|
|
54
|
+
"lib": tokenFollowType, "enum": tokenFollowType, "union": tokenFollowType
|
|
55
|
+
};
|
|
56
|
+
var matching = {"[": "]", "{": "}", "(": ")", "<": ">"};
|
|
57
|
+
|
|
58
|
+
function tokenBase(stream, state) {
|
|
59
|
+
if (stream.eatSpace()) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Macros
|
|
64
|
+
if (state.lastToken != "\\" && stream.match("{%", false)) {
|
|
65
|
+
return chain(tokenMacro("%", "%"), stream, state);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (state.lastToken != "\\" && stream.match("{{", false)) {
|
|
69
|
+
return chain(tokenMacro("{", "}"), stream, state);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Comments
|
|
73
|
+
if (stream.peek() == "#") {
|
|
74
|
+
stream.skipToEnd();
|
|
75
|
+
return "comment";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Variables and keywords
|
|
79
|
+
var matched;
|
|
80
|
+
if (stream.match(idents)) {
|
|
81
|
+
stream.eat(/[?!]/);
|
|
82
|
+
|
|
83
|
+
matched = stream.current();
|
|
84
|
+
if (stream.eat(":")) {
|
|
85
|
+
return "atom";
|
|
86
|
+
} else if (state.lastToken == ".") {
|
|
87
|
+
return "property";
|
|
88
|
+
} else if (keywords.test(matched)) {
|
|
89
|
+
if (indentKeywords.test(matched)) {
|
|
90
|
+
if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0) && !(matched == "def" && state.lastToken == "abstract")) {
|
|
91
|
+
state.blocks.push(matched);
|
|
92
|
+
state.currentIndent += 1;
|
|
93
|
+
}
|
|
94
|
+
} else if ((state.lastStyle == "operator" || !state.lastStyle) && indentExpressionKeywords.test(matched)) {
|
|
95
|
+
state.blocks.push(matched);
|
|
96
|
+
state.currentIndent += 1;
|
|
97
|
+
} else if (matched == "end") {
|
|
98
|
+
state.blocks.pop();
|
|
99
|
+
state.currentIndent -= 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (nextTokenizer.hasOwnProperty(matched)) {
|
|
103
|
+
state.tokenize.push(nextTokenizer[matched]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return "keyword";
|
|
107
|
+
} else if (atomWords.test(matched)) {
|
|
108
|
+
return "atom";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return "variable";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Class variables and instance variables
|
|
115
|
+
// or attributes
|
|
116
|
+
if (stream.eat("@")) {
|
|
117
|
+
if (stream.peek() == "[") {
|
|
118
|
+
return chain(tokenNest("[", "]", "meta"), stream, state);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
stream.eat("@");
|
|
122
|
+
stream.match(idents) || stream.match(types);
|
|
123
|
+
return "variable-2";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Constants and types
|
|
127
|
+
if (stream.match(types)) {
|
|
128
|
+
return "tag";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Symbols or ':' operator
|
|
132
|
+
if (stream.eat(":")) {
|
|
133
|
+
if (stream.eat("\"")) {
|
|
134
|
+
return chain(tokenQuote("\"", "atom", false), stream, state);
|
|
135
|
+
} else if (stream.match(idents) || stream.match(types) ||
|
|
136
|
+
stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators)) {
|
|
137
|
+
return "atom";
|
|
138
|
+
}
|
|
139
|
+
stream.eat(":");
|
|
140
|
+
return "operator";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Strings
|
|
144
|
+
if (stream.eat("\"")) {
|
|
145
|
+
return chain(tokenQuote("\"", "string", true), stream, state);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Strings or regexps or macro variables or '%' operator
|
|
149
|
+
if (stream.peek() == "%") {
|
|
150
|
+
var style = "string";
|
|
151
|
+
var embed = true;
|
|
152
|
+
var delim;
|
|
153
|
+
|
|
154
|
+
if (stream.match("%r")) {
|
|
155
|
+
// Regexps
|
|
156
|
+
style = "string-2";
|
|
157
|
+
delim = stream.next();
|
|
158
|
+
} else if (stream.match("%w")) {
|
|
159
|
+
embed = false;
|
|
160
|
+
delim = stream.next();
|
|
161
|
+
} else if (stream.match("%q")) {
|
|
162
|
+
embed = false;
|
|
163
|
+
delim = stream.next();
|
|
164
|
+
} else {
|
|
165
|
+
if(delim = stream.match(/^%([^\w\s=])/)) {
|
|
166
|
+
delim = delim[1];
|
|
167
|
+
} else if (stream.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/)) {
|
|
168
|
+
// Macro variables
|
|
169
|
+
return "meta";
|
|
170
|
+
} else if (stream.eat('%')) {
|
|
171
|
+
// '%' operator
|
|
172
|
+
return "operator";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (matching.hasOwnProperty(delim)) {
|
|
177
|
+
delim = matching[delim];
|
|
178
|
+
}
|
|
179
|
+
return chain(tokenQuote(delim, style, embed), stream, state);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Here Docs
|
|
183
|
+
if (matched = stream.match(/^<<-('?)([A-Z]\w*)\1/)) {
|
|
184
|
+
return chain(tokenHereDoc(matched[2], !matched[1]), stream, state)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Characters
|
|
188
|
+
if (stream.eat("'")) {
|
|
189
|
+
stream.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/);
|
|
190
|
+
stream.eat("'");
|
|
191
|
+
return "atom";
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Numbers
|
|
195
|
+
if (stream.eat("0")) {
|
|
196
|
+
if (stream.eat("x")) {
|
|
197
|
+
stream.match(/^[0-9a-fA-F_]+/);
|
|
198
|
+
} else if (stream.eat("o")) {
|
|
199
|
+
stream.match(/^[0-7_]+/);
|
|
200
|
+
} else if (stream.eat("b")) {
|
|
201
|
+
stream.match(/^[01_]+/);
|
|
202
|
+
}
|
|
203
|
+
return "number";
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (stream.eat(/^\d/)) {
|
|
207
|
+
stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/);
|
|
208
|
+
return "number";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Operators
|
|
212
|
+
if (stream.match(operators)) {
|
|
213
|
+
stream.eat("="); // Operators can follow assign symbol.
|
|
214
|
+
return "operator";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (stream.match(conditionalOperators) || stream.match(anotherOperators)) {
|
|
218
|
+
return "operator";
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Parens and braces
|
|
222
|
+
if (matched = stream.match(/[({[]/, false)) {
|
|
223
|
+
matched = matched[0];
|
|
224
|
+
return chain(tokenNest(matched, matching[matched], null), stream, state);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Escapes
|
|
228
|
+
if (stream.eat("\\")) {
|
|
229
|
+
stream.next();
|
|
230
|
+
return "meta";
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
stream.next();
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function tokenNest(begin, end, style, started) {
|
|
238
|
+
return function (stream, state) {
|
|
239
|
+
if (!started && stream.match(begin)) {
|
|
240
|
+
state.tokenize[state.tokenize.length - 1] = tokenNest(begin, end, style, true);
|
|
241
|
+
state.currentIndent += 1;
|
|
242
|
+
return style;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var nextStyle = tokenBase(stream, state);
|
|
246
|
+
if (stream.current() === end) {
|
|
247
|
+
state.tokenize.pop();
|
|
248
|
+
state.currentIndent -= 1;
|
|
249
|
+
nextStyle = style;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return nextStyle;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function tokenMacro(begin, end, started) {
|
|
257
|
+
return function (stream, state) {
|
|
258
|
+
if (!started && stream.match("{" + begin)) {
|
|
259
|
+
state.currentIndent += 1;
|
|
260
|
+
state.tokenize[state.tokenize.length - 1] = tokenMacro(begin, end, true);
|
|
261
|
+
return "meta";
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (stream.match(end + "}")) {
|
|
265
|
+
state.currentIndent -= 1;
|
|
266
|
+
state.tokenize.pop();
|
|
267
|
+
return "meta";
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return tokenBase(stream, state);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function tokenMacroDef(stream, state) {
|
|
275
|
+
if (stream.eatSpace()) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var matched;
|
|
280
|
+
if (matched = stream.match(idents)) {
|
|
281
|
+
if (matched == "def") {
|
|
282
|
+
return "keyword";
|
|
283
|
+
}
|
|
284
|
+
stream.eat(/[?!]/);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
state.tokenize.pop();
|
|
288
|
+
return "def";
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function tokenFollowIdent(stream, state) {
|
|
292
|
+
if (stream.eatSpace()) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (stream.match(idents)) {
|
|
297
|
+
stream.eat(/[!?]/);
|
|
298
|
+
} else {
|
|
299
|
+
stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators);
|
|
300
|
+
}
|
|
301
|
+
state.tokenize.pop();
|
|
302
|
+
return "def";
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function tokenFollowType(stream, state) {
|
|
306
|
+
if (stream.eatSpace()) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
stream.match(types);
|
|
311
|
+
state.tokenize.pop();
|
|
312
|
+
return "def";
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function tokenQuote(end, style, embed) {
|
|
316
|
+
return function (stream, state) {
|
|
317
|
+
var escaped = false;
|
|
318
|
+
|
|
319
|
+
while (stream.peek()) {
|
|
320
|
+
if (!escaped) {
|
|
321
|
+
if (stream.match("{%", false)) {
|
|
322
|
+
state.tokenize.push(tokenMacro("%", "%"));
|
|
323
|
+
return style;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (stream.match("{{", false)) {
|
|
327
|
+
state.tokenize.push(tokenMacro("{", "}"));
|
|
328
|
+
return style;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (embed && stream.match("#{", false)) {
|
|
332
|
+
state.tokenize.push(tokenNest("#{", "}", "meta"));
|
|
333
|
+
return style;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
var ch = stream.next();
|
|
337
|
+
|
|
338
|
+
if (ch == end) {
|
|
339
|
+
state.tokenize.pop();
|
|
340
|
+
return style;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
escaped = embed && ch == "\\";
|
|
344
|
+
} else {
|
|
345
|
+
stream.next();
|
|
346
|
+
escaped = false;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return style;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function tokenHereDoc(phrase, embed) {
|
|
355
|
+
return function (stream, state) {
|
|
356
|
+
if (stream.sol()) {
|
|
357
|
+
stream.eatSpace()
|
|
358
|
+
if (stream.match(phrase)) {
|
|
359
|
+
state.tokenize.pop();
|
|
360
|
+
return "string";
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
var escaped = false;
|
|
365
|
+
while (stream.peek()) {
|
|
366
|
+
if (!escaped) {
|
|
367
|
+
if (stream.match("{%", false)) {
|
|
368
|
+
state.tokenize.push(tokenMacro("%", "%"));
|
|
369
|
+
return "string";
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (stream.match("{{", false)) {
|
|
373
|
+
state.tokenize.push(tokenMacro("{", "}"));
|
|
374
|
+
return "string";
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (embed && stream.match("#{", false)) {
|
|
378
|
+
state.tokenize.push(tokenNest("#{", "}", "meta"));
|
|
379
|
+
return "string";
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
escaped = stream.next() == "\\" && embed;
|
|
383
|
+
} else {
|
|
384
|
+
stream.next();
|
|
385
|
+
escaped = false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return "string";
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return {
|
|
394
|
+
startState: function () {
|
|
395
|
+
return {
|
|
396
|
+
tokenize: [tokenBase],
|
|
397
|
+
currentIndent: 0,
|
|
398
|
+
lastToken: null,
|
|
399
|
+
lastStyle: null,
|
|
400
|
+
blocks: []
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
token: function (stream, state) {
|
|
405
|
+
var style = state.tokenize[state.tokenize.length - 1](stream, state);
|
|
406
|
+
var token = stream.current();
|
|
407
|
+
|
|
408
|
+
if (style && style != "comment") {
|
|
409
|
+
state.lastToken = token;
|
|
410
|
+
state.lastStyle = style;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return style;
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
indent: function (state, textAfter) {
|
|
417
|
+
textAfter = textAfter.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g, "");
|
|
418
|
+
|
|
419
|
+
if (dedentKeywords.test(textAfter) || dedentPunctuals.test(textAfter)) {
|
|
420
|
+
return config.indentUnit * (state.currentIndent - 1);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return config.indentUnit * state.currentIndent;
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
fold: "indent",
|
|
427
|
+
electricInput: wordRegExp(dedentPunctualsArray.concat(dedentKeywordsArray), true),
|
|
428
|
+
lineComment: '#'
|
|
429
|
+
};
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
CodeMirror.defineMIME("text/x-crystal", "crystal");
|
|
433
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
|
3
|
+
|
|
4
|
+
// By the Neo4j Team and contributors.
|
|
5
|
+
// https://github.com/neo4j-contrib/CodeMirror
|
|
6
|
+
|
|
7
|
+
(function(mod) {
|
|
8
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
9
|
+
mod(require("../../lib/codemirror"));
|
|
10
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
11
|
+
define(["../../lib/codemirror"], mod);
|
|
12
|
+
else // Plain browser env
|
|
13
|
+
mod(CodeMirror);
|
|
14
|
+
})(function(CodeMirror) {
|
|
15
|
+
"use strict";
|
|
16
|
+
var wordRegexp = function(words) {
|
|
17
|
+
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
CodeMirror.defineMode("cypher", function(config) {
|
|
21
|
+
var tokenBase = function(stream/*, state*/) {
|
|
22
|
+
curPunc = null
|
|
23
|
+
var ch = stream.next();
|
|
24
|
+
if (ch ==='"') {
|
|
25
|
+
stream.match(/^[^"]*"/);
|
|
26
|
+
return "string";
|
|
27
|
+
}
|
|
28
|
+
if (ch === "'") {
|
|
29
|
+
stream.match(/^[^']*'/);
|
|
30
|
+
return "string";
|
|
31
|
+
}
|
|
32
|
+
if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
|
33
|
+
curPunc = ch;
|
|
34
|
+
return "node";
|
|
35
|
+
} else if (ch === "/" && stream.eat("/")) {
|
|
36
|
+
stream.skipToEnd();
|
|
37
|
+
return "comment";
|
|
38
|
+
} else if (operatorChars.test(ch)) {
|
|
39
|
+
stream.eatWhile(operatorChars);
|
|
40
|
+
return null;
|
|
41
|
+
} else {
|
|
42
|
+
stream.eatWhile(/[_\w\d]/);
|
|
43
|
+
if (stream.eat(":")) {
|
|
44
|
+
stream.eatWhile(/[\w\d_\-]/);
|
|
45
|
+
return "atom";
|
|
46
|
+
}
|
|
47
|
+
var word = stream.current();
|
|
48
|
+
if (funcs.test(word)) return "builtin";
|
|
49
|
+
if (preds.test(word)) return "def";
|
|
50
|
+
if (keywords.test(word) || systemKeywords.test(word)) return "keyword";
|
|
51
|
+
return "variable";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var pushContext = function(state, type, col) {
|
|
55
|
+
return state.context = {
|
|
56
|
+
prev: state.context,
|
|
57
|
+
indent: state.indent,
|
|
58
|
+
col: col,
|
|
59
|
+
type: type
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
var popContext = function(state) {
|
|
63
|
+
state.indent = state.context.indent;
|
|
64
|
+
return state.context = state.context.prev;
|
|
65
|
+
};
|
|
66
|
+
var indentUnit = config.indentUnit;
|
|
67
|
+
var curPunc;
|
|
68
|
+
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"]);
|
|
69
|
+
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
|
|
70
|
+
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"]);
|
|
71
|
+
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"]);
|
|
72
|
+
var operatorChars = /[*+\-<>=&|~%^]/;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
startState: function(/*base*/) {
|
|
76
|
+
return {
|
|
77
|
+
tokenize: tokenBase,
|
|
78
|
+
context: null,
|
|
79
|
+
indent: 0,
|
|
80
|
+
col: 0
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
token: function(stream, state) {
|
|
84
|
+
if (stream.sol()) {
|
|
85
|
+
if (state.context && (state.context.align == null)) {
|
|
86
|
+
state.context.align = false;
|
|
87
|
+
}
|
|
88
|
+
state.indent = stream.indentation();
|
|
89
|
+
}
|
|
90
|
+
if (stream.eatSpace()) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
var style = state.tokenize(stream, state);
|
|
94
|
+
if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
|
|
95
|
+
state.context.align = true;
|
|
96
|
+
}
|
|
97
|
+
if (curPunc === "(") {
|
|
98
|
+
pushContext(state, ")", stream.column());
|
|
99
|
+
} else if (curPunc === "[") {
|
|
100
|
+
pushContext(state, "]", stream.column());
|
|
101
|
+
} else if (curPunc === "{") {
|
|
102
|
+
pushContext(state, "}", stream.column());
|
|
103
|
+
} else if (/[\]\}\)]/.test(curPunc)) {
|
|
104
|
+
while (state.context && state.context.type === "pattern") {
|
|
105
|
+
popContext(state);
|
|
106
|
+
}
|
|
107
|
+
if (state.context && curPunc === state.context.type) {
|
|
108
|
+
popContext(state);
|
|
109
|
+
}
|
|
110
|
+
} else if (curPunc === "." && state.context && state.context.type === "pattern") {
|
|
111
|
+
popContext(state);
|
|
112
|
+
} else if (/atom|string|variable/.test(style) && state.context) {
|
|
113
|
+
if (/[\}\]]/.test(state.context.type)) {
|
|
114
|
+
pushContext(state, "pattern", stream.column());
|
|
115
|
+
} else if (state.context.type === "pattern" && !state.context.align) {
|
|
116
|
+
state.context.align = true;
|
|
117
|
+
state.context.col = stream.column();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return style;
|
|
121
|
+
},
|
|
122
|
+
indent: function(state, textAfter) {
|
|
123
|
+
var firstChar = textAfter && textAfter.charAt(0);
|
|
124
|
+
var context = state.context;
|
|
125
|
+
if (/[\]\}]/.test(firstChar)) {
|
|
126
|
+
while (context && context.type === "pattern") {
|
|
127
|
+
context = context.prev;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
var closing = context && firstChar === context.type;
|
|
131
|
+
if (!context) return 0;
|
|
132
|
+
if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent;
|
|
133
|
+
if (context.align) return context.col + (closing ? 0 : 1);
|
|
134
|
+
return context.indent + (closing ? 0 : indentUnit);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
CodeMirror.modeExtensions["cypher"] = {
|
|
140
|
+
autoFormatLineBreaks: function(text) {
|
|
141
|
+
var i, lines, reProcessedPortion;
|
|
142
|
+
var lines = text.split("\n");
|
|
143
|
+
var reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
|
|
144
|
+
for (var i = 0; i < lines.length; i++)
|
|
145
|
+
lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
|
|
146
|
+
return lines.join("\n");
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
CodeMirror.defineMIME("application/x-cypher-query", "cypher");
|
|
151
|
+
|
|
152
|
+
});
|