@luxonis/visualizer-protobuf 1.6.2 → 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 (137) 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-B8tJ5E-v.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-CDLN8AQd.js → index-KZ3VqQGp.js} +88 -35
  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 +1 -1
  89. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.d.ts.map +1 -1
  90. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js +47 -18
  91. package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js.map +1 -1
  92. package/dist/pascal-AdN1jbEG.js +124 -0
  93. package/dist/perl-B99DUQQt.js +819 -0
  94. package/dist/pig-DFeDRta6.js +149 -0
  95. package/dist/powershell-DhwsNWMx.js +381 -0
  96. package/dist/properties-o21uErwC.js +62 -0
  97. package/dist/protobuf-YxlANsmD.js +54 -0
  98. package/dist/pug-OXF_6qhs.js +504 -0
  99. package/dist/puppet-B8WICGYE.js +205 -0
  100. package/dist/python-D3FFx1Id.js +389 -0
  101. package/dist/q-D2Hjhl2C.js +123 -0
  102. package/dist/r-D73k5lac.js +174 -0
  103. package/dist/rpm-Duv_WH0z.js +89 -0
  104. package/dist/ruby-DGCVqZDt.js +287 -0
  105. package/dist/sas-XjPv1Vy5.js +268 -0
  106. package/dist/scheme-DeaA28vt.js +263 -0
  107. package/dist/shell-Bx6QZTgx.js +145 -0
  108. package/dist/sieve-CWCD62sW.js +178 -0
  109. package/dist/simple-mode-DAYwfn8M.js +135 -0
  110. package/dist/smalltalk-DSQbF4MF.js +153 -0
  111. package/dist/solr-v_XRf31C.js +80 -0
  112. package/dist/sparql-BrfDqf0-.js +170 -0
  113. package/dist/spreadsheet-Csn84Pef.js +98 -0
  114. package/dist/sql-Bhuc3u9R.js +481 -0
  115. package/dist/stex-DBkktma-.js +246 -0
  116. package/dist/stylus-dNd_pqKl.js +750 -0
  117. package/dist/swift-CHbTprt3.js +202 -0
  118. package/dist/tcl-BRlMUELr.js +125 -0
  119. package/dist/textile-CqfTUjd4.js +441 -0
  120. package/dist/tiddlywiki-BrsoM8KB.js +278 -0
  121. package/dist/tiki-D-ivWPkc.js +289 -0
  122. package/dist/toml-t_IhJu83.js +75 -0
  123. package/dist/troff-DckGF2AE.js +64 -0
  124. package/dist/ttcn-DlN2TOzU.js +257 -0
  125. package/dist/ttcn-cfg-pHSvg1fS.js +201 -0
  126. package/dist/turtle-D9Js0BlL.js +141 -0
  127. package/dist/vb-CbIGLrpY.js +249 -0
  128. package/dist/vbscript-8ANWle9n.js +320 -0
  129. package/dist/velocity-D6hz3Hzw.js +186 -0
  130. package/dist/verilog-DIV442at.js +565 -0
  131. package/dist/vhdl-BlTiZo_v.js +174 -0
  132. package/dist/webidl-Cp3tcqdk.js +179 -0
  133. package/dist/xquery-BOQU-_D-.js +425 -0
  134. package/dist/yacas-DQ1WucF0.js +182 -0
  135. package/dist/z80-P1j44jDI.js +102 -0
  136. package/package.json +2 -1
  137. package/dist/index-BoCFgPcb.js +0 -23123
@@ -0,0 +1,425 @@
1
+ // The keywords object is set to the result of this self executing
2
+ // function. Each keyword is a property of the keywords object whose
3
+ // value is {type: atype, style: astyle}
4
+ var keywords = function(){
5
+ // convenience functions used to build keywords object
6
+ function kw(type) {return {type: type, style: "keyword"};}
7
+ var operator = kw("operator")
8
+ , atom = {type: "atom", style: "atom"}
9
+ , punctuation = {type: "punctuation", style: null}
10
+ , qualifier = {type: "axis_specifier", style: "qualifier"};
11
+
12
+ // kwObj is what is return from this function at the end
13
+ var kwObj = {
14
+ ',': punctuation
15
+ };
16
+
17
+ // a list of 'basic' keywords. For each add a property to kwObj with the value of
18
+ // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
19
+ var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
20
+ 'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
21
+ 'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
22
+ 'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
23
+ 'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
24
+ 'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
25
+ 'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
26
+ 'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
27
+ 'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
28
+ 'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
29
+ 'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
30
+ 'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
31
+ 'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
32
+ 'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
33
+ 'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
34
+ 'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
35
+ 'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
36
+ 'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
37
+ 'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
38
+ 'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
39
+ for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);}
40
+ // a list of types. For each add a property to kwObj with the value of
41
+ // {type: "atom", style: "atom"}
42
+ var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
43
+ 'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
44
+ 'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
45
+ 'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
46
+ 'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
47
+ 'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
48
+ 'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
49
+ 'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
50
+ 'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
51
+ 'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
52
+ for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;}
53
+ // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
54
+ var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
55
+ for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;}
56
+ // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
57
+ var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
58
+ "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
59
+ for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; }
60
+ return kwObj;
61
+ }();
62
+
63
+ function chain(stream, state, f) {
64
+ state.tokenize = f;
65
+ return f(stream, state);
66
+ }
67
+
68
+ // the primary mode tokenizer
69
+ function tokenBase(stream, state) {
70
+ var ch = stream.next(),
71
+ mightBeFunction = false,
72
+ isEQName = isEQNameAhead(stream);
73
+
74
+ // an XML tag (if not in some sub, chained tokenizer)
75
+ if (ch == "<") {
76
+ if(stream.match("!--", true))
77
+ return chain(stream, state, tokenXMLComment);
78
+
79
+ if(stream.match("![CDATA", false)) {
80
+ state.tokenize = tokenCDATA;
81
+ return "tag";
82
+ }
83
+
84
+ if(stream.match("?", false)) {
85
+ return chain(stream, state, tokenPreProcessing);
86
+ }
87
+
88
+ var isclose = stream.eat("/");
89
+ stream.eatSpace();
90
+ var tagName = "", c;
91
+ while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
92
+
93
+ return chain(stream, state, tokenTag(tagName, isclose));
94
+ }
95
+ // start code block
96
+ else if(ch == "{") {
97
+ pushStateStack(state, { type: "codeblock"});
98
+ return null;
99
+ }
100
+ // end code block
101
+ else if(ch == "}") {
102
+ popStateStack(state);
103
+ return null;
104
+ }
105
+ // if we're in an XML block
106
+ else if(isInXmlBlock(state)) {
107
+ if(ch == ">")
108
+ return "tag";
109
+ else if(ch == "/" && stream.eat(">")) {
110
+ popStateStack(state);
111
+ return "tag";
112
+ }
113
+ else
114
+ return "variable";
115
+ }
116
+ // if a number
117
+ else if (/\d/.test(ch)) {
118
+ stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
119
+ return "atom";
120
+ }
121
+ // comment start
122
+ else if (ch === "(" && stream.eat(":")) {
123
+ pushStateStack(state, { type: "comment"});
124
+ return chain(stream, state, tokenComment);
125
+ }
126
+ // quoted string
127
+ else if (!isEQName && (ch === '"' || ch === "'"))
128
+ return chain(stream, state, tokenString(ch));
129
+ // variable
130
+ else if(ch === "$") {
131
+ return chain(stream, state, tokenVariable);
132
+ }
133
+ // assignment
134
+ else if(ch ===":" && stream.eat("=")) {
135
+ return "keyword";
136
+ }
137
+ // open paren
138
+ else if(ch === "(") {
139
+ pushStateStack(state, { type: "paren"});
140
+ return null;
141
+ }
142
+ // close paren
143
+ else if(ch === ")") {
144
+ popStateStack(state);
145
+ return null;
146
+ }
147
+ // open paren
148
+ else if(ch === "[") {
149
+ pushStateStack(state, { type: "bracket"});
150
+ return null;
151
+ }
152
+ // close paren
153
+ else if(ch === "]") {
154
+ popStateStack(state);
155
+ return null;
156
+ }
157
+ else {
158
+ var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
159
+
160
+ // if there's a EQName ahead, consume the rest of the string portion, it's likely a function
161
+ if(isEQName && ch === '\"') while(stream.next() !== '"'){}
162
+ if(isEQName && ch === '\'') while(stream.next() !== '\''){}
163
+
164
+ // gobble up a word if the character is not known
165
+ if(!known) stream.eatWhile(/[\w\$_-]/);
166
+
167
+ // gobble a colon in the case that is a lib func type call fn:doc
168
+ var foundColon = stream.eat(":");
169
+
170
+ // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
171
+ // which should get matched as a keyword
172
+ if(!stream.eat(":") && foundColon) {
173
+ stream.eatWhile(/[\w\$_-]/);
174
+ }
175
+ // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
176
+ if(stream.match(/^[ \t]*\(/, false)) {
177
+ mightBeFunction = true;
178
+ }
179
+ // is the word a keyword?
180
+ var word = stream.current();
181
+ known = keywords.propertyIsEnumerable(word) && keywords[word];
182
+
183
+ // if we think it's a function call but not yet known,
184
+ // set style to variable for now for lack of something better
185
+ if(mightBeFunction && !known) known = {type: "function_call", style: "def"};
186
+
187
+ // if the previous word was element, attribute, axis specifier, this word should be the name of that
188
+ if(isInXmlConstructor(state)) {
189
+ popStateStack(state);
190
+ return "variable";
191
+ }
192
+ // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
193
+ // push the stack so we know to look for it on the next word
194
+ if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
195
+
196
+ // if the word is known, return the details of that else just call this a generic 'word'
197
+ return known ? known.style : "variable";
198
+ }
199
+ }
200
+
201
+ // handle comments, including nested
202
+ function tokenComment(stream, state) {
203
+ var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
204
+ while (ch = stream.next()) {
205
+ if (ch == ")" && maybeEnd) {
206
+ if(nestedCount > 0)
207
+ nestedCount--;
208
+ else {
209
+ popStateStack(state);
210
+ break;
211
+ }
212
+ }
213
+ else if(ch == ":" && maybeNested) {
214
+ nestedCount++;
215
+ }
216
+ maybeEnd = (ch == ":");
217
+ maybeNested = (ch == "(");
218
+ }
219
+
220
+ return "comment";
221
+ }
222
+
223
+ // tokenizer for string literals
224
+ // optionally pass a tokenizer function to set state.tokenize back to when finished
225
+ function tokenString(quote, f) {
226
+ return function(stream, state) {
227
+ var ch;
228
+
229
+ if(isInString(state) && stream.current() == quote) {
230
+ popStateStack(state);
231
+ if(f) state.tokenize = f;
232
+ return "string";
233
+ }
234
+
235
+ pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
236
+
237
+ // if we're in a string and in an XML block, allow an embedded code block
238
+ if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
239
+ state.tokenize = tokenBase;
240
+ return "string";
241
+ }
242
+
243
+
244
+ while (ch = stream.next()) {
245
+ if (ch == quote) {
246
+ popStateStack(state);
247
+ if(f) state.tokenize = f;
248
+ break;
249
+ }
250
+ else {
251
+ // if we're in a string and in an XML block, allow an embedded code block in an attribute
252
+ if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
253
+ state.tokenize = tokenBase;
254
+ return "string";
255
+ }
256
+
257
+ }
258
+ }
259
+
260
+ return "string";
261
+ };
262
+ }
263
+
264
+ // tokenizer for variables
265
+ function tokenVariable(stream, state) {
266
+ var isVariableChar = /[\w\$_-]/;
267
+
268
+ // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
269
+ if(stream.eat("\"")) {
270
+ while(stream.next() !== '\"'){} stream.eat(":");
271
+ } else {
272
+ stream.eatWhile(isVariableChar);
273
+ if(!stream.match(":=", false)) stream.eat(":");
274
+ }
275
+ stream.eatWhile(isVariableChar);
276
+ state.tokenize = tokenBase;
277
+ return "variable";
278
+ }
279
+
280
+ // tokenizer for XML tags
281
+ function tokenTag(name, isclose) {
282
+ return function(stream, state) {
283
+ stream.eatSpace();
284
+ if(isclose && stream.eat(">")) {
285
+ popStateStack(state);
286
+ state.tokenize = tokenBase;
287
+ return "tag";
288
+ }
289
+ // self closing tag without attributes?
290
+ if(!stream.eat("/"))
291
+ pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
292
+ if(!stream.eat(">")) {
293
+ state.tokenize = tokenAttribute;
294
+ return "tag";
295
+ }
296
+ else {
297
+ state.tokenize = tokenBase;
298
+ }
299
+ return "tag";
300
+ };
301
+ }
302
+
303
+ // tokenizer for XML attributes
304
+ function tokenAttribute(stream, state) {
305
+ var ch = stream.next();
306
+
307
+ if(ch == "/" && stream.eat(">")) {
308
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
309
+ if(isInXmlBlock(state)) popStateStack(state);
310
+ return "tag";
311
+ }
312
+ if(ch == ">") {
313
+ if(isInXmlAttributeBlock(state)) popStateStack(state);
314
+ return "tag";
315
+ }
316
+ if(ch == "=")
317
+ return null;
318
+ // quoted string
319
+ if (ch == '"' || ch == "'")
320
+ return chain(stream, state, tokenString(ch, tokenAttribute));
321
+
322
+ if(!isInXmlAttributeBlock(state))
323
+ pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
324
+
325
+ stream.eat(/[a-zA-Z_:]/);
326
+ stream.eatWhile(/[-a-zA-Z0-9_:.]/);
327
+ stream.eatSpace();
328
+
329
+ // the case where the attribute has not value and the tag was closed
330
+ if(stream.match(">", false) || stream.match("/", false)) {
331
+ popStateStack(state);
332
+ state.tokenize = tokenBase;
333
+ }
334
+
335
+ return "attribute";
336
+ }
337
+
338
+ // handle comments, including nested
339
+ function tokenXMLComment(stream, state) {
340
+ var ch;
341
+ while (ch = stream.next()) {
342
+ if (ch == "-" && stream.match("->", true)) {
343
+ state.tokenize = tokenBase;
344
+ return "comment";
345
+ }
346
+ }
347
+ }
348
+
349
+
350
+ // handle CDATA
351
+ function tokenCDATA(stream, state) {
352
+ var ch;
353
+ while (ch = stream.next()) {
354
+ if (ch == "]" && stream.match("]", true)) {
355
+ state.tokenize = tokenBase;
356
+ return "comment";
357
+ }
358
+ }
359
+ }
360
+
361
+ // handle preprocessing instructions
362
+ function tokenPreProcessing(stream, state) {
363
+ var ch;
364
+ while (ch = stream.next()) {
365
+ if (ch == "?" && stream.match(">", true)) {
366
+ state.tokenize = tokenBase;
367
+ return "processingInstruction";
368
+ }
369
+ }
370
+ }
371
+
372
+
373
+ // functions to test the current context of the state
374
+ function isInXmlBlock(state) { return isIn(state, "tag"); }
375
+ function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
376
+ function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
377
+ function isInString(state) { return isIn(state, "string"); }
378
+
379
+ function isEQNameAhead(stream) {
380
+ // assume we've already eaten a quote (")
381
+ if(stream.current() === '"')
382
+ return stream.match(/^[^\"]+\"\:/, false);
383
+ else if(stream.current() === '\'')
384
+ return stream.match(/^[^\"]+\'\:/, false);
385
+ else
386
+ return false;
387
+ }
388
+
389
+ function isIn(state, type) {
390
+ return (state.stack.length && state.stack[state.stack.length - 1].type == type);
391
+ }
392
+
393
+ function pushStateStack(state, newState) {
394
+ state.stack.push(newState);
395
+ }
396
+
397
+ function popStateStack(state) {
398
+ state.stack.pop();
399
+ var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
400
+ state.tokenize = reinstateTokenize || tokenBase;
401
+ }
402
+
403
+ // the interface for the mode API
404
+ const xQuery = {
405
+ name: "xquery",
406
+ startState: function() {
407
+ return {
408
+ tokenize: tokenBase,
409
+ cc: [],
410
+ stack: []
411
+ };
412
+ },
413
+
414
+ token: function(stream, state) {
415
+ if (stream.eatSpace()) return null;
416
+ var style = state.tokenize(stream, state);
417
+ return style;
418
+ },
419
+
420
+ languageData: {
421
+ commentTokens: {block: {open: "(:", close: ":)"}}
422
+ }
423
+ };
424
+
425
+ export { xQuery };
@@ -0,0 +1,182 @@
1
+ function words(str) {
2
+ var obj = {}, words = str.split(" ");
3
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
4
+ return obj;
5
+ }
6
+
7
+ var bodiedOps = words("Assert BackQuote D Defun Deriv For ForEach FromFile " +
8
+ "FromString Function Integrate InverseTaylor Limit " +
9
+ "LocalSymbols Macro MacroRule MacroRulePattern " +
10
+ "NIntegrate Rule RulePattern Subst TD TExplicitSum " +
11
+ "TSum Taylor Taylor1 Taylor2 Taylor3 ToFile " +
12
+ "ToStdout ToString TraceRule Until While");
13
+
14
+ // patterns
15
+ var pFloatForm = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)";
16
+ var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)";
17
+
18
+ // regular expressions
19
+ var reFloatForm = new RegExp(pFloatForm);
20
+ var reIdentifier = new RegExp(pIdentifier);
21
+ var rePattern = new RegExp(pIdentifier + "?_" + pIdentifier);
22
+ var reFunctionLike = new RegExp(pIdentifier + "\\s*\\(");
23
+
24
+ function tokenBase(stream, state) {
25
+ var ch;
26
+
27
+ // get next character
28
+ ch = stream.next();
29
+
30
+ // string
31
+ if (ch === '"') {
32
+ state.tokenize = tokenString;
33
+ return state.tokenize(stream, state);
34
+ }
35
+
36
+ // comment
37
+ if (ch === '/') {
38
+ if (stream.eat('*')) {
39
+ state.tokenize = tokenComment;
40
+ return state.tokenize(stream, state);
41
+ }
42
+ if (stream.eat("/")) {
43
+ stream.skipToEnd();
44
+ return "comment";
45
+ }
46
+ }
47
+
48
+ // go back one character
49
+ stream.backUp(1);
50
+
51
+ // update scope info
52
+ var m = stream.match(/^(\w+)\s*\(/, false);
53
+ if (m !== null && bodiedOps.hasOwnProperty(m[1]))
54
+ state.scopes.push('bodied');
55
+
56
+ var scope = currentScope(state);
57
+
58
+ if (scope === 'bodied' && ch === '[')
59
+ state.scopes.pop();
60
+
61
+ if (ch === '[' || ch === '{' || ch === '(')
62
+ state.scopes.push(ch);
63
+
64
+ scope = currentScope(state);
65
+
66
+ if (scope === '[' && ch === ']' ||
67
+ scope === '{' && ch === '}' ||
68
+ scope === '(' && ch === ')')
69
+ state.scopes.pop();
70
+
71
+ if (ch === ';') {
72
+ while (scope === 'bodied') {
73
+ state.scopes.pop();
74
+ scope = currentScope(state);
75
+ }
76
+ }
77
+
78
+ // look for ordered rules
79
+ if (stream.match(/\d+ *#/, true, false)) {
80
+ return 'qualifier';
81
+ }
82
+
83
+ // look for numbers
84
+ if (stream.match(reFloatForm, true, false)) {
85
+ return 'number';
86
+ }
87
+
88
+ // look for placeholders
89
+ if (stream.match(rePattern, true, false)) {
90
+ return 'variableName.special';
91
+ }
92
+
93
+ // match all braces separately
94
+ if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
95
+ return 'bracket';
96
+ }
97
+
98
+ // literals looking like function calls
99
+ if (stream.match(reFunctionLike, true, false)) {
100
+ stream.backUp(1);
101
+ return 'variableName.function';
102
+ }
103
+
104
+ // all other identifiers
105
+ if (stream.match(reIdentifier, true, false)) {
106
+ return 'variable';
107
+ }
108
+
109
+ // operators; note that operators like @@ or /; are matched separately for each symbol.
110
+ if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%|#)/, true, false)) {
111
+ return 'operator';
112
+ }
113
+
114
+ // everything else is an error
115
+ return 'error';
116
+ }
117
+
118
+ function tokenString(stream, state) {
119
+ var next, end = false, escaped = false;
120
+ while ((next = stream.next()) != null) {
121
+ if (next === '"' && !escaped) {
122
+ end = true;
123
+ break;
124
+ }
125
+ escaped = !escaped && next === '\\';
126
+ }
127
+ if (end && !escaped) {
128
+ state.tokenize = tokenBase;
129
+ }
130
+ return 'string';
131
+ }
132
+ function tokenComment(stream, state) {
133
+ var prev, next;
134
+ while((next = stream.next()) != null) {
135
+ if (prev === '*' && next === '/') {
136
+ state.tokenize = tokenBase;
137
+ break;
138
+ }
139
+ prev = next;
140
+ }
141
+ return 'comment';
142
+ }
143
+
144
+ function currentScope(state) {
145
+ var scope = null;
146
+ if (state.scopes.length > 0)
147
+ scope = state.scopes[state.scopes.length - 1];
148
+ return scope;
149
+ }
150
+
151
+ const yacas = {
152
+ name: "yacas",
153
+ startState: function() {
154
+ return {
155
+ tokenize: tokenBase,
156
+ scopes: []
157
+ };
158
+ },
159
+ token: function(stream, state) {
160
+ if (stream.eatSpace()) return null;
161
+ return state.tokenize(stream, state);
162
+ },
163
+ indent: function(state, textAfter, cx) {
164
+ if (state.tokenize !== tokenBase && state.tokenize !== null)
165
+ return null;
166
+
167
+ var delta = 0;
168
+ if (textAfter === ']' || textAfter === '];' ||
169
+ textAfter === '}' || textAfter === '};' ||
170
+ textAfter === ');')
171
+ delta = -1;
172
+
173
+ return (state.scopes.length + delta) * cx.unit;
174
+ },
175
+
176
+ languageData: {
177
+ electricInput: /[{}\[\]()\;]/,
178
+ commentTokens: {line: "//", block: {open: "/*", close: "*/"}}
179
+ }
180
+ };
181
+
182
+ export { yacas };