@luxonis/visualizer-protobuf 1.6.1 → 1.7.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 (136) hide show
  1. package/dist/apl-NdZ6-T1z.js +142 -0
  2. package/dist/apps/depthai-visualizer/lib/src/components/Panel.d.ts +2 -0
  3. package/dist/apps/depthai-visualizer/lib/src/components/Panel.d.ts.map +1 -1
  4. package/dist/apps/depthai-visualizer/lib/src/components/Panel.js +2 -2
  5. package/dist/apps/depthai-visualizer/lib/src/components/Panel.js.map +1 -1
  6. package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.d.ts +4 -1
  7. package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.d.ts.map +1 -1
  8. package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.js +25 -13
  9. package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.js.map +1 -1
  10. package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.d.ts +2 -8
  11. package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.d.ts.map +1 -1
  12. package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.js +1 -1
  13. package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.js.map +1 -1
  14. package/dist/apps/depthai-visualizer/lib/src/panels/PointCloudPanel.js +2 -2
  15. package/dist/apps/depthai-visualizer/lib/src/panels/PointCloudPanel.js.map +1 -1
  16. package/dist/asciiarmor-CmJEbAuq.js +56 -0
  17. package/dist/asn1-CG_zvzH1.js +192 -0
  18. package/dist/asterisk-D6r__RMF.js +187 -0
  19. package/dist/brainfuck-COwWCBpq.js +70 -0
  20. package/dist/clike-BjlaHgsH.js +1018 -0
  21. package/dist/clojure-C2XPrGCa.js +274 -0
  22. package/dist/cmake-BGrEgXCL.js +81 -0
  23. package/dist/cobol-BfwG5XeO.js +235 -0
  24. package/dist/coffeescript-BG8vTfSz.js +329 -0
  25. package/dist/commonlisp-8oE2EpEe.js +108 -0
  26. package/dist/crystal--rIRMl16.js +419 -0
  27. package/dist/css-C_ZeEwz2.js +847 -0
  28. package/dist/cypher-Bayei42D.js +122 -0
  29. package/dist/d-B0hhz6be.js +205 -0
  30. package/dist/diff-DQutOIXs.js +30 -0
  31. package/dist/dockerfile-FAjn0vs9.js +199 -0
  32. package/dist/dtd-C1CeYVnM.js +121 -0
  33. package/dist/dylan-Dm9-uD-A.js +337 -0
  34. package/dist/ebnf-jWG_1Yly.js +151 -0
  35. package/dist/ecl-CgJPA6z9.js +190 -0
  36. package/dist/eiffel-lj7uLahq.js +146 -0
  37. package/dist/elm-Cz7o1ijk.js +230 -0
  38. package/dist/erlang-CyL5QOyR.js +581 -0
  39. package/dist/factor-B0KnwW_L.js +65 -0
  40. package/dist/fcl-DiozYjc8.js +154 -0
  41. package/dist/forth-B7vn5ze0.js +164 -0
  42. package/dist/fortran-D2XNEnBT.js +172 -0
  43. package/dist/gas-B_Tj57Ve.js +343 -0
  44. package/dist/gherkin-CJ6Qk4EZ.js +147 -0
  45. package/dist/groovy-BD9p_7sW.js +230 -0
  46. package/dist/haskell-BHnm1B83.js +239 -0
  47. package/dist/haxe-DWtZc5G9.js +490 -0
  48. package/dist/http-BOd5SYCT.js +89 -0
  49. package/dist/idl-FSFk8_xX.js +274 -0
  50. package/dist/index-B2YTRRfg.js +77 -0
  51. package/dist/{index-D4ve6uXS.js → index-Beii0-_3.js} +7 -4
  52. package/dist/index-BjWYigIi.js +124 -0
  53. package/dist/index-Bx-Bh4nu.js +114 -0
  54. package/dist/index-Bya68zyH.js +154265 -0
  55. package/dist/index-C3_VkVgd.js +626 -0
  56. package/dist/index-CIOyzzeT.js +199 -0
  57. package/dist/index-CY_MdHWz.js +810 -0
  58. package/dist/index-D8b2daZv.js +155 -0
  59. package/dist/index-DW9KaYNb.js +149 -0
  60. package/dist/index-DZ4eTPnT.js +497 -0
  61. package/dist/index-DZeM9OAW.js +356 -0
  62. package/dist/index-DgQXSEwG.js +348 -0
  63. package/dist/index-DuTu94nj.js +436 -0
  64. package/dist/{index-BZ45K_PO.js → index-KZ3VqQGp.js} +123 -76
  65. package/dist/index-WQmqQNn4.js +205 -0
  66. package/dist/index-o4kozweh.js +458 -0
  67. package/dist/index-rTpSqKsn.js +103 -0
  68. package/dist/index-tmy4XtHv.js +346 -0
  69. package/dist/index.js +7 -3
  70. package/dist/javascript-CWIx5LQU.js +922 -0
  71. package/dist/jinja2-D9k5QrXv.js +171 -0
  72. package/dist/julia-DM42tOPB.js +369 -0
  73. package/dist/livescript-Jd_p-LwX.js +259 -0
  74. package/dist/lua-CByQu4v6.js +137 -0
  75. package/dist/mathematica-Dkv0uCYF.js +153 -0
  76. package/dist/mbox-CYTvs5kC.js +114 -0
  77. package/dist/mirc-DpgP3GCo.js +176 -0
  78. package/dist/mllike-Ti5DOjKW.js +346 -0
  79. package/dist/modelica-CR6hTSce.js +192 -0
  80. package/dist/mscgen-D0GXtzMS.js +149 -0
  81. package/dist/mumps-Bf1EyDa6.js +129 -0
  82. package/dist/nginx-By9Phklj.js +163 -0
  83. package/dist/nsis-27gzqCGG.js +80 -0
  84. package/dist/ntriples-C7VJ7pnm.js +141 -0
  85. package/dist/octave-6yR_ix15.js +112 -0
  86. package/dist/oz-CEUnktiQ.js +235 -0
  87. package/dist/package.json +1 -0
  88. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.d.ts.map +1 -1
  89. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js +83 -57
  90. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js.map +1 -1
  91. package/dist/pascal-AdN1jbEG.js +124 -0
  92. package/dist/perl-B99DUQQt.js +819 -0
  93. package/dist/pig-DFeDRta6.js +149 -0
  94. package/dist/powershell-DhwsNWMx.js +381 -0
  95. package/dist/properties-o21uErwC.js +62 -0
  96. package/dist/protobuf-YxlANsmD.js +54 -0
  97. package/dist/pug-OXF_6qhs.js +504 -0
  98. package/dist/puppet-B8WICGYE.js +205 -0
  99. package/dist/python-D3FFx1Id.js +389 -0
  100. package/dist/q-D2Hjhl2C.js +123 -0
  101. package/dist/r-D73k5lac.js +174 -0
  102. package/dist/rpm-Duv_WH0z.js +89 -0
  103. package/dist/ruby-DGCVqZDt.js +287 -0
  104. package/dist/sas-XjPv1Vy5.js +268 -0
  105. package/dist/scheme-DeaA28vt.js +263 -0
  106. package/dist/shell-Bx6QZTgx.js +145 -0
  107. package/dist/sieve-CWCD62sW.js +178 -0
  108. package/dist/simple-mode-DAYwfn8M.js +135 -0
  109. package/dist/smalltalk-DSQbF4MF.js +153 -0
  110. package/dist/solr-v_XRf31C.js +80 -0
  111. package/dist/sparql-BrfDqf0-.js +170 -0
  112. package/dist/spreadsheet-Csn84Pef.js +98 -0
  113. package/dist/sql-Bhuc3u9R.js +481 -0
  114. package/dist/stex-DBkktma-.js +246 -0
  115. package/dist/stylus-dNd_pqKl.js +750 -0
  116. package/dist/swift-CHbTprt3.js +202 -0
  117. package/dist/tcl-BRlMUELr.js +125 -0
  118. package/dist/textile-CqfTUjd4.js +441 -0
  119. package/dist/tiddlywiki-BrsoM8KB.js +278 -0
  120. package/dist/tiki-D-ivWPkc.js +289 -0
  121. package/dist/toml-t_IhJu83.js +75 -0
  122. package/dist/troff-DckGF2AE.js +64 -0
  123. package/dist/ttcn-DlN2TOzU.js +257 -0
  124. package/dist/ttcn-cfg-pHSvg1fS.js +201 -0
  125. package/dist/turtle-D9Js0BlL.js +141 -0
  126. package/dist/vb-CbIGLrpY.js +249 -0
  127. package/dist/vbscript-8ANWle9n.js +320 -0
  128. package/dist/velocity-D6hz3Hzw.js +186 -0
  129. package/dist/verilog-DIV442at.js +565 -0
  130. package/dist/vhdl-BlTiZo_v.js +174 -0
  131. package/dist/webidl-Cp3tcqdk.js +179 -0
  132. package/dist/xquery-BOQU-_D-.js +425 -0
  133. package/dist/yacas-DQ1WucF0.js +182 -0
  134. package/dist/z80-P1j44jDI.js +102 -0
  135. package/package.json +2 -1
  136. package/dist/index-BSCvlHcY.js +0 -23123
@@ -0,0 +1,389 @@
1
+ function wordRegexp(words) {
2
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
3
+ }
4
+
5
+ var wordOperators = wordRegexp(["and", "or", "not", "is"]);
6
+ var commonKeywords = ["as", "assert", "break", "class", "continue",
7
+ "def", "del", "elif", "else", "except", "finally",
8
+ "for", "from", "global", "if", "import",
9
+ "lambda", "pass", "raise", "return",
10
+ "try", "while", "with", "yield", "in", "False", "True"];
11
+ var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
12
+ "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
13
+ "enumerate", "eval", "filter", "float", "format", "frozenset",
14
+ "getattr", "globals", "hasattr", "hash", "help", "hex", "id",
15
+ "input", "int", "isinstance", "issubclass", "iter", "len",
16
+ "list", "locals", "map", "max", "memoryview", "min", "next",
17
+ "object", "oct", "open", "ord", "pow", "property", "range",
18
+ "repr", "reversed", "round", "set", "setattr", "slice",
19
+ "sorted", "staticmethod", "str", "sum", "super", "tuple",
20
+ "type", "vars", "zip", "__import__", "NotImplemented",
21
+ "Ellipsis", "__debug__"];
22
+
23
+ function top(state) {
24
+ return state.scopes[state.scopes.length - 1];
25
+ }
26
+
27
+ function mkPython(parserConf) {
28
+ var ERRORCLASS = "error";
29
+
30
+ var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
31
+ // (Backwards-compatibility with old, cumbersome config system)
32
+ var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
33
+ parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/];
34
+ for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1);
35
+
36
+ var hangingIndent = parserConf.hangingIndent;
37
+
38
+ var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
39
+ if (parserConf.extra_keywords != undefined)
40
+ myKeywords = myKeywords.concat(parserConf.extra_keywords);
41
+
42
+ if (parserConf.extra_builtins != undefined)
43
+ myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
44
+
45
+ var py3 = !(parserConf.version && Number(parserConf.version) < 3);
46
+ if (py3) {
47
+ // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
48
+ var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
49
+ myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
50
+ myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
51
+ var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i");
52
+ } else {
53
+ var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
54
+ myKeywords = myKeywords.concat(["exec", "print"]);
55
+ myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
56
+ "file", "intern", "long", "raw_input", "reduce", "reload",
57
+ "unichr", "unicode", "xrange", "None"]);
58
+ var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
59
+ }
60
+ var keywords = wordRegexp(myKeywords);
61
+ var builtins = wordRegexp(myBuiltins);
62
+
63
+ // tokenizers
64
+ function tokenBase(stream, state) {
65
+ var sol = stream.sol() && state.lastToken != "\\";
66
+ if (sol) state.indent = stream.indentation();
67
+ // Handle scope changes
68
+ if (sol && top(state).type == "py") {
69
+ var scopeOffset = top(state).offset;
70
+ if (stream.eatSpace()) {
71
+ var lineOffset = stream.indentation();
72
+ if (lineOffset > scopeOffset)
73
+ pushPyScope(stream, state);
74
+ else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
75
+ state.errorToken = true;
76
+ return null;
77
+ } else {
78
+ var style = tokenBaseInner(stream, state);
79
+ if (scopeOffset > 0 && dedent(stream, state))
80
+ style += " " + ERRORCLASS;
81
+ return style;
82
+ }
83
+ }
84
+ return tokenBaseInner(stream, state);
85
+ }
86
+
87
+ function tokenBaseInner(stream, state, inFormat) {
88
+ if (stream.eatSpace()) return null;
89
+
90
+ // Handle Comments
91
+ if (!inFormat && stream.match(/^#.*/)) return "comment";
92
+
93
+ // Handle Number Literals
94
+ if (stream.match(/^[0-9\.]/, false)) {
95
+ var floatLiteral = false;
96
+ // Floats
97
+ if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
98
+ if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
99
+ if (stream.match(/^\.\d+/)) { floatLiteral = true; }
100
+ if (floatLiteral) {
101
+ // Float literals may be "imaginary"
102
+ stream.eat(/J/i);
103
+ return "number";
104
+ }
105
+ // Integers
106
+ var intLiteral = false;
107
+ // Hex
108
+ if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
109
+ // Binary
110
+ if (stream.match(/^0b[01_]+/i)) intLiteral = true;
111
+ // Octal
112
+ if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
113
+ // Decimal
114
+ if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
115
+ // Decimal literals may be "imaginary"
116
+ stream.eat(/J/i);
117
+ // TODO - Can you have imaginary longs?
118
+ intLiteral = true;
119
+ }
120
+ // Zero by itself with no other piece of number.
121
+ if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
122
+ if (intLiteral) {
123
+ // Integer literals may be "long"
124
+ stream.eat(/L/i);
125
+ return "number";
126
+ }
127
+ }
128
+
129
+ // Handle Strings
130
+ if (stream.match(stringPrefixes)) {
131
+ var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
132
+ if (!isFmtString) {
133
+ state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
134
+ return state.tokenize(stream, state);
135
+ } else {
136
+ state.tokenize = formatStringFactory(stream.current(), state.tokenize);
137
+ return state.tokenize(stream, state);
138
+ }
139
+ }
140
+
141
+ for (var i = 0; i < operators.length; i++)
142
+ if (stream.match(operators[i])) return "operator"
143
+
144
+ if (stream.match(delimiters)) return "punctuation";
145
+
146
+ if (state.lastToken == "." && stream.match(identifiers))
147
+ return "property";
148
+
149
+ if (stream.match(keywords) || stream.match(wordOperators))
150
+ return "keyword";
151
+
152
+ if (stream.match(builtins))
153
+ return "builtin";
154
+
155
+ if (stream.match(/^(self|cls)\b/))
156
+ return "self";
157
+
158
+ if (stream.match(identifiers)) {
159
+ if (state.lastToken == "def" || state.lastToken == "class")
160
+ return "def";
161
+ return "variable";
162
+ }
163
+
164
+ // Handle non-detected items
165
+ stream.next();
166
+ return inFormat ? null :ERRORCLASS;
167
+ }
168
+
169
+ function formatStringFactory(delimiter, tokenOuter) {
170
+ while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
171
+ delimiter = delimiter.substr(1);
172
+
173
+ var singleline = delimiter.length == 1;
174
+ var OUTCLASS = "string";
175
+
176
+ function tokenNestedExpr(depth) {
177
+ return function(stream, state) {
178
+ var inner = tokenBaseInner(stream, state, true);
179
+ if (inner == "punctuation") {
180
+ if (stream.current() == "{") {
181
+ state.tokenize = tokenNestedExpr(depth + 1);
182
+ } else if (stream.current() == "}") {
183
+ if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1);
184
+ else state.tokenize = tokenString;
185
+ }
186
+ }
187
+ return inner
188
+ }
189
+ }
190
+
191
+ function tokenString(stream, state) {
192
+ while (!stream.eol()) {
193
+ stream.eatWhile(/[^'"\{\}\\]/);
194
+ if (stream.eat("\\")) {
195
+ stream.next();
196
+ if (singleline && stream.eol())
197
+ return OUTCLASS;
198
+ } else if (stream.match(delimiter)) {
199
+ state.tokenize = tokenOuter;
200
+ return OUTCLASS;
201
+ } else if (stream.match('{{')) {
202
+ // ignore {{ in f-str
203
+ return OUTCLASS;
204
+ } else if (stream.match('{', false)) {
205
+ // switch to nested mode
206
+ state.tokenize = tokenNestedExpr(0);
207
+ if (stream.current()) return OUTCLASS;
208
+ else return state.tokenize(stream, state)
209
+ } else if (stream.match('}}')) {
210
+ return OUTCLASS;
211
+ } else if (stream.match('}')) {
212
+ // single } in f-string is an error
213
+ return ERRORCLASS;
214
+ } else {
215
+ stream.eat(/['"]/);
216
+ }
217
+ }
218
+ if (singleline) {
219
+ if (parserConf.singleLineStringErrors)
220
+ return ERRORCLASS;
221
+ else
222
+ state.tokenize = tokenOuter;
223
+ }
224
+ return OUTCLASS;
225
+ }
226
+ tokenString.isString = true;
227
+ return tokenString;
228
+ }
229
+
230
+ function tokenStringFactory(delimiter, tokenOuter) {
231
+ while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
232
+ delimiter = delimiter.substr(1);
233
+
234
+ var singleline = delimiter.length == 1;
235
+ var OUTCLASS = "string";
236
+
237
+ function tokenString(stream, state) {
238
+ while (!stream.eol()) {
239
+ stream.eatWhile(/[^'"\\]/);
240
+ if (stream.eat("\\")) {
241
+ stream.next();
242
+ if (singleline && stream.eol())
243
+ return OUTCLASS;
244
+ } else if (stream.match(delimiter)) {
245
+ state.tokenize = tokenOuter;
246
+ return OUTCLASS;
247
+ } else {
248
+ stream.eat(/['"]/);
249
+ }
250
+ }
251
+ if (singleline) {
252
+ if (parserConf.singleLineStringErrors)
253
+ return ERRORCLASS;
254
+ else
255
+ state.tokenize = tokenOuter;
256
+ }
257
+ return OUTCLASS;
258
+ }
259
+ tokenString.isString = true;
260
+ return tokenString;
261
+ }
262
+
263
+ function pushPyScope(stream, state) {
264
+ while (top(state).type != "py") state.scopes.pop();
265
+ state.scopes.push({offset: top(state).offset + stream.indentUnit,
266
+ type: "py",
267
+ align: null});
268
+ }
269
+
270
+ function pushBracketScope(stream, state, type) {
271
+ var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1;
272
+ state.scopes.push({offset: state.indent + (hangingIndent || stream.indentUnit),
273
+ type: type,
274
+ align: align});
275
+ }
276
+
277
+ function dedent(stream, state) {
278
+ var indented = stream.indentation();
279
+ while (state.scopes.length > 1 && top(state).offset > indented) {
280
+ if (top(state).type != "py") return true;
281
+ state.scopes.pop();
282
+ }
283
+ return top(state).offset != indented;
284
+ }
285
+
286
+ function tokenLexer(stream, state) {
287
+ if (stream.sol()) {
288
+ state.beginningOfLine = true;
289
+ state.dedent = false;
290
+ }
291
+
292
+ var style = state.tokenize(stream, state);
293
+ var current = stream.current();
294
+
295
+ // Handle decorators
296
+ if (state.beginningOfLine && current == "@")
297
+ return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
298
+
299
+ if (/\S/.test(current)) state.beginningOfLine = false;
300
+
301
+ if ((style == "variable" || style == "builtin")
302
+ && state.lastToken == "meta")
303
+ style = "meta";
304
+
305
+ // Handle scope changes.
306
+ if (current == "pass" || current == "return")
307
+ state.dedent = true;
308
+
309
+ if (current == "lambda") state.lambda = true;
310
+ if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
311
+ pushPyScope(stream, state);
312
+
313
+ if (current.length == 1 && !/string|comment/.test(style)) {
314
+ var delimiter_index = "[({".indexOf(current);
315
+ if (delimiter_index != -1)
316
+ pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
317
+
318
+ delimiter_index = "])}".indexOf(current);
319
+ if (delimiter_index != -1) {
320
+ if (top(state).type == current) state.indent = state.scopes.pop().offset - (hangingIndent || stream.indentUnit);
321
+ else return ERRORCLASS;
322
+ }
323
+ }
324
+ if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
325
+ state.scopes.pop();
326
+
327
+ return style;
328
+ }
329
+
330
+ return {
331
+ name: "python",
332
+
333
+ startState: function() {
334
+ return {
335
+ tokenize: tokenBase,
336
+ scopes: [{offset: 0, type: "py", align: null}],
337
+ indent: 0,
338
+ lastToken: null,
339
+ lambda: false,
340
+ dedent: 0
341
+ };
342
+ },
343
+
344
+ token: function(stream, state) {
345
+ var addErr = state.errorToken;
346
+ if (addErr) state.errorToken = false;
347
+ var style = tokenLexer(stream, state);
348
+
349
+ if (style && style != "comment")
350
+ state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
351
+ if (style == "punctuation") style = null;
352
+
353
+ if (stream.eol() && state.lambda)
354
+ state.lambda = false;
355
+ return addErr ? ERRORCLASS : style;
356
+ },
357
+
358
+ indent: function(state, textAfter, cx) {
359
+ if (state.tokenize != tokenBase)
360
+ return state.tokenize.isString ? null : 0;
361
+
362
+ var scope = top(state);
363
+ var closing = scope.type == textAfter.charAt(0) ||
364
+ scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter);
365
+ if (scope.align != null)
366
+ return scope.align - (closing ? 1 : 0)
367
+ else
368
+ return scope.offset - (closing ? hangingIndent || cx.unit : 0)
369
+ },
370
+
371
+ languageData: {
372
+ autocomplete: commonKeywords.concat(commonBuiltins).concat(["exec", "print"]),
373
+ indentOnInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
374
+ commentTokens: {line: "#"},
375
+ closeBrackets: {brackets: ["(", "[", "{", "'", '"', "'''", '"""']}
376
+ }
377
+ };
378
+ }
379
+ var words = function(str) { return str.split(" "); };
380
+
381
+ const python = mkPython({});
382
+
383
+ const cython = mkPython({
384
+ extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
385
+ "extern gil include nogil property public "+
386
+ "readonly struct union DEF IF ELIF ELSE")
387
+ });
388
+
389
+ export { cython, mkPython, python };
@@ -0,0 +1,123 @@
1
+ var curPunc,
2
+ keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]),
3
+ E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;
4
+ function buildRE(w){return new RegExp("^("+w.join("|")+")$");}
5
+ function tokenBase(stream,state){
6
+ var sol=stream.sol(),c=stream.next();
7
+ curPunc=null;
8
+ if(sol)
9
+ if(c=="/")
10
+ return (state.tokenize=tokenLineComment)(stream,state);
11
+ else if(c=="\\"){
12
+ if(stream.eol()||/\s/.test(stream.peek()))
13
+ return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream):state.tokenize=tokenBase,"comment";
14
+ else
15
+ return state.tokenize=tokenBase,"builtin";
16
+ }
17
+ if(/\s/.test(c))
18
+ return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"null";
19
+ if(c=='"')
20
+ return (state.tokenize=tokenString)(stream,state);
21
+ if(c=='`')
22
+ return stream.eatWhile(/[A-Za-z\d_:\/.]/),"macroName";
23
+ if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){
24
+ var t=null;
25
+ stream.backUp(1);
26
+ if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([DT](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
27
+ || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)
28
+ || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)
29
+ || stream.match(/^\d+[ptuv]{1}/))
30
+ t="temporal";
31
+ else if(stream.match(/^0[NwW]{1}/)
32
+ || stream.match(/^0x[\da-fA-F]*/)
33
+ || stream.match(/^[01]+[b]{1}/)
34
+ || stream.match(/^\d+[chijn]{1}/)
35
+ || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))
36
+ t="number";
37
+ return (t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error");
38
+ }
39
+ if(/[A-Za-z]|\./.test(c))
40
+ return stream.eatWhile(/[A-Za-z._\d]/),keywords.test(stream.current())?"keyword":"variable";
41
+ if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c))
42
+ return null;
43
+ if(/[{}\(\[\]\)]/.test(c))
44
+ return null;
45
+ return "error";
46
+ }
47
+ function tokenLineComment(stream,state){
48
+ return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment";
49
+ }
50
+ function tokenBlockComment(stream,state){
51
+ var f=stream.sol()&&stream.peek()=="\\";
52
+ stream.skipToEnd();
53
+ if(f&&/^\\\s*$/.test(stream.current()))
54
+ state.tokenize=tokenBase;
55
+ return "comment";
56
+ }
57
+ function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";}
58
+ function tokenString(stream,state){
59
+ var escaped=false,next,end=false;
60
+ while((next=stream.next())){
61
+ if(next=="\""&&!escaped){end=true;break;}
62
+ escaped=!escaped&&next=="\\";
63
+ }
64
+ if(end)state.tokenize=tokenBase;
65
+ return "string";
66
+ }
67
+ function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};}
68
+ function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;}
69
+ const q = {
70
+ name: "q",
71
+ startState:function(){
72
+ return {tokenize:tokenBase,
73
+ context:null,
74
+ indent:0,
75
+ col:0};
76
+ },
77
+ token:function(stream,state){
78
+ if(stream.sol()){
79
+ if(state.context&&state.context.align==null)
80
+ state.context.align=false;
81
+ state.indent=stream.indentation();
82
+ }
83
+ //if (stream.eatSpace()) return null;
84
+ var style=state.tokenize(stream,state);
85
+ if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){
86
+ state.context.align=true;
87
+ }
88
+ if(curPunc=="(")pushContext(state,")",stream.column());
89
+ else if(curPunc=="[")pushContext(state,"]",stream.column());
90
+ else if(curPunc=="{")pushContext(state,"}",stream.column());
91
+ else if(/[\]\}\)]/.test(curPunc)){
92
+ while(state.context&&state.context.type=="pattern")popContext(state);
93
+ if(state.context&&curPunc==state.context.type)popContext(state);
94
+ }
95
+ else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state);
96
+ else if(/atom|string|variable/.test(style)&&state.context){
97
+ if(/[\}\]]/.test(state.context.type))
98
+ pushContext(state,"pattern",stream.column());
99
+ else if(state.context.type=="pattern"&&!state.context.align){
100
+ state.context.align=true;
101
+ state.context.col=stream.column();
102
+ }
103
+ }
104
+ return style;
105
+ },
106
+ indent:function(state,textAfter,cx){
107
+ var firstChar=textAfter&&textAfter.charAt(0);
108
+ var context=state.context;
109
+ if(/[\]\}]/.test(firstChar))
110
+ while (context&&context.type=="pattern")context=context.prev;
111
+ var closing=context&&firstChar==context.type;
112
+ if(!context)
113
+ return 0;
114
+ else if(context.type=="pattern")
115
+ return context.col;
116
+ else if(context.align)
117
+ return context.col+(closing?0:1);
118
+ else
119
+ return context.indent+(closing?0:cx.unit);
120
+ }
121
+ };
122
+
123
+ export { q };
@@ -0,0 +1,174 @@
1
+ function wordObj(words) {
2
+ var res = {};
3
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
4
+ return res;
5
+ }
6
+ var commonAtoms = ["NULL", "NA", "Inf", "NaN", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_", "TRUE", "FALSE"];
7
+ var commonBuiltins = ["list", "quote", "bquote", "eval", "return", "call", "parse", "deparse"];
8
+ var commonKeywords = ["if", "else", "repeat", "while", "function", "for", "in", "next", "break"];
9
+ var commonBlockKeywords = ["if", "else", "repeat", "while", "function", "for"];
10
+
11
+ var atoms = wordObj(commonAtoms);
12
+ var builtins = wordObj(commonBuiltins);
13
+ var keywords = wordObj(commonKeywords);
14
+ var blockkeywords = wordObj(commonBlockKeywords);
15
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
16
+ var curPunc;
17
+
18
+ function tokenBase(stream, state) {
19
+ curPunc = null;
20
+ var ch = stream.next();
21
+ if (ch == "#") {
22
+ stream.skipToEnd();
23
+ return "comment";
24
+ } else if (ch == "0" && stream.eat("x")) {
25
+ stream.eatWhile(/[\da-f]/i);
26
+ return "number";
27
+ } else if (ch == "." && stream.eat(/\d/)) {
28
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
29
+ return "number";
30
+ } else if (/\d/.test(ch)) {
31
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
32
+ return "number";
33
+ } else if (ch == "'" || ch == '"') {
34
+ state.tokenize = tokenString(ch);
35
+ return "string";
36
+ } else if (ch == "`") {
37
+ stream.match(/[^`]+`/);
38
+ return "string.special";
39
+ } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) {
40
+ return "keyword";
41
+ } else if (/[a-zA-Z\.]/.test(ch)) {
42
+ stream.eatWhile(/[\w\.]/);
43
+ var word = stream.current();
44
+ if (atoms.propertyIsEnumerable(word)) return "atom";
45
+ if (keywords.propertyIsEnumerable(word)) {
46
+ // Block keywords start new blocks, except 'else if', which only starts
47
+ // one new block for the 'if', no block for the 'else'.
48
+ if (blockkeywords.propertyIsEnumerable(word) &&
49
+ !stream.match(/\s*if(\s+|$)/, false))
50
+ curPunc = "block";
51
+ return "keyword";
52
+ }
53
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
54
+ return "variable";
55
+ } else if (ch == "%") {
56
+ if (stream.skipTo("%")) stream.next();
57
+ return "variableName.special";
58
+ } else if (
59
+ (ch == "<" && stream.eat("-")) ||
60
+ (ch == "<" && stream.match("<-")) ||
61
+ (ch == "-" && stream.match(/>>?/))
62
+ ) {
63
+ return "operator";
64
+ } else if (ch == "=" && state.ctx.argList) {
65
+ return "operator";
66
+ } else if (opChars.test(ch)) {
67
+ if (ch == "$") return "operator";
68
+ stream.eatWhile(opChars);
69
+ return "operator";
70
+ } else if (/[\(\){}\[\];]/.test(ch)) {
71
+ curPunc = ch;
72
+ if (ch == ";") return "punctuation";
73
+ return null;
74
+ } else {
75
+ return null;
76
+ }
77
+ }
78
+
79
+ function tokenString(quote) {
80
+ return function(stream, state) {
81
+ if (stream.eat("\\")) {
82
+ var ch = stream.next();
83
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
84
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
85
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
86
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
87
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
88
+ return "string.special";
89
+ } else {
90
+ var next;
91
+ while ((next = stream.next()) != null) {
92
+ if (next == quote) { state.tokenize = tokenBase; break; }
93
+ if (next == "\\") { stream.backUp(1); break; }
94
+ }
95
+ return "string";
96
+ }
97
+ };
98
+ }
99
+
100
+ var ALIGN_YES = 1, ALIGN_NO = 2, BRACELESS = 4;
101
+
102
+ function push(state, type, stream) {
103
+ state.ctx = {type: type,
104
+ indent: state.indent,
105
+ flags: 0,
106
+ column: stream.column(),
107
+ prev: state.ctx};
108
+ }
109
+ function setFlag(state, flag) {
110
+ var ctx = state.ctx;
111
+ state.ctx = {type: ctx.type,
112
+ indent: ctx.indent,
113
+ flags: ctx.flags | flag,
114
+ column: ctx.column,
115
+ prev: ctx.prev};
116
+ }
117
+ function pop(state) {
118
+ state.indent = state.ctx.indent;
119
+ state.ctx = state.ctx.prev;
120
+ }
121
+
122
+ const r = {
123
+ name: "r",
124
+ startState: function(indentUnit) {
125
+ return {tokenize: tokenBase,
126
+ ctx: {type: "top",
127
+ indent: -indentUnit,
128
+ flags: ALIGN_NO},
129
+ indent: 0,
130
+ afterIdent: false};
131
+ },
132
+
133
+ token: function(stream, state) {
134
+ if (stream.sol()) {
135
+ if ((state.ctx.flags & 3) == 0) state.ctx.flags |= ALIGN_NO;
136
+ if (state.ctx.flags & BRACELESS) pop(state);
137
+ state.indent = stream.indentation();
138
+ }
139
+ if (stream.eatSpace()) return null;
140
+ var style = state.tokenize(stream, state);
141
+ if (style != "comment" && (state.ctx.flags & ALIGN_NO) == 0) setFlag(state, ALIGN_YES);
142
+
143
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && state.ctx.type == "block") pop(state);
144
+ if (curPunc == "{") push(state, "}", stream);
145
+ else if (curPunc == "(") {
146
+ push(state, ")", stream);
147
+ if (state.afterIdent) state.ctx.argList = true;
148
+ }
149
+ else if (curPunc == "[") push(state, "]", stream);
150
+ else if (curPunc == "block") push(state, "block", stream);
151
+ else if (curPunc == state.ctx.type) pop(state);
152
+ else if (state.ctx.type == "block" && style != "comment") setFlag(state, BRACELESS);
153
+ state.afterIdent = style == "variable" || style == "keyword";
154
+ return style;
155
+ },
156
+
157
+ indent: function(state, textAfter, cx) {
158
+ if (state.tokenize != tokenBase) return 0;
159
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
160
+ closing = firstChar == ctx.type;
161
+ if (ctx.flags & BRACELESS) ctx = ctx.prev;
162
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : cx.unit);
163
+ else if (ctx.flags & ALIGN_YES) return ctx.column + (closing ? 0 : 1);
164
+ else return ctx.indent + (closing ? 0 : cx.unit);
165
+ },
166
+
167
+ languageData: {
168
+ wordChars: ".",
169
+ commentTokens: {line: "#"},
170
+ autocomplete: commonAtoms.concat(commonBuiltins, commonKeywords)
171
+ }
172
+ };
173
+
174
+ export { r };