@aleph-alpha/chat-kit 6.0.0 → 6.1.0
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 +1166 -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 +10 -4
- 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 +441 -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,334 @@
|
|
|
1
|
+
function mlLike(parserConfig) {
|
|
2
|
+
var words = {
|
|
3
|
+
"as": "keyword",
|
|
4
|
+
"do": "keyword",
|
|
5
|
+
"else": "keyword",
|
|
6
|
+
"end": "keyword",
|
|
7
|
+
"exception": "keyword",
|
|
8
|
+
"fun": "keyword",
|
|
9
|
+
"functor": "keyword",
|
|
10
|
+
"if": "keyword",
|
|
11
|
+
"in": "keyword",
|
|
12
|
+
"include": "keyword",
|
|
13
|
+
"let": "keyword",
|
|
14
|
+
"of": "keyword",
|
|
15
|
+
"open": "keyword",
|
|
16
|
+
"rec": "keyword",
|
|
17
|
+
"struct": "keyword",
|
|
18
|
+
"then": "keyword",
|
|
19
|
+
"type": "keyword",
|
|
20
|
+
"val": "keyword",
|
|
21
|
+
"while": "keyword",
|
|
22
|
+
"with": "keyword"
|
|
23
|
+
};
|
|
24
|
+
var extraWords = parserConfig.extraWords || {};
|
|
25
|
+
for (var prop in extraWords) {
|
|
26
|
+
if (extraWords.hasOwnProperty(prop)) {
|
|
27
|
+
words[prop] = parserConfig.extraWords[prop];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var hintWords = [];
|
|
31
|
+
for (var k in words) {
|
|
32
|
+
hintWords.push(k);
|
|
33
|
+
}
|
|
34
|
+
function tokenBase(stream, state) {
|
|
35
|
+
var ch = stream.next();
|
|
36
|
+
if (ch === '"') {
|
|
37
|
+
state.tokenize = tokenString;
|
|
38
|
+
return state.tokenize(stream, state);
|
|
39
|
+
}
|
|
40
|
+
if (ch === "{") {
|
|
41
|
+
if (stream.eat("|")) {
|
|
42
|
+
state.longString = true;
|
|
43
|
+
state.tokenize = tokenLongString;
|
|
44
|
+
return state.tokenize(stream, state);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (ch === "(") {
|
|
48
|
+
if (stream.match(/^\*(?!\))/)) {
|
|
49
|
+
state.commentLevel++;
|
|
50
|
+
state.tokenize = tokenComment;
|
|
51
|
+
return state.tokenize(stream, state);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (ch === "~" || ch === "?") {
|
|
55
|
+
stream.eatWhile(/\w/);
|
|
56
|
+
return "variableName.special";
|
|
57
|
+
}
|
|
58
|
+
if (ch === "`") {
|
|
59
|
+
stream.eatWhile(/\w/);
|
|
60
|
+
return "quote";
|
|
61
|
+
}
|
|
62
|
+
if (ch === "/" && parserConfig.slashComments && stream.eat("/")) {
|
|
63
|
+
stream.skipToEnd();
|
|
64
|
+
return "comment";
|
|
65
|
+
}
|
|
66
|
+
if (/\d/.test(ch)) {
|
|
67
|
+
if (ch === "0" && stream.eat(/[bB]/)) {
|
|
68
|
+
stream.eatWhile(/[01]/);
|
|
69
|
+
}
|
|
70
|
+
if (ch === "0" && stream.eat(/[xX]/)) {
|
|
71
|
+
stream.eatWhile(/[0-9a-fA-F]/);
|
|
72
|
+
}
|
|
73
|
+
if (ch === "0" && stream.eat(/[oO]/)) {
|
|
74
|
+
stream.eatWhile(/[0-7]/);
|
|
75
|
+
} else {
|
|
76
|
+
stream.eatWhile(/[\d_]/);
|
|
77
|
+
if (stream.eat(".")) {
|
|
78
|
+
stream.eatWhile(/[\d]/);
|
|
79
|
+
}
|
|
80
|
+
if (stream.eat(/[eE]/)) {
|
|
81
|
+
stream.eatWhile(/[\d\-+]/);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return "number";
|
|
85
|
+
}
|
|
86
|
+
if (/[+\-*&%=<>!?|@\.~:]/.test(ch)) {
|
|
87
|
+
return "operator";
|
|
88
|
+
}
|
|
89
|
+
if (/[\w\xa1-\uffff]/.test(ch)) {
|
|
90
|
+
stream.eatWhile(/[\w\xa1-\uffff]/);
|
|
91
|
+
var cur = stream.current();
|
|
92
|
+
return words.hasOwnProperty(cur) ? words[cur] : "variable";
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
function tokenString(stream, state) {
|
|
97
|
+
var next, end = false, escaped = false;
|
|
98
|
+
while ((next = stream.next()) != null) {
|
|
99
|
+
if (next === '"' && !escaped) {
|
|
100
|
+
end = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
escaped = !escaped && next === "\\";
|
|
104
|
+
}
|
|
105
|
+
if (end && !escaped) {
|
|
106
|
+
state.tokenize = tokenBase;
|
|
107
|
+
}
|
|
108
|
+
return "string";
|
|
109
|
+
}
|
|
110
|
+
function tokenComment(stream, state) {
|
|
111
|
+
var prev, next;
|
|
112
|
+
while (state.commentLevel > 0 && (next = stream.next()) != null) {
|
|
113
|
+
if (prev === "(" && next === "*") state.commentLevel++;
|
|
114
|
+
if (prev === "*" && next === ")") state.commentLevel--;
|
|
115
|
+
prev = next;
|
|
116
|
+
}
|
|
117
|
+
if (state.commentLevel <= 0) {
|
|
118
|
+
state.tokenize = tokenBase;
|
|
119
|
+
}
|
|
120
|
+
return "comment";
|
|
121
|
+
}
|
|
122
|
+
function tokenLongString(stream, state) {
|
|
123
|
+
var prev, next;
|
|
124
|
+
while (state.longString && (next = stream.next()) != null) {
|
|
125
|
+
if (prev === "|" && next === "}") state.longString = false;
|
|
126
|
+
prev = next;
|
|
127
|
+
}
|
|
128
|
+
if (!state.longString) {
|
|
129
|
+
state.tokenize = tokenBase;
|
|
130
|
+
}
|
|
131
|
+
return "string";
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
startState: function() {
|
|
135
|
+
return { tokenize: tokenBase, commentLevel: 0, longString: false };
|
|
136
|
+
},
|
|
137
|
+
token: function(stream, state) {
|
|
138
|
+
if (stream.eatSpace()) return null;
|
|
139
|
+
return state.tokenize(stream, state);
|
|
140
|
+
},
|
|
141
|
+
languageData: {
|
|
142
|
+
autocomplete: hintWords,
|
|
143
|
+
commentTokens: {
|
|
144
|
+
line: parserConfig.slashComments ? "//" : void 0,
|
|
145
|
+
block: { open: "(*", close: "*)" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const oCaml = mlLike({
|
|
151
|
+
extraWords: {
|
|
152
|
+
"and": "keyword",
|
|
153
|
+
"assert": "keyword",
|
|
154
|
+
"begin": "keyword",
|
|
155
|
+
"class": "keyword",
|
|
156
|
+
"constraint": "keyword",
|
|
157
|
+
"done": "keyword",
|
|
158
|
+
"downto": "keyword",
|
|
159
|
+
"external": "keyword",
|
|
160
|
+
"function": "keyword",
|
|
161
|
+
"initializer": "keyword",
|
|
162
|
+
"lazy": "keyword",
|
|
163
|
+
"match": "keyword",
|
|
164
|
+
"method": "keyword",
|
|
165
|
+
"module": "keyword",
|
|
166
|
+
"mutable": "keyword",
|
|
167
|
+
"new": "keyword",
|
|
168
|
+
"nonrec": "keyword",
|
|
169
|
+
"object": "keyword",
|
|
170
|
+
"private": "keyword",
|
|
171
|
+
"sig": "keyword",
|
|
172
|
+
"to": "keyword",
|
|
173
|
+
"try": "keyword",
|
|
174
|
+
"value": "keyword",
|
|
175
|
+
"virtual": "keyword",
|
|
176
|
+
"when": "keyword",
|
|
177
|
+
// builtins
|
|
178
|
+
"raise": "builtin",
|
|
179
|
+
"failwith": "builtin",
|
|
180
|
+
"true": "builtin",
|
|
181
|
+
"false": "builtin",
|
|
182
|
+
// Pervasives builtins
|
|
183
|
+
"asr": "builtin",
|
|
184
|
+
"land": "builtin",
|
|
185
|
+
"lor": "builtin",
|
|
186
|
+
"lsl": "builtin",
|
|
187
|
+
"lsr": "builtin",
|
|
188
|
+
"lxor": "builtin",
|
|
189
|
+
"mod": "builtin",
|
|
190
|
+
"or": "builtin",
|
|
191
|
+
// More Pervasives
|
|
192
|
+
"raise_notrace": "builtin",
|
|
193
|
+
"trace": "builtin",
|
|
194
|
+
"exit": "builtin",
|
|
195
|
+
"print_string": "builtin",
|
|
196
|
+
"print_endline": "builtin",
|
|
197
|
+
"int": "type",
|
|
198
|
+
"float": "type",
|
|
199
|
+
"bool": "type",
|
|
200
|
+
"char": "type",
|
|
201
|
+
"string": "type",
|
|
202
|
+
"unit": "type",
|
|
203
|
+
// Modules
|
|
204
|
+
"List": "builtin"
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const fSharp = mlLike({
|
|
208
|
+
extraWords: {
|
|
209
|
+
"abstract": "keyword",
|
|
210
|
+
"assert": "keyword",
|
|
211
|
+
"base": "keyword",
|
|
212
|
+
"begin": "keyword",
|
|
213
|
+
"class": "keyword",
|
|
214
|
+
"default": "keyword",
|
|
215
|
+
"delegate": "keyword",
|
|
216
|
+
"do!": "keyword",
|
|
217
|
+
"done": "keyword",
|
|
218
|
+
"downcast": "keyword",
|
|
219
|
+
"downto": "keyword",
|
|
220
|
+
"elif": "keyword",
|
|
221
|
+
"extern": "keyword",
|
|
222
|
+
"finally": "keyword",
|
|
223
|
+
"for": "keyword",
|
|
224
|
+
"function": "keyword",
|
|
225
|
+
"global": "keyword",
|
|
226
|
+
"inherit": "keyword",
|
|
227
|
+
"inline": "keyword",
|
|
228
|
+
"interface": "keyword",
|
|
229
|
+
"internal": "keyword",
|
|
230
|
+
"lazy": "keyword",
|
|
231
|
+
"let!": "keyword",
|
|
232
|
+
"match": "keyword",
|
|
233
|
+
"member": "keyword",
|
|
234
|
+
"module": "keyword",
|
|
235
|
+
"mutable": "keyword",
|
|
236
|
+
"namespace": "keyword",
|
|
237
|
+
"new": "keyword",
|
|
238
|
+
"null": "keyword",
|
|
239
|
+
"override": "keyword",
|
|
240
|
+
"private": "keyword",
|
|
241
|
+
"public": "keyword",
|
|
242
|
+
"return!": "keyword",
|
|
243
|
+
"return": "keyword",
|
|
244
|
+
"select": "keyword",
|
|
245
|
+
"static": "keyword",
|
|
246
|
+
"to": "keyword",
|
|
247
|
+
"try": "keyword",
|
|
248
|
+
"upcast": "keyword",
|
|
249
|
+
"use!": "keyword",
|
|
250
|
+
"use": "keyword",
|
|
251
|
+
"void": "keyword",
|
|
252
|
+
"when": "keyword",
|
|
253
|
+
"yield!": "keyword",
|
|
254
|
+
"yield": "keyword",
|
|
255
|
+
// Reserved words
|
|
256
|
+
"atomic": "keyword",
|
|
257
|
+
"break": "keyword",
|
|
258
|
+
"checked": "keyword",
|
|
259
|
+
"component": "keyword",
|
|
260
|
+
"const": "keyword",
|
|
261
|
+
"constraint": "keyword",
|
|
262
|
+
"constructor": "keyword",
|
|
263
|
+
"continue": "keyword",
|
|
264
|
+
"eager": "keyword",
|
|
265
|
+
"event": "keyword",
|
|
266
|
+
"external": "keyword",
|
|
267
|
+
"fixed": "keyword",
|
|
268
|
+
"method": "keyword",
|
|
269
|
+
"mixin": "keyword",
|
|
270
|
+
"object": "keyword",
|
|
271
|
+
"parallel": "keyword",
|
|
272
|
+
"process": "keyword",
|
|
273
|
+
"protected": "keyword",
|
|
274
|
+
"pure": "keyword",
|
|
275
|
+
"sealed": "keyword",
|
|
276
|
+
"tailcall": "keyword",
|
|
277
|
+
"trait": "keyword",
|
|
278
|
+
"virtual": "keyword",
|
|
279
|
+
"volatile": "keyword",
|
|
280
|
+
// builtins
|
|
281
|
+
"List": "builtin",
|
|
282
|
+
"Seq": "builtin",
|
|
283
|
+
"Map": "builtin",
|
|
284
|
+
"Set": "builtin",
|
|
285
|
+
"Option": "builtin",
|
|
286
|
+
"int": "builtin",
|
|
287
|
+
"string": "builtin",
|
|
288
|
+
"not": "builtin",
|
|
289
|
+
"true": "builtin",
|
|
290
|
+
"false": "builtin",
|
|
291
|
+
"raise": "builtin",
|
|
292
|
+
"failwith": "builtin"
|
|
293
|
+
},
|
|
294
|
+
slashComments: true
|
|
295
|
+
});
|
|
296
|
+
const sml = mlLike({
|
|
297
|
+
extraWords: {
|
|
298
|
+
"abstype": "keyword",
|
|
299
|
+
"and": "keyword",
|
|
300
|
+
"andalso": "keyword",
|
|
301
|
+
"case": "keyword",
|
|
302
|
+
"datatype": "keyword",
|
|
303
|
+
"fn": "keyword",
|
|
304
|
+
"handle": "keyword",
|
|
305
|
+
"infix": "keyword",
|
|
306
|
+
"infixr": "keyword",
|
|
307
|
+
"local": "keyword",
|
|
308
|
+
"nonfix": "keyword",
|
|
309
|
+
"op": "keyword",
|
|
310
|
+
"orelse": "keyword",
|
|
311
|
+
"raise": "keyword",
|
|
312
|
+
"withtype": "keyword",
|
|
313
|
+
"eqtype": "keyword",
|
|
314
|
+
"sharing": "keyword",
|
|
315
|
+
"sig": "keyword",
|
|
316
|
+
"signature": "keyword",
|
|
317
|
+
"structure": "keyword",
|
|
318
|
+
"where": "keyword",
|
|
319
|
+
"true": "keyword",
|
|
320
|
+
"false": "keyword",
|
|
321
|
+
// types
|
|
322
|
+
"int": "builtin",
|
|
323
|
+
"real": "builtin",
|
|
324
|
+
"string": "builtin",
|
|
325
|
+
"char": "builtin",
|
|
326
|
+
"bool": "builtin"
|
|
327
|
+
},
|
|
328
|
+
slashComments: true
|
|
329
|
+
});
|
|
330
|
+
export {
|
|
331
|
+
fSharp,
|
|
332
|
+
oCaml,
|
|
333
|
+
sml
|
|
334
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
function words(str) {
|
|
2
|
+
var obj = {}, words2 = str.split(" ");
|
|
3
|
+
for (var i = 0; i < words2.length; ++i)
|
|
4
|
+
obj[words2[i]] = true;
|
|
5
|
+
return obj;
|
|
6
|
+
}
|
|
7
|
+
var keywords = words("algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within");
|
|
8
|
+
var builtin = words("abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh");
|
|
9
|
+
var atoms = words("Real Boolean Integer String");
|
|
10
|
+
var completions = [].concat(Object.keys(keywords), Object.keys(builtin), Object.keys(atoms));
|
|
11
|
+
var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/;
|
|
12
|
+
var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/;
|
|
13
|
+
var isDigit = /[0-9]/;
|
|
14
|
+
var isNonDigit = /[_a-zA-Z]/;
|
|
15
|
+
function tokenLineComment(stream, state) {
|
|
16
|
+
stream.skipToEnd();
|
|
17
|
+
state.tokenize = null;
|
|
18
|
+
return "comment";
|
|
19
|
+
}
|
|
20
|
+
function tokenBlockComment(stream, state) {
|
|
21
|
+
var maybeEnd = false, ch;
|
|
22
|
+
while (ch = stream.next()) {
|
|
23
|
+
if (maybeEnd && ch == "/") {
|
|
24
|
+
state.tokenize = null;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
maybeEnd = ch == "*";
|
|
28
|
+
}
|
|
29
|
+
return "comment";
|
|
30
|
+
}
|
|
31
|
+
function tokenString(stream, state) {
|
|
32
|
+
var escaped = false, ch;
|
|
33
|
+
while ((ch = stream.next()) != null) {
|
|
34
|
+
if (ch == '"' && !escaped) {
|
|
35
|
+
state.tokenize = null;
|
|
36
|
+
state.sol = false;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
escaped = !escaped && ch == "\\";
|
|
40
|
+
}
|
|
41
|
+
return "string";
|
|
42
|
+
}
|
|
43
|
+
function tokenIdent(stream, state) {
|
|
44
|
+
stream.eatWhile(isDigit);
|
|
45
|
+
while (stream.eat(isDigit) || stream.eat(isNonDigit)) {
|
|
46
|
+
}
|
|
47
|
+
var cur = stream.current();
|
|
48
|
+
if (state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++;
|
|
49
|
+
else if (state.sol && cur == "end" && state.level > 0) state.level--;
|
|
50
|
+
state.tokenize = null;
|
|
51
|
+
state.sol = false;
|
|
52
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
|
53
|
+
else if (builtin.propertyIsEnumerable(cur)) return "builtin";
|
|
54
|
+
else if (atoms.propertyIsEnumerable(cur)) return "atom";
|
|
55
|
+
else return "variable";
|
|
56
|
+
}
|
|
57
|
+
function tokenQIdent(stream, state) {
|
|
58
|
+
while (stream.eat(/[^']/)) {
|
|
59
|
+
}
|
|
60
|
+
state.tokenize = null;
|
|
61
|
+
state.sol = false;
|
|
62
|
+
if (stream.eat("'"))
|
|
63
|
+
return "variable";
|
|
64
|
+
else
|
|
65
|
+
return "error";
|
|
66
|
+
}
|
|
67
|
+
function tokenUnsignedNumber(stream, state) {
|
|
68
|
+
stream.eatWhile(isDigit);
|
|
69
|
+
if (stream.eat(".")) {
|
|
70
|
+
stream.eatWhile(isDigit);
|
|
71
|
+
}
|
|
72
|
+
if (stream.eat("e") || stream.eat("E")) {
|
|
73
|
+
if (!stream.eat("-"))
|
|
74
|
+
stream.eat("+");
|
|
75
|
+
stream.eatWhile(isDigit);
|
|
76
|
+
}
|
|
77
|
+
state.tokenize = null;
|
|
78
|
+
state.sol = false;
|
|
79
|
+
return "number";
|
|
80
|
+
}
|
|
81
|
+
const modelica = {
|
|
82
|
+
name: "modelica",
|
|
83
|
+
startState: function() {
|
|
84
|
+
return {
|
|
85
|
+
tokenize: null,
|
|
86
|
+
level: 0,
|
|
87
|
+
sol: true
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
token: function(stream, state) {
|
|
91
|
+
if (state.tokenize != null) {
|
|
92
|
+
return state.tokenize(stream, state);
|
|
93
|
+
}
|
|
94
|
+
if (stream.sol()) {
|
|
95
|
+
state.sol = true;
|
|
96
|
+
}
|
|
97
|
+
if (stream.eatSpace()) {
|
|
98
|
+
state.tokenize = null;
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
var ch = stream.next();
|
|
102
|
+
if (ch == "/" && stream.eat("/")) {
|
|
103
|
+
state.tokenize = tokenLineComment;
|
|
104
|
+
} else if (ch == "/" && stream.eat("*")) {
|
|
105
|
+
state.tokenize = tokenBlockComment;
|
|
106
|
+
} else if (isDoubleOperatorChar.test(ch + stream.peek())) {
|
|
107
|
+
stream.next();
|
|
108
|
+
state.tokenize = null;
|
|
109
|
+
return "operator";
|
|
110
|
+
} else if (isSingleOperatorChar.test(ch)) {
|
|
111
|
+
state.tokenize = null;
|
|
112
|
+
return "operator";
|
|
113
|
+
} else if (isNonDigit.test(ch)) {
|
|
114
|
+
state.tokenize = tokenIdent;
|
|
115
|
+
} else if (ch == "'" && stream.peek() && stream.peek() != "'") {
|
|
116
|
+
state.tokenize = tokenQIdent;
|
|
117
|
+
} else if (ch == '"') {
|
|
118
|
+
state.tokenize = tokenString;
|
|
119
|
+
} else if (isDigit.test(ch)) {
|
|
120
|
+
state.tokenize = tokenUnsignedNumber;
|
|
121
|
+
} else {
|
|
122
|
+
state.tokenize = null;
|
|
123
|
+
return "error";
|
|
124
|
+
}
|
|
125
|
+
return state.tokenize(stream, state);
|
|
126
|
+
},
|
|
127
|
+
indent: function(state, textAfter, cx) {
|
|
128
|
+
if (state.tokenize != null) return null;
|
|
129
|
+
var level = state.level;
|
|
130
|
+
if (/(algorithm)/.test(textAfter)) level--;
|
|
131
|
+
if (/(equation)/.test(textAfter)) level--;
|
|
132
|
+
if (/(initial algorithm)/.test(textAfter)) level--;
|
|
133
|
+
if (/(initial equation)/.test(textAfter)) level--;
|
|
134
|
+
if (/(end)/.test(textAfter)) level--;
|
|
135
|
+
if (level > 0)
|
|
136
|
+
return cx.unit * level;
|
|
137
|
+
else
|
|
138
|
+
return 0;
|
|
139
|
+
},
|
|
140
|
+
languageData: {
|
|
141
|
+
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
142
|
+
autocomplete: completions
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
modelica
|
|
147
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
function mkParser(lang) {
|
|
2
|
+
return {
|
|
3
|
+
name: "mscgen",
|
|
4
|
+
startState: startStateFn,
|
|
5
|
+
copyState: copyStateFn,
|
|
6
|
+
token: produceTokenFunction(lang),
|
|
7
|
+
languageData: {
|
|
8
|
+
commentTokens: { line: "#", block: { open: "/*", close: "*/" } }
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const mscgen = mkParser({
|
|
13
|
+
"keywords": ["msc"],
|
|
14
|
+
"options": ["hscale", "width", "arcgradient", "wordwraparcs"],
|
|
15
|
+
"constants": ["true", "false", "on", "off"],
|
|
16
|
+
"attributes": ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
|
|
17
|
+
"brackets": ["\\{", "\\}"],
|
|
18
|
+
// [ and ] are brackets too, but these get handled in with lists
|
|
19
|
+
"arcsWords": ["note", "abox", "rbox", "box"],
|
|
20
|
+
"arcsOthers": ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
|
|
21
|
+
"singlecomment": ["//", "#"],
|
|
22
|
+
"operators": ["="]
|
|
23
|
+
});
|
|
24
|
+
const msgenny = mkParser({
|
|
25
|
+
"keywords": null,
|
|
26
|
+
"options": ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
|
|
27
|
+
"constants": ["true", "false", "on", "off", "auto"],
|
|
28
|
+
"attributes": null,
|
|
29
|
+
"brackets": ["\\{", "\\}"],
|
|
30
|
+
"arcsWords": ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
|
|
31
|
+
"arcsOthers": ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
|
|
32
|
+
"singlecomment": ["//", "#"],
|
|
33
|
+
"operators": ["="]
|
|
34
|
+
});
|
|
35
|
+
const xu = mkParser({
|
|
36
|
+
"keywords": ["msc", "xu"],
|
|
37
|
+
"options": ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
|
|
38
|
+
"constants": ["true", "false", "on", "off", "auto"],
|
|
39
|
+
"attributes": ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip", "title", "deactivate", "activate", "activation"],
|
|
40
|
+
"brackets": ["\\{", "\\}"],
|
|
41
|
+
// [ and ] are brackets too, but these get handled in with lists
|
|
42
|
+
"arcsWords": ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
|
|
43
|
+
"arcsOthers": ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
|
|
44
|
+
"singlecomment": ["//", "#"],
|
|
45
|
+
"operators": ["="]
|
|
46
|
+
});
|
|
47
|
+
function wordRegexpBoundary(pWords) {
|
|
48
|
+
return new RegExp("^\\b(" + pWords.join("|") + ")\\b", "i");
|
|
49
|
+
}
|
|
50
|
+
function wordRegexp(pWords) {
|
|
51
|
+
return new RegExp("^(?:" + pWords.join("|") + ")", "i");
|
|
52
|
+
}
|
|
53
|
+
function startStateFn() {
|
|
54
|
+
return {
|
|
55
|
+
inComment: false,
|
|
56
|
+
inString: false,
|
|
57
|
+
inAttributeList: false,
|
|
58
|
+
inScript: false
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function copyStateFn(pState) {
|
|
62
|
+
return {
|
|
63
|
+
inComment: pState.inComment,
|
|
64
|
+
inString: pState.inString,
|
|
65
|
+
inAttributeList: pState.inAttributeList,
|
|
66
|
+
inScript: pState.inScript
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function produceTokenFunction(pConfig) {
|
|
70
|
+
return function(pStream, pState) {
|
|
71
|
+
if (pStream.match(wordRegexp(pConfig.brackets), true, true)) {
|
|
72
|
+
return "bracket";
|
|
73
|
+
}
|
|
74
|
+
if (!pState.inComment) {
|
|
75
|
+
if (pStream.match(/\/\*[^\*\/]*/, true, true)) {
|
|
76
|
+
pState.inComment = true;
|
|
77
|
+
return "comment";
|
|
78
|
+
}
|
|
79
|
+
if (pStream.match(wordRegexp(pConfig.singlecomment), true, true)) {
|
|
80
|
+
pStream.skipToEnd();
|
|
81
|
+
return "comment";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (pState.inComment) {
|
|
85
|
+
if (pStream.match(/[^\*\/]*\*\//, true, true))
|
|
86
|
+
pState.inComment = false;
|
|
87
|
+
else
|
|
88
|
+
pStream.skipToEnd();
|
|
89
|
+
return "comment";
|
|
90
|
+
}
|
|
91
|
+
if (!pState.inString && pStream.match(/\"(\\\"|[^\"])*/, true, true)) {
|
|
92
|
+
pState.inString = true;
|
|
93
|
+
return "string";
|
|
94
|
+
}
|
|
95
|
+
if (pState.inString) {
|
|
96
|
+
if (pStream.match(/[^\"]*\"/, true, true))
|
|
97
|
+
pState.inString = false;
|
|
98
|
+
else
|
|
99
|
+
pStream.skipToEnd();
|
|
100
|
+
return "string";
|
|
101
|
+
}
|
|
102
|
+
if (!!pConfig.keywords && pStream.match(wordRegexpBoundary(pConfig.keywords), true, true))
|
|
103
|
+
return "keyword";
|
|
104
|
+
if (pStream.match(wordRegexpBoundary(pConfig.options), true, true))
|
|
105
|
+
return "keyword";
|
|
106
|
+
if (pStream.match(wordRegexpBoundary(pConfig.arcsWords), true, true))
|
|
107
|
+
return "keyword";
|
|
108
|
+
if (pStream.match(wordRegexp(pConfig.arcsOthers), true, true))
|
|
109
|
+
return "keyword";
|
|
110
|
+
if (!!pConfig.operators && pStream.match(wordRegexp(pConfig.operators), true, true))
|
|
111
|
+
return "operator";
|
|
112
|
+
if (!!pConfig.constants && pStream.match(wordRegexp(pConfig.constants), true, true))
|
|
113
|
+
return "variable";
|
|
114
|
+
if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match("[", true, true)) {
|
|
115
|
+
pConfig.inAttributeList = true;
|
|
116
|
+
return "bracket";
|
|
117
|
+
}
|
|
118
|
+
if (pConfig.inAttributeList) {
|
|
119
|
+
if (pConfig.attributes !== null && pStream.match(wordRegexpBoundary(pConfig.attributes), true, true)) {
|
|
120
|
+
return "attribute";
|
|
121
|
+
}
|
|
122
|
+
if (pStream.match("]", true, true)) {
|
|
123
|
+
pConfig.inAttributeList = false;
|
|
124
|
+
return "bracket";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
pStream.next();
|
|
128
|
+
return null;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
mscgen,
|
|
133
|
+
msgenny,
|
|
134
|
+
xu
|
|
135
|
+
};
|