@aleph-alpha/chat-kit 6.0.0 → 6.1.1
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/dist/{CkHistory.vue_vue_type_script_setup_true_lang-D9Ph9eYp.js → CkHistory.vue_vue_type_script_setup_true_lang-Cr8vF94e.js} +214 -107
- package/dist/apl-fqmucPXA.js +140 -0
- package/dist/asciiarmor-DucZyvP0.js +56 -0
- package/dist/asn1-BnOEsgAm.js +144 -0
- package/dist/asterisk-QAlztEwS.js +345 -0
- package/dist/brainfuck-DZVCuF_t.js +53 -0
- package/dist/chat-kit.css +1184 -1
- package/dist/clike-CTYGlS6x.js +799 -0
- package/dist/clojure-BhXMqnxz.js +849 -0
- package/dist/cmake-BGaNd9E7.js +71 -0
- package/dist/cobol-4yqQntpt.js +120 -0
- package/dist/coffeescript-D2dXvhEc.js +308 -0
- package/dist/commonlisp-CF_VNHQR.js +130 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts +41 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts +26 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts +20 -0
- package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts +42 -0
- package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts +33 -0
- package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/index.d.ts +3 -0
- package/dist/components/base/CkMilkdownEditor/index.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts +16 -0
- package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/types.d.ts +98 -0
- package/dist/components/base/CkMilkdownEditor/types.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +2 -0
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +12 -11
- package/dist/createCrepeEditor-CFbvSH3s.js +74141 -0
- package/dist/crystal-DyuLTqLs.js +398 -0
- package/dist/css-DkSyTW67.js +1772 -0
- package/dist/cypher-Dlu_3r4V.js +121 -0
- package/dist/d-UURgV0Ux.js +179 -0
- package/dist/diff-B_Bi2Crb.js +25 -0
- package/dist/dockerfile-Bvk733Ga.js +201 -0
- package/dist/dtd-Dy74G54E.js +114 -0
- package/dist/dylan-TSb-Nfix.js +314 -0
- package/dist/ebnf-4fKAGW3a.js +140 -0
- package/dist/ecl-B59qGGVg.js +178 -0
- package/dist/eiffel-Dze7nlu3.js +134 -0
- package/dist/elm-DG7jkhNZ.js +176 -0
- package/dist/erlang-BO6gOnGA.js +674 -0
- package/dist/factor-CMxFHDqz.js +65 -0
- package/dist/fcl-CDDUNjTj.js +141 -0
- package/dist/forth-B9D2JCeE.js +116 -0
- package/dist/fortran-CAG2BFbe.js +467 -0
- package/dist/gas-0Aw8zDr5.js +293 -0
- package/dist/gherkin-DhZlEZiy.js +115 -0
- package/dist/groovy-CpwJiBl7.js +223 -0
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/useChatKitLabels.d.ts +27 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/haskell-ySd-OUo8.js +459 -0
- package/dist/haxe-7MlzfeYV.js +514 -0
- package/dist/http-BqypyemW.js +79 -0
- package/dist/idl-4HIGJlDI.js +985 -0
- package/dist/index-A5rWjRtZ.js +689 -0
- package/dist/index-B0ldhzaj.js +385 -0
- package/dist/index-BVOjyn3y.js +2490 -0
- package/dist/index-BWvkps_G.js +309 -0
- package/dist/index-BaS8OW8V.js +151 -0
- package/dist/index-BlHHEbV-.js +406 -0
- package/dist/index-BoqzHVNB.js +82 -0
- package/dist/index-C6zYjwIQ.js +704 -0
- package/dist/index-CMJGuXap.js +330 -0
- package/dist/index-CRfGWVdQ.js +116 -0
- package/dist/index-C_gTb50u.js +81 -0
- package/dist/index-DSU7cBGz.js +178 -0
- package/dist/index-DSq3gvqU.js +1767 -0
- package/dist/index-Da3777l2.js +289 -0
- package/dist/index-DdlzabmR.js +1021 -0
- package/dist/index-DhY_9bdS.js +61 -0
- package/dist/index-Dm6C1blN.js +1052 -0
- package/dist/index-Tj3pzx-E.js +327 -0
- package/dist/index-ZeRS5rER.js +97 -0
- package/dist/index-gzleljO6.js +157 -0
- package/dist/index-naWlQpaL.js +642 -0
- package/dist/index-sKO1lHHC.js +312 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -13
- package/dist/javascript-Bt8B7yTi.js +992 -0
- package/dist/julia-Bs6JJhYG.js +407 -0
- package/dist/livescript-DmzgM3Yt.js +296 -0
- package/dist/lua-Cvg8VrAA.js +256 -0
- package/dist/mathematica-DNLOL9PQ.js +110 -0
- package/dist/mbox-Ga7d4MMN.js +117 -0
- package/dist/mirc-Dma3B8rS.js +107 -0
- package/dist/mllike-DHn7xckP.js +334 -0
- package/dist/modelica-0d55jYY0.js +147 -0
- package/dist/mscgen-DdqZYINH.js +135 -0
- package/dist/mumps-Btr8VblO.js +93 -0
- package/dist/nginx-DTDtBDVN.js +141 -0
- package/dist/nsis-CyKBdPWp.js +62 -0
- package/dist/ntriples-CvgOYMpL.js +153 -0
- package/dist/octave-DYBj3-tl.js +200 -0
- package/dist/oz-R_e8WMIi.js +231 -0
- package/dist/pascal-GD8iposT.js +105 -0
- package/dist/perl-DL9mHpoi.js +1105 -0
- package/dist/pig-C_4T4YIV.js +101 -0
- package/dist/powershell-B0suO7Vd.js +328 -0
- package/dist/properties-BR-vP1aU.js +58 -0
- package/dist/protobuf-BxgpyhoW.js +77 -0
- package/dist/pug-vHnWR0UE.js +405 -0
- package/dist/puppet-Bdao66PW.js +137 -0
- package/dist/python-BFGRmuZ9.js +426 -0
- package/dist/q-CrbCVq4a.js +131 -0
- package/dist/r-V7nswm59.js +170 -0
- package/dist/rpm-C-DLY-If.js +109 -0
- package/dist/ruby-CQTpZw6f.js +331 -0
- package/dist/sas-D2UG-yhZ.js +207 -0
- package/dist/scheme-BKzrkGJD.js +222 -0
- package/dist/shell-BlsXDxCn.js +222 -0
- package/dist/sieve-CjwBwOY5.js +135 -0
- package/dist/simple-mode-DMneyfDu.js +130 -0
- package/dist/smalltalk-BOIGQuhN.js +121 -0
- package/dist/solr-CwD7U71z.js +69 -0
- package/dist/sparql-DYskk2vE.js +249 -0
- package/dist/spreadsheet-Bgtt3oLP.js +87 -0
- package/dist/sql-Cei9CMfk.js +342 -0
- package/dist/stex-C1nZSzAw.js +230 -0
- package/dist/stylus-BkS-boTH.js +565 -0
- package/dist/swift-FRZi1uvB.js +291 -0
- package/dist/tcl-CUcaCdmq.js +114 -0
- package/dist/textile-BnFpjsrl.js +414 -0
- package/dist/tiddlywiki-CjprD-Qp.js +218 -0
- package/dist/tiki-DK9DOeWn.js +268 -0
- package/dist/toml-BOuWGMcf.js +76 -0
- package/dist/troff-E1bJ0PPL.js +61 -0
- package/dist/ttcn-cfg-Dc39-fIP.js +133 -0
- package/dist/ttcn-tKd4HLu4.js +192 -0
- package/dist/turtle-Dq7-1WAf.js +124 -0
- package/dist/{useChatKitLabels-368lodS5.js → useChatKitLabels-Ww1Q7xUr.js} +25 -2
- package/dist/vb-Dp90gtsv.js +196 -0
- package/dist/vbscript-Bfn8O8I7.js +478 -0
- package/dist/velocity-BwIZK1TH.js +149 -0
- package/dist/verilog-CnT9bMk0.js +429 -0
- package/dist/vhdl-DCkMIyT9.js +158 -0
- package/dist/webidl-BTLTThCm.js +204 -0
- package/dist/xquery-BrBUuxMR.js +525 -0
- package/dist/yacas-b5lAVEIl.js +130 -0
- package/dist/z80-ClgwfNdB.js +92 -0
- package/package.json +12 -6
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.spec.ts +221 -0
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.ts +274 -0
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.vue +151 -0
- package/src/components/base/CkMilkdownEditor/codeMirrorTheme.ts +132 -0
- package/src/components/base/CkMilkdownEditor/createCrepeEditor.ts +192 -0
- package/src/components/base/CkMilkdownEditor/crepeIcons.ts +77 -0
- package/src/components/base/CkMilkdownEditor/index.ts +2 -0
- package/src/components/base/CkMilkdownEditor/markdownClassAttrs.ts +64 -0
- package/src/components/base/CkMilkdownEditor/milkdown-theme.css +459 -0
- package/src/components/base/CkMilkdownEditor/types.ts +100 -0
- package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.ts +2 -2
- package/src/components/base/index.ts +6 -0
- package/src/components/index.ts +4 -0
- package/src/handlers/useChatKitLabels.ts +27 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var wordRegexp = function(words) {
|
|
2
|
+
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
|
3
|
+
};
|
|
4
|
+
var tokenBase = function(stream) {
|
|
5
|
+
curPunc = null;
|
|
6
|
+
var ch = stream.next();
|
|
7
|
+
if (ch === '"') {
|
|
8
|
+
stream.match(/^.*?"/);
|
|
9
|
+
return "string";
|
|
10
|
+
}
|
|
11
|
+
if (ch === "'") {
|
|
12
|
+
stream.match(/^.*?'/);
|
|
13
|
+
return "string";
|
|
14
|
+
}
|
|
15
|
+
if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
|
16
|
+
curPunc = ch;
|
|
17
|
+
return "punctuation";
|
|
18
|
+
} else if (ch === "/" && stream.eat("/")) {
|
|
19
|
+
stream.skipToEnd();
|
|
20
|
+
return "comment";
|
|
21
|
+
} else if (operatorChars.test(ch)) {
|
|
22
|
+
stream.eatWhile(operatorChars);
|
|
23
|
+
return null;
|
|
24
|
+
} else {
|
|
25
|
+
stream.eatWhile(/[_\w\d]/);
|
|
26
|
+
if (stream.eat(":")) {
|
|
27
|
+
stream.eatWhile(/[\w\d_\-]/);
|
|
28
|
+
return "atom";
|
|
29
|
+
}
|
|
30
|
+
var word = stream.current();
|
|
31
|
+
if (funcs.test(word)) return "builtin";
|
|
32
|
+
if (preds.test(word)) return "def";
|
|
33
|
+
if (keywords.test(word) || systemKeywords.test(word)) return "keyword";
|
|
34
|
+
return "variable";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var pushContext = function(state, type, col) {
|
|
38
|
+
return state.context = {
|
|
39
|
+
prev: state.context,
|
|
40
|
+
indent: state.indent,
|
|
41
|
+
col,
|
|
42
|
+
type
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var popContext = function(state) {
|
|
46
|
+
state.indent = state.context.indent;
|
|
47
|
+
return state.context = state.context.prev;
|
|
48
|
+
};
|
|
49
|
+
var curPunc;
|
|
50
|
+
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"]);
|
|
51
|
+
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
|
|
52
|
+
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"]);
|
|
53
|
+
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"]);
|
|
54
|
+
var operatorChars = /[*+\-<>=&|~%^]/;
|
|
55
|
+
const cypher = {
|
|
56
|
+
name: "cypher",
|
|
57
|
+
startState: function() {
|
|
58
|
+
return {
|
|
59
|
+
tokenize: tokenBase,
|
|
60
|
+
context: null,
|
|
61
|
+
indent: 0,
|
|
62
|
+
col: 0
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
token: function(stream, state) {
|
|
66
|
+
if (stream.sol()) {
|
|
67
|
+
if (state.context && state.context.align == null) {
|
|
68
|
+
state.context.align = false;
|
|
69
|
+
}
|
|
70
|
+
state.indent = stream.indentation();
|
|
71
|
+
}
|
|
72
|
+
if (stream.eatSpace()) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
var style = state.tokenize(stream, state);
|
|
76
|
+
if (style !== "comment" && state.context && state.context.align == null && state.context.type !== "pattern") {
|
|
77
|
+
state.context.align = true;
|
|
78
|
+
}
|
|
79
|
+
if (curPunc === "(") {
|
|
80
|
+
pushContext(state, ")", stream.column());
|
|
81
|
+
} else if (curPunc === "[") {
|
|
82
|
+
pushContext(state, "]", stream.column());
|
|
83
|
+
} else if (curPunc === "{") {
|
|
84
|
+
pushContext(state, "}", stream.column());
|
|
85
|
+
} else if (/[\]\}\)]/.test(curPunc)) {
|
|
86
|
+
while (state.context && state.context.type === "pattern") {
|
|
87
|
+
popContext(state);
|
|
88
|
+
}
|
|
89
|
+
if (state.context && curPunc === state.context.type) {
|
|
90
|
+
popContext(state);
|
|
91
|
+
}
|
|
92
|
+
} else if (curPunc === "." && state.context && state.context.type === "pattern") {
|
|
93
|
+
popContext(state);
|
|
94
|
+
} else if (/atom|string|variable/.test(style) && state.context) {
|
|
95
|
+
if (/[\}\]]/.test(state.context.type)) {
|
|
96
|
+
pushContext(state, "pattern", stream.column());
|
|
97
|
+
} else if (state.context.type === "pattern" && !state.context.align) {
|
|
98
|
+
state.context.align = true;
|
|
99
|
+
state.context.col = stream.column();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return style;
|
|
103
|
+
},
|
|
104
|
+
indent: function(state, textAfter, cx) {
|
|
105
|
+
var firstChar = textAfter && textAfter.charAt(0);
|
|
106
|
+
var context = state.context;
|
|
107
|
+
if (/[\]\}]/.test(firstChar)) {
|
|
108
|
+
while (context && context.type === "pattern") {
|
|
109
|
+
context = context.prev;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
var closing = context && firstChar === context.type;
|
|
113
|
+
if (!context) return 0;
|
|
114
|
+
if (context.type === "keywords") return null;
|
|
115
|
+
if (context.align) return context.col + (closing ? 0 : 1);
|
|
116
|
+
return context.indent + (closing ? 0 : cx.unit);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
cypher
|
|
121
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
function words(str) {
|
|
2
|
+
var obj = {}, words2 = str.split(" ");
|
|
3
|
+
for (var i = 0; i < words2.length; ++i) obj[words2[i]] = true;
|
|
4
|
+
return obj;
|
|
5
|
+
}
|
|
6
|
+
var blockKeywordsStr = "body catch class do else enum for foreach foreach_reverse if in interface mixin out scope struct switch try union unittest version while with";
|
|
7
|
+
const parserConfig = {
|
|
8
|
+
keywords: words("abstract alias align asm assert auto break case cast cdouble cent cfloat const continue debug default delegate delete deprecated export extern final finally function goto immutable import inout invariant is lazy macro module new nothrow override package pragma private protected public pure ref return shared short static super synchronized template this throw typedef typeid typeof volatile __FILE__ __LINE__ __gshared __traits __vector __parameters " + blockKeywordsStr),
|
|
9
|
+
blockKeywords: words(blockKeywordsStr),
|
|
10
|
+
builtin: words("bool byte char creal dchar double float idouble ifloat int ireal long real short ubyte ucent uint ulong ushort wchar wstring void size_t sizediff_t"),
|
|
11
|
+
atoms: words("exit failure success true false null"),
|
|
12
|
+
hooks: {
|
|
13
|
+
"@": function(stream, _state) {
|
|
14
|
+
stream.eatWhile(/[\w\$_]/);
|
|
15
|
+
return "meta";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var statementIndentUnit = parserConfig.statementIndentUnit, keywords = parserConfig.keywords, builtin = parserConfig.builtin, blockKeywords = parserConfig.blockKeywords, atoms = parserConfig.atoms, hooks = parserConfig.hooks, multiLineStrings = parserConfig.multiLineStrings;
|
|
20
|
+
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
|
21
|
+
var curPunc;
|
|
22
|
+
function tokenBase(stream, state) {
|
|
23
|
+
var ch = stream.next();
|
|
24
|
+
if (hooks[ch]) {
|
|
25
|
+
var result = hooks[ch](stream, state);
|
|
26
|
+
if (result !== false) return result;
|
|
27
|
+
}
|
|
28
|
+
if (ch == '"' || ch == "'" || ch == "`") {
|
|
29
|
+
state.tokenize = tokenString(ch);
|
|
30
|
+
return state.tokenize(stream, state);
|
|
31
|
+
}
|
|
32
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
|
33
|
+
curPunc = ch;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (/\d/.test(ch)) {
|
|
37
|
+
stream.eatWhile(/[\w\.]/);
|
|
38
|
+
return "number";
|
|
39
|
+
}
|
|
40
|
+
if (ch == "/") {
|
|
41
|
+
if (stream.eat("+")) {
|
|
42
|
+
state.tokenize = tokenNestedComment;
|
|
43
|
+
return tokenNestedComment(stream, state);
|
|
44
|
+
}
|
|
45
|
+
if (stream.eat("*")) {
|
|
46
|
+
state.tokenize = tokenComment;
|
|
47
|
+
return tokenComment(stream, state);
|
|
48
|
+
}
|
|
49
|
+
if (stream.eat("/")) {
|
|
50
|
+
stream.skipToEnd();
|
|
51
|
+
return "comment";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (isOperatorChar.test(ch)) {
|
|
55
|
+
stream.eatWhile(isOperatorChar);
|
|
56
|
+
return "operator";
|
|
57
|
+
}
|
|
58
|
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
|
59
|
+
var cur = stream.current();
|
|
60
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
|
61
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
|
62
|
+
return "keyword";
|
|
63
|
+
}
|
|
64
|
+
if (builtin.propertyIsEnumerable(cur)) {
|
|
65
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
|
66
|
+
return "builtin";
|
|
67
|
+
}
|
|
68
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
|
69
|
+
return "variable";
|
|
70
|
+
}
|
|
71
|
+
function tokenString(quote) {
|
|
72
|
+
return function(stream, state) {
|
|
73
|
+
var escaped = false, next, end = false;
|
|
74
|
+
while ((next = stream.next()) != null) {
|
|
75
|
+
if (next == quote && !escaped) {
|
|
76
|
+
end = true;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
escaped = !escaped && next == "\\";
|
|
80
|
+
}
|
|
81
|
+
if (end || !(escaped || multiLineStrings))
|
|
82
|
+
state.tokenize = null;
|
|
83
|
+
return "string";
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function tokenComment(stream, state) {
|
|
87
|
+
var maybeEnd = false, ch;
|
|
88
|
+
while (ch = stream.next()) {
|
|
89
|
+
if (ch == "/" && maybeEnd) {
|
|
90
|
+
state.tokenize = null;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
maybeEnd = ch == "*";
|
|
94
|
+
}
|
|
95
|
+
return "comment";
|
|
96
|
+
}
|
|
97
|
+
function tokenNestedComment(stream, state) {
|
|
98
|
+
var maybeEnd = false, ch;
|
|
99
|
+
while (ch = stream.next()) {
|
|
100
|
+
if (ch == "/" && maybeEnd) {
|
|
101
|
+
state.tokenize = null;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
maybeEnd = ch == "+";
|
|
105
|
+
}
|
|
106
|
+
return "comment";
|
|
107
|
+
}
|
|
108
|
+
function Context(indented, column, type, align, prev) {
|
|
109
|
+
this.indented = indented;
|
|
110
|
+
this.column = column;
|
|
111
|
+
this.type = type;
|
|
112
|
+
this.align = align;
|
|
113
|
+
this.prev = prev;
|
|
114
|
+
}
|
|
115
|
+
function pushContext(state, col, type) {
|
|
116
|
+
var indent = state.indented;
|
|
117
|
+
if (state.context && state.context.type == "statement")
|
|
118
|
+
indent = state.context.indented;
|
|
119
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
|
120
|
+
}
|
|
121
|
+
function popContext(state) {
|
|
122
|
+
var t = state.context.type;
|
|
123
|
+
if (t == ")" || t == "]" || t == "}")
|
|
124
|
+
state.indented = state.context.indented;
|
|
125
|
+
return state.context = state.context.prev;
|
|
126
|
+
}
|
|
127
|
+
const d = {
|
|
128
|
+
name: "d",
|
|
129
|
+
startState: function(indentUnit) {
|
|
130
|
+
return {
|
|
131
|
+
tokenize: null,
|
|
132
|
+
context: new Context(-indentUnit, 0, "top", false),
|
|
133
|
+
indented: 0,
|
|
134
|
+
startOfLine: true
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
token: function(stream, state) {
|
|
138
|
+
var ctx = state.context;
|
|
139
|
+
if (stream.sol()) {
|
|
140
|
+
if (ctx.align == null) ctx.align = false;
|
|
141
|
+
state.indented = stream.indentation();
|
|
142
|
+
state.startOfLine = true;
|
|
143
|
+
}
|
|
144
|
+
if (stream.eatSpace()) return null;
|
|
145
|
+
curPunc = null;
|
|
146
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
|
147
|
+
if (style == "comment" || style == "meta") return style;
|
|
148
|
+
if (ctx.align == null) ctx.align = true;
|
|
149
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
|
|
150
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
|
151
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
|
152
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
|
153
|
+
else if (curPunc == "}") {
|
|
154
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
|
155
|
+
if (ctx.type == "}") ctx = popContext(state);
|
|
156
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
|
157
|
+
} else if (curPunc == ctx.type) popContext(state);
|
|
158
|
+
else if ((ctx.type == "}" || ctx.type == "top") && curPunc != ";" || ctx.type == "statement" && curPunc == "newstatement")
|
|
159
|
+
pushContext(state, stream.column(), "statement");
|
|
160
|
+
state.startOfLine = false;
|
|
161
|
+
return style;
|
|
162
|
+
},
|
|
163
|
+
indent: function(state, textAfter, cx) {
|
|
164
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return null;
|
|
165
|
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
|
166
|
+
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
|
167
|
+
var closing = firstChar == ctx.type;
|
|
168
|
+
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit || cx.unit);
|
|
169
|
+
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
|
170
|
+
else return ctx.indented + (closing ? 0 : cx.unit);
|
|
171
|
+
},
|
|
172
|
+
languageData: {
|
|
173
|
+
indentOnInput: /^\s*[{}]$/,
|
|
174
|
+
commentTokens: { line: "//", block: { open: "/*", close: "*/" } }
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
d
|
|
179
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var TOKEN_NAMES = {
|
|
2
|
+
"+": "inserted",
|
|
3
|
+
"-": "deleted",
|
|
4
|
+
"@": "meta"
|
|
5
|
+
};
|
|
6
|
+
const diff = {
|
|
7
|
+
name: "diff",
|
|
8
|
+
token: function(stream) {
|
|
9
|
+
var tw_pos = stream.string.search(/[\t ]+?$/);
|
|
10
|
+
if (!stream.sol() || tw_pos === 0) {
|
|
11
|
+
stream.skipToEnd();
|
|
12
|
+
return ("error " + (TOKEN_NAMES[stream.string.charAt(0)] || "")).replace(/ $/, "");
|
|
13
|
+
}
|
|
14
|
+
var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
|
|
15
|
+
if (tw_pos === -1) {
|
|
16
|
+
stream.skipToEnd();
|
|
17
|
+
} else {
|
|
18
|
+
stream.pos = tw_pos;
|
|
19
|
+
}
|
|
20
|
+
return token_name;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
diff
|
|
25
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { s as simpleMode } from "./simple-mode-DMneyfDu.js";
|
|
2
|
+
var from = "from";
|
|
3
|
+
var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
|
|
4
|
+
var shells = ["run", "cmd", "entrypoint", "shell"];
|
|
5
|
+
var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join("|") + ")(\\s+\\[)", "i");
|
|
6
|
+
var expose = "expose";
|
|
7
|
+
var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
|
|
8
|
+
var others = [
|
|
9
|
+
"arg",
|
|
10
|
+
"from",
|
|
11
|
+
"maintainer",
|
|
12
|
+
"label",
|
|
13
|
+
"env",
|
|
14
|
+
"add",
|
|
15
|
+
"copy",
|
|
16
|
+
"volume",
|
|
17
|
+
"user",
|
|
18
|
+
"workdir",
|
|
19
|
+
"onbuild",
|
|
20
|
+
"stopsignal",
|
|
21
|
+
"healthcheck",
|
|
22
|
+
"shell"
|
|
23
|
+
];
|
|
24
|
+
var instructions = [from, expose].concat(shells).concat(others), instructionRegex = "(" + instructions.join("|") + ")", instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"), instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
|
|
25
|
+
const dockerFile = simpleMode({
|
|
26
|
+
start: [
|
|
27
|
+
// Block comment: This is a line starting with a comment
|
|
28
|
+
{
|
|
29
|
+
regex: /^\s*#.*$/,
|
|
30
|
+
sol: true,
|
|
31
|
+
token: "comment"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
regex: fromRegex,
|
|
35
|
+
token: [null, "keyword"],
|
|
36
|
+
sol: true,
|
|
37
|
+
next: "from"
|
|
38
|
+
},
|
|
39
|
+
// Highlight an instruction without any arguments (for convenience)
|
|
40
|
+
{
|
|
41
|
+
regex: instructionOnlyLine,
|
|
42
|
+
token: [null, "keyword", null, "error"],
|
|
43
|
+
sol: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
regex: shellsAsArrayRegex,
|
|
47
|
+
token: [null, "keyword", null],
|
|
48
|
+
sol: true,
|
|
49
|
+
next: "array"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
regex: exposeRegex,
|
|
53
|
+
token: [null, "keyword", null],
|
|
54
|
+
sol: true,
|
|
55
|
+
next: "expose"
|
|
56
|
+
},
|
|
57
|
+
// Highlight an instruction followed by arguments
|
|
58
|
+
{
|
|
59
|
+
regex: instructionWithArguments,
|
|
60
|
+
token: [null, "keyword", null],
|
|
61
|
+
sol: true,
|
|
62
|
+
next: "arguments"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
regex: /./,
|
|
66
|
+
token: null
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
from: [
|
|
70
|
+
{
|
|
71
|
+
regex: /\s*$/,
|
|
72
|
+
token: null,
|
|
73
|
+
next: "start"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
// Line comment without instruction arguments is an error
|
|
77
|
+
regex: /(\s*)(#.*)$/,
|
|
78
|
+
token: [null, "error"],
|
|
79
|
+
next: "start"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
regex: /(\s*\S+\s+)(as)/i,
|
|
83
|
+
token: [null, "keyword"],
|
|
84
|
+
next: "start"
|
|
85
|
+
},
|
|
86
|
+
// Fail safe return to start
|
|
87
|
+
{
|
|
88
|
+
token: null,
|
|
89
|
+
next: "start"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
single: [
|
|
93
|
+
{
|
|
94
|
+
regex: /(?:[^\\']|\\.)/,
|
|
95
|
+
token: "string"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
regex: /'/,
|
|
99
|
+
token: "string",
|
|
100
|
+
pop: true
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
double: [
|
|
104
|
+
{
|
|
105
|
+
regex: /(?:[^\\"]|\\.)/,
|
|
106
|
+
token: "string"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
regex: /"/,
|
|
110
|
+
token: "string",
|
|
111
|
+
pop: true
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
array: [
|
|
115
|
+
{
|
|
116
|
+
regex: /\]/,
|
|
117
|
+
token: null,
|
|
118
|
+
next: "start"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
regex: /"(?:[^\\"]|\\.)*"?/,
|
|
122
|
+
token: "string"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
expose: [
|
|
126
|
+
{
|
|
127
|
+
regex: /\d+$/,
|
|
128
|
+
token: "number",
|
|
129
|
+
next: "start"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
regex: /[^\d]+$/,
|
|
133
|
+
token: null,
|
|
134
|
+
next: "start"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
regex: /\d+/,
|
|
138
|
+
token: "number"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
regex: /[^\d]+/,
|
|
142
|
+
token: null
|
|
143
|
+
},
|
|
144
|
+
// Fail safe return to start
|
|
145
|
+
{
|
|
146
|
+
token: null,
|
|
147
|
+
next: "start"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
arguments: [
|
|
151
|
+
{
|
|
152
|
+
regex: /^\s*#.*$/,
|
|
153
|
+
sol: true,
|
|
154
|
+
token: "comment"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
regex: /"(?:[^\\"]|\\.)*"?$/,
|
|
158
|
+
token: "string",
|
|
159
|
+
next: "start"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
regex: /"/,
|
|
163
|
+
token: "string",
|
|
164
|
+
push: "double"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
regex: /'(?:[^\\']|\\.)*'?$/,
|
|
168
|
+
token: "string",
|
|
169
|
+
next: "start"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
regex: /'/,
|
|
173
|
+
token: "string",
|
|
174
|
+
push: "single"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
regex: /[^#"']+[\\`]$/,
|
|
178
|
+
token: null
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
regex: /[^#"']+$/,
|
|
182
|
+
token: null,
|
|
183
|
+
next: "start"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
regex: /[^#"']+/,
|
|
187
|
+
token: null
|
|
188
|
+
},
|
|
189
|
+
// Fail safe return to start
|
|
190
|
+
{
|
|
191
|
+
token: null,
|
|
192
|
+
next: "start"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
languageData: {
|
|
196
|
+
commentTokens: { line: "#" }
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
export {
|
|
200
|
+
dockerFile
|
|
201
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var type;
|
|
2
|
+
function ret(style, tp) {
|
|
3
|
+
type = tp;
|
|
4
|
+
return style;
|
|
5
|
+
}
|
|
6
|
+
function tokenBase(stream, state) {
|
|
7
|
+
var ch = stream.next();
|
|
8
|
+
if (ch == "<" && stream.eat("!")) {
|
|
9
|
+
if (stream.eatWhile(/[\-]/)) {
|
|
10
|
+
state.tokenize = tokenSGMLComment;
|
|
11
|
+
return tokenSGMLComment(stream, state);
|
|
12
|
+
} else if (stream.eatWhile(/[\w]/)) return ret("keyword", "doindent");
|
|
13
|
+
} else if (ch == "<" && stream.eat("?")) {
|
|
14
|
+
state.tokenize = inBlock("meta", "?>");
|
|
15
|
+
return ret("meta", ch);
|
|
16
|
+
} else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag");
|
|
17
|
+
else if (ch == "|") return ret("keyword", "separator");
|
|
18
|
+
else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);
|
|
19
|
+
else if (ch.match(/[\[\]]/)) return ret("rule", ch);
|
|
20
|
+
else if (ch == '"' || ch == "'") {
|
|
21
|
+
state.tokenize = tokenString(ch);
|
|
22
|
+
return state.tokenize(stream, state);
|
|
23
|
+
} else if (stream.eatWhile(/[a-zA-Z\?\+\d]/)) {
|
|
24
|
+
var sc = stream.current();
|
|
25
|
+
if (sc.substr(sc.length - 1, sc.length).match(/\?|\+/) !== null) stream.backUp(1);
|
|
26
|
+
return ret("tag", "tag");
|
|
27
|
+
} else if (ch == "%" || ch == "*") return ret("number", "number");
|
|
28
|
+
else {
|
|
29
|
+
stream.eatWhile(/[\w\\\-_%.{,]/);
|
|
30
|
+
return ret(null, null);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function tokenSGMLComment(stream, state) {
|
|
34
|
+
var dashes = 0, ch;
|
|
35
|
+
while ((ch = stream.next()) != null) {
|
|
36
|
+
if (dashes >= 2 && ch == ">") {
|
|
37
|
+
state.tokenize = tokenBase;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
dashes = ch == "-" ? dashes + 1 : 0;
|
|
41
|
+
}
|
|
42
|
+
return ret("comment", "comment");
|
|
43
|
+
}
|
|
44
|
+
function tokenString(quote) {
|
|
45
|
+
return function(stream, state) {
|
|
46
|
+
var escaped = false, ch;
|
|
47
|
+
while ((ch = stream.next()) != null) {
|
|
48
|
+
if (ch == quote && !escaped) {
|
|
49
|
+
state.tokenize = tokenBase;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
escaped = !escaped && ch == "\\";
|
|
53
|
+
}
|
|
54
|
+
return ret("string", "tag");
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function inBlock(style, terminator) {
|
|
58
|
+
return function(stream, state) {
|
|
59
|
+
while (!stream.eol()) {
|
|
60
|
+
if (stream.match(terminator)) {
|
|
61
|
+
state.tokenize = tokenBase;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
stream.next();
|
|
65
|
+
}
|
|
66
|
+
return style;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const dtd = {
|
|
70
|
+
name: "dtd",
|
|
71
|
+
startState: function() {
|
|
72
|
+
return {
|
|
73
|
+
tokenize: tokenBase,
|
|
74
|
+
baseIndent: 0,
|
|
75
|
+
stack: []
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
token: function(stream, state) {
|
|
79
|
+
if (stream.eatSpace()) return null;
|
|
80
|
+
var style = state.tokenize(stream, state);
|
|
81
|
+
var context = state.stack[state.stack.length - 1];
|
|
82
|
+
if (stream.current() == "[" || type === "doindent" || type == "[") state.stack.push("rule");
|
|
83
|
+
else if (type === "endtag") state.stack[state.stack.length - 1] = "endtag";
|
|
84
|
+
else if (stream.current() == "]" || type == "]" || type == ">" && context == "rule") state.stack.pop();
|
|
85
|
+
else if (type == "[") state.stack.push("[");
|
|
86
|
+
return style;
|
|
87
|
+
},
|
|
88
|
+
indent: function(state, textAfter, cx) {
|
|
89
|
+
var n = state.stack.length;
|
|
90
|
+
if (textAfter.charAt(0) === "]") n--;
|
|
91
|
+
else if (textAfter.substr(textAfter.length - 1, textAfter.length) === ">") {
|
|
92
|
+
if (textAfter.substr(0, 1) === "<") ;
|
|
93
|
+
else if (type == "doindent" && textAfter.length > 1) ;
|
|
94
|
+
else if (type == "doindent") n--;
|
|
95
|
+
else if (type == ">" && textAfter.length > 1) ;
|
|
96
|
+
else if (type == "tag" && textAfter !== ">") ;
|
|
97
|
+
else if (type == "tag" && state.stack[state.stack.length - 1] == "rule") n--;
|
|
98
|
+
else if (type == "tag") n++;
|
|
99
|
+
else if (textAfter === ">" && state.stack[state.stack.length - 1] == "rule" && type === ">") n--;
|
|
100
|
+
else if (textAfter === ">" && state.stack[state.stack.length - 1] == "rule") ;
|
|
101
|
+
else if (textAfter.substr(0, 1) !== "<" && textAfter.substr(0, 1) === ">") n = n - 1;
|
|
102
|
+
else if (textAfter === ">") ;
|
|
103
|
+
else n = n - 1;
|
|
104
|
+
if (type == null || type == "]") n--;
|
|
105
|
+
}
|
|
106
|
+
return state.baseIndent + n * cx.unit;
|
|
107
|
+
},
|
|
108
|
+
languageData: {
|
|
109
|
+
indentOnInput: /^\s*[\]>]$/
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
dtd
|
|
114
|
+
};
|