@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.
Files changed (164) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-D9Ph9eYp.js → CkHistory.vue_vue_type_script_setup_true_lang-Cr8vF94e.js} +214 -107
  2. package/dist/apl-fqmucPXA.js +140 -0
  3. package/dist/asciiarmor-DucZyvP0.js +56 -0
  4. package/dist/asn1-BnOEsgAm.js +144 -0
  5. package/dist/asterisk-QAlztEwS.js +345 -0
  6. package/dist/brainfuck-DZVCuF_t.js +53 -0
  7. package/dist/chat-kit.css +1166 -1
  8. package/dist/clike-CTYGlS6x.js +799 -0
  9. package/dist/clojure-BhXMqnxz.js +849 -0
  10. package/dist/cmake-BGaNd9E7.js +71 -0
  11. package/dist/cobol-4yqQntpt.js +120 -0
  12. package/dist/coffeescript-D2dXvhEc.js +308 -0
  13. package/dist/commonlisp-CF_VNHQR.js +130 -0
  14. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts +41 -0
  15. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts.map +1 -0
  16. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts +26 -0
  17. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts.map +1 -0
  18. package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts +20 -0
  19. package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts.map +1 -0
  20. package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts +42 -0
  21. package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts.map +1 -0
  22. package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts +33 -0
  23. package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts.map +1 -0
  24. package/dist/components/base/CkMilkdownEditor/index.d.ts +3 -0
  25. package/dist/components/base/CkMilkdownEditor/index.d.ts.map +1 -0
  26. package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts +16 -0
  27. package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts.map +1 -0
  28. package/dist/components/base/CkMilkdownEditor/types.d.ts +98 -0
  29. package/dist/components/base/CkMilkdownEditor/types.d.ts.map +1 -0
  30. package/dist/components/base/index.d.ts +2 -0
  31. package/dist/components/base/index.d.ts.map +1 -1
  32. package/dist/components/index.d.ts +2 -2
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/index.js +12 -11
  35. package/dist/createCrepeEditor-CFbvSH3s.js +74141 -0
  36. package/dist/crystal-DyuLTqLs.js +398 -0
  37. package/dist/css-DkSyTW67.js +1772 -0
  38. package/dist/cypher-Dlu_3r4V.js +121 -0
  39. package/dist/d-UURgV0Ux.js +179 -0
  40. package/dist/diff-B_Bi2Crb.js +25 -0
  41. package/dist/dockerfile-Bvk733Ga.js +201 -0
  42. package/dist/dtd-Dy74G54E.js +114 -0
  43. package/dist/dylan-TSb-Nfix.js +314 -0
  44. package/dist/ebnf-4fKAGW3a.js +140 -0
  45. package/dist/ecl-B59qGGVg.js +178 -0
  46. package/dist/eiffel-Dze7nlu3.js +134 -0
  47. package/dist/elm-DG7jkhNZ.js +176 -0
  48. package/dist/erlang-BO6gOnGA.js +674 -0
  49. package/dist/factor-CMxFHDqz.js +65 -0
  50. package/dist/fcl-CDDUNjTj.js +141 -0
  51. package/dist/forth-B9D2JCeE.js +116 -0
  52. package/dist/fortran-CAG2BFbe.js +467 -0
  53. package/dist/gas-0Aw8zDr5.js +293 -0
  54. package/dist/gherkin-DhZlEZiy.js +115 -0
  55. package/dist/groovy-CpwJiBl7.js +223 -0
  56. package/dist/handlers/index.js +1 -1
  57. package/dist/handlers/useChatKitLabels.d.ts +27 -0
  58. package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
  59. package/dist/haskell-ySd-OUo8.js +459 -0
  60. package/dist/haxe-7MlzfeYV.js +514 -0
  61. package/dist/http-BqypyemW.js +79 -0
  62. package/dist/idl-4HIGJlDI.js +985 -0
  63. package/dist/index-A5rWjRtZ.js +689 -0
  64. package/dist/index-B0ldhzaj.js +385 -0
  65. package/dist/index-BVOjyn3y.js +2490 -0
  66. package/dist/index-BWvkps_G.js +309 -0
  67. package/dist/index-BaS8OW8V.js +151 -0
  68. package/dist/index-BlHHEbV-.js +406 -0
  69. package/dist/index-BoqzHVNB.js +82 -0
  70. package/dist/index-C6zYjwIQ.js +704 -0
  71. package/dist/index-CMJGuXap.js +330 -0
  72. package/dist/index-CRfGWVdQ.js +116 -0
  73. package/dist/index-C_gTb50u.js +81 -0
  74. package/dist/index-DSU7cBGz.js +178 -0
  75. package/dist/index-DSq3gvqU.js +1767 -0
  76. package/dist/index-Da3777l2.js +289 -0
  77. package/dist/index-DdlzabmR.js +1021 -0
  78. package/dist/index-DhY_9bdS.js +61 -0
  79. package/dist/index-Dm6C1blN.js +1052 -0
  80. package/dist/index-Tj3pzx-E.js +327 -0
  81. package/dist/index-ZeRS5rER.js +97 -0
  82. package/dist/index-gzleljO6.js +157 -0
  83. package/dist/index-naWlQpaL.js +642 -0
  84. package/dist/index-sKO1lHHC.js +312 -0
  85. package/dist/index.d.ts +2 -2
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +14 -13
  88. package/dist/javascript-Bt8B7yTi.js +992 -0
  89. package/dist/julia-Bs6JJhYG.js +407 -0
  90. package/dist/livescript-DmzgM3Yt.js +296 -0
  91. package/dist/lua-Cvg8VrAA.js +256 -0
  92. package/dist/mathematica-DNLOL9PQ.js +110 -0
  93. package/dist/mbox-Ga7d4MMN.js +117 -0
  94. package/dist/mirc-Dma3B8rS.js +107 -0
  95. package/dist/mllike-DHn7xckP.js +334 -0
  96. package/dist/modelica-0d55jYY0.js +147 -0
  97. package/dist/mscgen-DdqZYINH.js +135 -0
  98. package/dist/mumps-Btr8VblO.js +93 -0
  99. package/dist/nginx-DTDtBDVN.js +141 -0
  100. package/dist/nsis-CyKBdPWp.js +62 -0
  101. package/dist/ntriples-CvgOYMpL.js +153 -0
  102. package/dist/octave-DYBj3-tl.js +200 -0
  103. package/dist/oz-R_e8WMIi.js +231 -0
  104. package/dist/pascal-GD8iposT.js +105 -0
  105. package/dist/perl-DL9mHpoi.js +1105 -0
  106. package/dist/pig-C_4T4YIV.js +101 -0
  107. package/dist/powershell-B0suO7Vd.js +328 -0
  108. package/dist/properties-BR-vP1aU.js +58 -0
  109. package/dist/protobuf-BxgpyhoW.js +77 -0
  110. package/dist/pug-vHnWR0UE.js +405 -0
  111. package/dist/puppet-Bdao66PW.js +137 -0
  112. package/dist/python-BFGRmuZ9.js +426 -0
  113. package/dist/q-CrbCVq4a.js +131 -0
  114. package/dist/r-V7nswm59.js +170 -0
  115. package/dist/rpm-C-DLY-If.js +109 -0
  116. package/dist/ruby-CQTpZw6f.js +331 -0
  117. package/dist/sas-D2UG-yhZ.js +207 -0
  118. package/dist/scheme-BKzrkGJD.js +222 -0
  119. package/dist/shell-BlsXDxCn.js +222 -0
  120. package/dist/sieve-CjwBwOY5.js +135 -0
  121. package/dist/simple-mode-DMneyfDu.js +130 -0
  122. package/dist/smalltalk-BOIGQuhN.js +121 -0
  123. package/dist/solr-CwD7U71z.js +69 -0
  124. package/dist/sparql-DYskk2vE.js +249 -0
  125. package/dist/spreadsheet-Bgtt3oLP.js +87 -0
  126. package/dist/sql-Cei9CMfk.js +342 -0
  127. package/dist/stex-C1nZSzAw.js +230 -0
  128. package/dist/stylus-BkS-boTH.js +565 -0
  129. package/dist/swift-FRZi1uvB.js +291 -0
  130. package/dist/tcl-CUcaCdmq.js +114 -0
  131. package/dist/textile-BnFpjsrl.js +414 -0
  132. package/dist/tiddlywiki-CjprD-Qp.js +218 -0
  133. package/dist/tiki-DK9DOeWn.js +268 -0
  134. package/dist/toml-BOuWGMcf.js +76 -0
  135. package/dist/troff-E1bJ0PPL.js +61 -0
  136. package/dist/ttcn-cfg-Dc39-fIP.js +133 -0
  137. package/dist/ttcn-tKd4HLu4.js +192 -0
  138. package/dist/turtle-Dq7-1WAf.js +124 -0
  139. package/dist/{useChatKitLabels-368lodS5.js → useChatKitLabels-Ww1Q7xUr.js} +25 -2
  140. package/dist/vb-Dp90gtsv.js +196 -0
  141. package/dist/vbscript-Bfn8O8I7.js +478 -0
  142. package/dist/velocity-BwIZK1TH.js +149 -0
  143. package/dist/verilog-CnT9bMk0.js +429 -0
  144. package/dist/vhdl-DCkMIyT9.js +158 -0
  145. package/dist/webidl-BTLTThCm.js +204 -0
  146. package/dist/xquery-BrBUuxMR.js +525 -0
  147. package/dist/yacas-b5lAVEIl.js +130 -0
  148. package/dist/z80-ClgwfNdB.js +92 -0
  149. package/package.json +10 -4
  150. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.spec.ts +221 -0
  151. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.ts +274 -0
  152. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.vue +151 -0
  153. package/src/components/base/CkMilkdownEditor/codeMirrorTheme.ts +132 -0
  154. package/src/components/base/CkMilkdownEditor/createCrepeEditor.ts +192 -0
  155. package/src/components/base/CkMilkdownEditor/crepeIcons.ts +77 -0
  156. package/src/components/base/CkMilkdownEditor/index.ts +2 -0
  157. package/src/components/base/CkMilkdownEditor/markdownClassAttrs.ts +64 -0
  158. package/src/components/base/CkMilkdownEditor/milkdown-theme.css +441 -0
  159. package/src/components/base/CkMilkdownEditor/types.ts +100 -0
  160. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.ts +2 -2
  161. package/src/components/base/index.ts +6 -0
  162. package/src/components/index.ts +4 -0
  163. package/src/handlers/useChatKitLabels.ts +27 -0
  164. package/src/index.ts +4 -0
@@ -0,0 +1,135 @@
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 keywords = words("if elsif else stop require");
7
+ var atoms = words("true false not");
8
+ function tokenBase(stream, state) {
9
+ var ch = stream.next();
10
+ if (ch == "/" && stream.eat("*")) {
11
+ state.tokenize = tokenCComment;
12
+ return tokenCComment(stream, state);
13
+ }
14
+ if (ch === "#") {
15
+ stream.skipToEnd();
16
+ return "comment";
17
+ }
18
+ if (ch == '"') {
19
+ state.tokenize = tokenString(ch);
20
+ return state.tokenize(stream, state);
21
+ }
22
+ if (ch == "(") {
23
+ state._indent.push("(");
24
+ state._indent.push("{");
25
+ return null;
26
+ }
27
+ if (ch === "{") {
28
+ state._indent.push("{");
29
+ return null;
30
+ }
31
+ if (ch == ")") {
32
+ state._indent.pop();
33
+ state._indent.pop();
34
+ }
35
+ if (ch === "}") {
36
+ state._indent.pop();
37
+ return null;
38
+ }
39
+ if (ch == ",")
40
+ return null;
41
+ if (ch == ";")
42
+ return null;
43
+ if (/[{}\(\),;]/.test(ch))
44
+ return null;
45
+ if (/\d/.test(ch)) {
46
+ stream.eatWhile(/[\d]/);
47
+ stream.eat(/[KkMmGg]/);
48
+ return "number";
49
+ }
50
+ if (ch == ":") {
51
+ stream.eatWhile(/[a-zA-Z_]/);
52
+ stream.eatWhile(/[a-zA-Z0-9_]/);
53
+ return "operator";
54
+ }
55
+ stream.eatWhile(/\w/);
56
+ var cur = stream.current();
57
+ if (cur == "text" && stream.eat(":")) {
58
+ state.tokenize = tokenMultiLineString;
59
+ return "string";
60
+ }
61
+ if (keywords.propertyIsEnumerable(cur))
62
+ return "keyword";
63
+ if (atoms.propertyIsEnumerable(cur))
64
+ return "atom";
65
+ return null;
66
+ }
67
+ function tokenMultiLineString(stream, state) {
68
+ state._multiLineString = true;
69
+ if (!stream.sol()) {
70
+ stream.eatSpace();
71
+ if (stream.peek() == "#") {
72
+ stream.skipToEnd();
73
+ return "comment";
74
+ }
75
+ stream.skipToEnd();
76
+ return "string";
77
+ }
78
+ if (stream.next() == "." && stream.eol()) {
79
+ state._multiLineString = false;
80
+ state.tokenize = tokenBase;
81
+ }
82
+ return "string";
83
+ }
84
+ function tokenCComment(stream, state) {
85
+ var maybeEnd = false, ch;
86
+ while ((ch = stream.next()) != null) {
87
+ if (maybeEnd && ch == "/") {
88
+ state.tokenize = tokenBase;
89
+ break;
90
+ }
91
+ maybeEnd = ch == "*";
92
+ }
93
+ return "comment";
94
+ }
95
+ function tokenString(quote) {
96
+ return function(stream, state) {
97
+ var escaped = false, ch;
98
+ while ((ch = stream.next()) != null) {
99
+ if (ch == quote && !escaped)
100
+ break;
101
+ escaped = !escaped && ch == "\\";
102
+ }
103
+ if (!escaped) state.tokenize = tokenBase;
104
+ return "string";
105
+ };
106
+ }
107
+ const sieve = {
108
+ name: "sieve",
109
+ startState: function(base) {
110
+ return {
111
+ tokenize: tokenBase,
112
+ baseIndent: base || 0,
113
+ _indent: []
114
+ };
115
+ },
116
+ token: function(stream, state) {
117
+ if (stream.eatSpace())
118
+ return null;
119
+ return (state.tokenize || tokenBase)(stream, state);
120
+ },
121
+ indent: function(state, _textAfter, cx) {
122
+ var length = state._indent.length;
123
+ if (_textAfter && _textAfter[0] == "}")
124
+ length--;
125
+ if (length < 0)
126
+ length = 0;
127
+ return length * cx.unit;
128
+ },
129
+ languageData: {
130
+ indentOnInput: /^\s*\}$/
131
+ }
132
+ };
133
+ export {
134
+ sieve
135
+ };
@@ -0,0 +1,130 @@
1
+ function simpleMode(states) {
2
+ ensureState(states, "start");
3
+ var states_ = {}, meta = states.languageData || {}, hasIndentation = false;
4
+ for (var state in states) if (state != meta && states.hasOwnProperty(state)) {
5
+ var list = states_[state] = [], orig = states[state];
6
+ for (var i = 0; i < orig.length; i++) {
7
+ var data = orig[i];
8
+ list.push(new Rule(data, states));
9
+ if (data.indent || data.dedent) hasIndentation = true;
10
+ }
11
+ }
12
+ return {
13
+ name: meta.name,
14
+ startState: function() {
15
+ return { state: "start", pending: null, indent: hasIndentation ? [] : null };
16
+ },
17
+ copyState: function(state2) {
18
+ var s = { state: state2.state, pending: state2.pending, indent: state2.indent && state2.indent.slice(0) };
19
+ if (state2.stack)
20
+ s.stack = state2.stack.slice(0);
21
+ return s;
22
+ },
23
+ token: tokenFunction(states_),
24
+ indent: indentFunction(states_, meta),
25
+ mergeTokens: meta.mergeTokens,
26
+ languageData: meta
27
+ };
28
+ }
29
+ function ensureState(states, name) {
30
+ if (!states.hasOwnProperty(name))
31
+ throw new Error("Undefined state " + name + " in simple mode");
32
+ }
33
+ function toRegex(val, caret) {
34
+ if (!val) return /(?:)/;
35
+ var flags = "";
36
+ if (val instanceof RegExp) {
37
+ if (val.ignoreCase) flags = "i";
38
+ if (val.unicode) flags += "u";
39
+ val = val.source;
40
+ } else {
41
+ val = String(val);
42
+ }
43
+ return new RegExp("^(?:" + val + ")", flags);
44
+ }
45
+ function asToken(val) {
46
+ if (!val) return null;
47
+ if (val.apply) return val;
48
+ if (typeof val == "string") return val.replace(/\./g, " ");
49
+ var result = [];
50
+ for (var i = 0; i < val.length; i++)
51
+ result.push(val[i] && val[i].replace(/\./g, " "));
52
+ return result;
53
+ }
54
+ function Rule(data, states) {
55
+ if (data.next || data.push) ensureState(states, data.next || data.push);
56
+ this.regex = toRegex(data.regex);
57
+ this.token = asToken(data.token);
58
+ this.data = data;
59
+ }
60
+ function tokenFunction(states) {
61
+ return function(stream, state) {
62
+ if (state.pending) {
63
+ var pend = state.pending.shift();
64
+ if (state.pending.length == 0) state.pending = null;
65
+ stream.pos += pend.text.length;
66
+ return pend.token;
67
+ }
68
+ var curState = states[state.state];
69
+ for (var i = 0; i < curState.length; i++) {
70
+ var rule = curState[i];
71
+ var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
72
+ if (matches) {
73
+ if (rule.data.next) {
74
+ state.state = rule.data.next;
75
+ } else if (rule.data.push) {
76
+ (state.stack || (state.stack = [])).push(state.state);
77
+ state.state = rule.data.push;
78
+ } else if (rule.data.pop && state.stack && state.stack.length) {
79
+ state.state = state.stack.pop();
80
+ }
81
+ if (rule.data.indent)
82
+ state.indent.push(stream.indentation() + stream.indentUnit);
83
+ if (rule.data.dedent)
84
+ state.indent.pop();
85
+ var token = rule.token;
86
+ if (token && token.apply) token = token(matches);
87
+ if (matches.length > 2 && rule.token && typeof rule.token != "string") {
88
+ state.pending = [];
89
+ for (var j = 2; j < matches.length; j++)
90
+ if (matches[j])
91
+ state.pending.push({ text: matches[j], token: rule.token[j - 1] });
92
+ stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
93
+ return token[0];
94
+ } else if (token && token.join) {
95
+ return token[0];
96
+ } else {
97
+ return token;
98
+ }
99
+ }
100
+ }
101
+ stream.next();
102
+ return null;
103
+ };
104
+ }
105
+ function indentFunction(states, meta) {
106
+ return function(state, textAfter) {
107
+ if (state.indent == null || meta.dontIndentStates && meta.dontIndentStates.indexOf(state.state) > -1)
108
+ return null;
109
+ var pos = state.indent.length - 1, rules = states[state.state];
110
+ scan: for (; ; ) {
111
+ for (var i = 0; i < rules.length; i++) {
112
+ var rule = rules[i];
113
+ if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
114
+ var m = rule.regex.exec(textAfter);
115
+ if (m && m[0]) {
116
+ pos--;
117
+ if (rule.next || rule.push) rules = states[rule.next || rule.push];
118
+ textAfter = textAfter.slice(m[0].length);
119
+ continue scan;
120
+ }
121
+ }
122
+ }
123
+ break;
124
+ }
125
+ return pos < 0 ? 0 : state.indent[pos];
126
+ };
127
+ }
128
+ export {
129
+ simpleMode as s
130
+ };
@@ -0,0 +1,121 @@
1
+ var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
2
+ var keywords = /true|false|nil|self|super|thisContext/;
3
+ var Context = function(tokenizer, parent) {
4
+ this.next = tokenizer;
5
+ this.parent = parent;
6
+ };
7
+ var Token = function(name, context, eos) {
8
+ this.name = name;
9
+ this.context = context;
10
+ this.eos = eos;
11
+ };
12
+ var State = function() {
13
+ this.context = new Context(next, null);
14
+ this.expectVariable = true;
15
+ this.indentation = 0;
16
+ this.userIndentationDelta = 0;
17
+ };
18
+ State.prototype.userIndent = function(indentation, indentUnit) {
19
+ this.userIndentationDelta = indentation > 0 ? indentation / indentUnit - this.indentation : 0;
20
+ };
21
+ var next = function(stream, context, state) {
22
+ var token = new Token(null, context, false);
23
+ var aChar = stream.next();
24
+ if (aChar === '"') {
25
+ token = nextComment(stream, new Context(nextComment, context));
26
+ } else if (aChar === "'") {
27
+ token = nextString(stream, new Context(nextString, context));
28
+ } else if (aChar === "#") {
29
+ if (stream.peek() === "'") {
30
+ stream.next();
31
+ token = nextSymbol(stream, new Context(nextSymbol, context));
32
+ } else {
33
+ if (stream.eatWhile(/[^\s.{}\[\]()]/))
34
+ token.name = "string.special";
35
+ else
36
+ token.name = "meta";
37
+ }
38
+ } else if (aChar === "$") {
39
+ if (stream.next() === "<") {
40
+ stream.eatWhile(/[^\s>]/);
41
+ stream.next();
42
+ }
43
+ token.name = "string.special";
44
+ } else if (aChar === "|" && state.expectVariable) {
45
+ token.context = new Context(nextTemporaries, context);
46
+ } else if (/[\[\]{}()]/.test(aChar)) {
47
+ token.name = "bracket";
48
+ token.eos = /[\[{(]/.test(aChar);
49
+ if (aChar === "[") {
50
+ state.indentation++;
51
+ } else if (aChar === "]") {
52
+ state.indentation = Math.max(0, state.indentation - 1);
53
+ }
54
+ } else if (specialChars.test(aChar)) {
55
+ stream.eatWhile(specialChars);
56
+ token.name = "operator";
57
+ token.eos = aChar !== ";";
58
+ } else if (/\d/.test(aChar)) {
59
+ stream.eatWhile(/[\w\d]/);
60
+ token.name = "number";
61
+ } else if (/[\w_]/.test(aChar)) {
62
+ stream.eatWhile(/[\w\d_]/);
63
+ token.name = state.expectVariable ? keywords.test(stream.current()) ? "keyword" : "variable" : null;
64
+ } else {
65
+ token.eos = state.expectVariable;
66
+ }
67
+ return token;
68
+ };
69
+ var nextComment = function(stream, context) {
70
+ stream.eatWhile(/[^"]/);
71
+ return new Token("comment", stream.eat('"') ? context.parent : context, true);
72
+ };
73
+ var nextString = function(stream, context) {
74
+ stream.eatWhile(/[^']/);
75
+ return new Token("string", stream.eat("'") ? context.parent : context, false);
76
+ };
77
+ var nextSymbol = function(stream, context) {
78
+ stream.eatWhile(/[^']/);
79
+ return new Token("string.special", stream.eat("'") ? context.parent : context, false);
80
+ };
81
+ var nextTemporaries = function(stream, context) {
82
+ var token = new Token(null, context, false);
83
+ var aChar = stream.next();
84
+ if (aChar === "|") {
85
+ token.context = context.parent;
86
+ token.eos = true;
87
+ } else {
88
+ stream.eatWhile(/[^|]/);
89
+ token.name = "variable";
90
+ }
91
+ return token;
92
+ };
93
+ const smalltalk = {
94
+ name: "smalltalk",
95
+ startState: function() {
96
+ return new State();
97
+ },
98
+ token: function(stream, state) {
99
+ state.userIndent(stream.indentation(), stream.indentUnit);
100
+ if (stream.eatSpace()) {
101
+ return null;
102
+ }
103
+ var token = state.context.next(stream, state.context, state);
104
+ state.context = token.context;
105
+ state.expectVariable = token.eos;
106
+ return token.name;
107
+ },
108
+ blankLine: function(state, indentUnit) {
109
+ state.userIndent(0, indentUnit);
110
+ },
111
+ indent: function(state, textAfter, cx) {
112
+ var i = state.context.next === next && textAfter && textAfter.charAt(0) === "]" ? -1 : state.userIndentationDelta;
113
+ return (state.indentation + i) * cx.unit;
114
+ },
115
+ languageData: {
116
+ indentOnInput: /^\s*\]$/
117
+ }
118
+ };
119
+ export {
120
+ smalltalk
121
+ };
@@ -0,0 +1,69 @@
1
+ var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/;
2
+ var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/;
3
+ var isOperatorString = /^(OR|AND|NOT|TO)$/;
4
+ function isNumber(word) {
5
+ return parseFloat(word).toString() === word;
6
+ }
7
+ function tokenString(quote) {
8
+ return function(stream, state) {
9
+ var escaped = false, next;
10
+ while ((next = stream.next()) != null) {
11
+ if (next == quote && !escaped) break;
12
+ escaped = !escaped && next == "\\";
13
+ }
14
+ if (!escaped) state.tokenize = tokenBase;
15
+ return "string";
16
+ };
17
+ }
18
+ function tokenOperator(operator) {
19
+ return function(stream, state) {
20
+ if (operator == "|")
21
+ stream.eat(/\|/);
22
+ else if (operator == "&")
23
+ stream.eat(/\&/);
24
+ state.tokenize = tokenBase;
25
+ return "operator";
26
+ };
27
+ }
28
+ function tokenWord(ch) {
29
+ return function(stream, state) {
30
+ var word = ch;
31
+ while ((ch = stream.peek()) && ch.match(isStringChar) != null) {
32
+ word += stream.next();
33
+ }
34
+ state.tokenize = tokenBase;
35
+ if (isOperatorString.test(word))
36
+ return "operator";
37
+ else if (isNumber(word))
38
+ return "number";
39
+ else if (stream.peek() == ":")
40
+ return "propertyName";
41
+ else
42
+ return "string";
43
+ };
44
+ }
45
+ function tokenBase(stream, state) {
46
+ var ch = stream.next();
47
+ if (ch == '"')
48
+ state.tokenize = tokenString(ch);
49
+ else if (isOperatorChar.test(ch))
50
+ state.tokenize = tokenOperator(ch);
51
+ else if (isStringChar.test(ch))
52
+ state.tokenize = tokenWord(ch);
53
+ return state.tokenize != tokenBase ? state.tokenize(stream, state) : null;
54
+ }
55
+ const solr = {
56
+ name: "solr",
57
+ startState: function() {
58
+ return {
59
+ tokenize: tokenBase
60
+ };
61
+ },
62
+ token: function(stream, state) {
63
+ if (stream.eatSpace()) return null;
64
+ return state.tokenize(stream, state);
65
+ }
66
+ };
67
+ export {
68
+ solr
69
+ };
@@ -0,0 +1,249 @@
1
+ var curPunc;
2
+ function wordRegexp(words) {
3
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
4
+ }
5
+ var ops = wordRegexp([
6
+ "str",
7
+ "lang",
8
+ "langmatches",
9
+ "datatype",
10
+ "bound",
11
+ "sameterm",
12
+ "isiri",
13
+ "isuri",
14
+ "iri",
15
+ "uri",
16
+ "bnode",
17
+ "count",
18
+ "sum",
19
+ "min",
20
+ "max",
21
+ "avg",
22
+ "sample",
23
+ "group_concat",
24
+ "rand",
25
+ "abs",
26
+ "ceil",
27
+ "floor",
28
+ "round",
29
+ "concat",
30
+ "substr",
31
+ "strlen",
32
+ "replace",
33
+ "ucase",
34
+ "lcase",
35
+ "encode_for_uri",
36
+ "contains",
37
+ "strstarts",
38
+ "strends",
39
+ "strbefore",
40
+ "strafter",
41
+ "year",
42
+ "month",
43
+ "day",
44
+ "hours",
45
+ "minutes",
46
+ "seconds",
47
+ "timezone",
48
+ "tz",
49
+ "now",
50
+ "uuid",
51
+ "struuid",
52
+ "md5",
53
+ "sha1",
54
+ "sha256",
55
+ "sha384",
56
+ "sha512",
57
+ "coalesce",
58
+ "if",
59
+ "strlang",
60
+ "strdt",
61
+ "isnumeric",
62
+ "regex",
63
+ "exists",
64
+ "isblank",
65
+ "isliteral",
66
+ "a",
67
+ "bind"
68
+ ]);
69
+ var keywords = wordRegexp([
70
+ "base",
71
+ "prefix",
72
+ "select",
73
+ "distinct",
74
+ "reduced",
75
+ "construct",
76
+ "describe",
77
+ "ask",
78
+ "from",
79
+ "named",
80
+ "where",
81
+ "order",
82
+ "limit",
83
+ "offset",
84
+ "filter",
85
+ "optional",
86
+ "graph",
87
+ "by",
88
+ "asc",
89
+ "desc",
90
+ "as",
91
+ "having",
92
+ "undef",
93
+ "values",
94
+ "group",
95
+ "minus",
96
+ "in",
97
+ "not",
98
+ "service",
99
+ "silent",
100
+ "using",
101
+ "insert",
102
+ "delete",
103
+ "union",
104
+ "true",
105
+ "false",
106
+ "with",
107
+ "data",
108
+ "copy",
109
+ "to",
110
+ "move",
111
+ "add",
112
+ "create",
113
+ "drop",
114
+ "clear",
115
+ "load",
116
+ "into"
117
+ ]);
118
+ var operatorChars = /[*+\-<>=&|\^\/!\?]/;
119
+ var PN_CHARS = "[A-Za-z_\\-0-9]";
120
+ var PREFIX_START = new RegExp("[A-Za-z]");
121
+ var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");
122
+ function tokenBase(stream, state) {
123
+ var ch = stream.next();
124
+ curPunc = null;
125
+ if (ch == "$" || ch == "?") {
126
+ if (ch == "?" && stream.match(/\s/, false)) {
127
+ return "operator";
128
+ }
129
+ stream.match(/^[A-Za-z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Za-z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*/);
130
+ return "variableName.local";
131
+ } else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
132
+ stream.match(/^[^\s\u00a0>]*>?/);
133
+ return "atom";
134
+ } else if (ch == '"' || ch == "'") {
135
+ state.tokenize = tokenLiteral(ch);
136
+ return state.tokenize(stream, state);
137
+ } else if (/[{}\(\),\.;\[\]]/.test(ch)) {
138
+ curPunc = ch;
139
+ return "bracket";
140
+ } else if (ch == "#") {
141
+ stream.skipToEnd();
142
+ return "comment";
143
+ } else if (operatorChars.test(ch)) {
144
+ return "operator";
145
+ } else if (ch == ":") {
146
+ eatPnLocal(stream);
147
+ return "atom";
148
+ } else if (ch == "@") {
149
+ stream.eatWhile(/[a-z\d\-]/i);
150
+ return "meta";
151
+ } else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
152
+ eatPnLocal(stream);
153
+ return "atom";
154
+ }
155
+ stream.eatWhile(/[_\w\d]/);
156
+ var word = stream.current();
157
+ if (ops.test(word))
158
+ return "builtin";
159
+ else if (keywords.test(word))
160
+ return "keyword";
161
+ else
162
+ return "variable";
163
+ }
164
+ function eatPnLocal(stream) {
165
+ stream.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i);
166
+ }
167
+ function tokenLiteral(quote) {
168
+ return function(stream, state) {
169
+ var escaped = false, ch;
170
+ while ((ch = stream.next()) != null) {
171
+ if (ch == quote && !escaped) {
172
+ state.tokenize = tokenBase;
173
+ break;
174
+ }
175
+ escaped = !escaped && ch == "\\";
176
+ }
177
+ return "string";
178
+ };
179
+ }
180
+ function pushContext(state, type, col) {
181
+ state.context = { prev: state.context, indent: state.indent, col, type };
182
+ }
183
+ function popContext(state) {
184
+ state.indent = state.context.indent;
185
+ state.context = state.context.prev;
186
+ }
187
+ const sparql = {
188
+ name: "sparql",
189
+ startState: function() {
190
+ return {
191
+ tokenize: tokenBase,
192
+ context: null,
193
+ indent: 0,
194
+ col: 0
195
+ };
196
+ },
197
+ token: function(stream, state) {
198
+ if (stream.sol()) {
199
+ if (state.context && state.context.align == null) state.context.align = false;
200
+ state.indent = stream.indentation();
201
+ }
202
+ if (stream.eatSpace()) return null;
203
+ var style = state.tokenize(stream, state);
204
+ if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
205
+ state.context.align = true;
206
+ }
207
+ if (curPunc == "(") pushContext(state, ")", stream.column());
208
+ else if (curPunc == "[") pushContext(state, "]", stream.column());
209
+ else if (curPunc == "{") pushContext(state, "}", stream.column());
210
+ else if (/[\]\}\)]/.test(curPunc)) {
211
+ while (state.context && state.context.type == "pattern") popContext(state);
212
+ if (state.context && curPunc == state.context.type) {
213
+ popContext(state);
214
+ if (curPunc == "}" && state.context && state.context.type == "pattern")
215
+ popContext(state);
216
+ }
217
+ } else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
218
+ else if (/atom|string|variable/.test(style) && state.context) {
219
+ if (/[\}\]]/.test(state.context.type))
220
+ pushContext(state, "pattern", stream.column());
221
+ else if (state.context.type == "pattern" && !state.context.align) {
222
+ state.context.align = true;
223
+ state.context.col = stream.column();
224
+ }
225
+ }
226
+ return style;
227
+ },
228
+ indent: function(state, textAfter, cx) {
229
+ var firstChar = textAfter && textAfter.charAt(0);
230
+ var context = state.context;
231
+ if (/[\]\}]/.test(firstChar))
232
+ while (context && context.type == "pattern") context = context.prev;
233
+ var closing = context && firstChar == context.type;
234
+ if (!context)
235
+ return 0;
236
+ else if (context.type == "pattern")
237
+ return context.col;
238
+ else if (context.align)
239
+ return context.col + (closing ? 0 : 1);
240
+ else
241
+ return context.indent + (closing ? 0 : cx.unit);
242
+ },
243
+ languageData: {
244
+ commentTokens: { line: "#" }
245
+ }
246
+ };
247
+ export {
248
+ sparql
249
+ };