@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,135 @@
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(state) {
18
+ var s = {state: state.state, pending: state.pending, indent: state.indent && state.indent.slice(0)};
19
+ if (state.stack)
20
+ s.stack = state.stack.slice(0);
21
+ return s;
22
+ },
23
+ token: tokenFunction(states_),
24
+ indent: indentFunction(states_, meta),
25
+ languageData: meta
26
+ }
27
+ }
28
+ function ensureState(states, name) {
29
+ if (!states.hasOwnProperty(name))
30
+ throw new Error("Undefined state " + name + " in simple mode");
31
+ }
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
+ val = val.source;
39
+ } else {
40
+ val = String(val);
41
+ }
42
+ return new RegExp(("^") + "(?:" + val + ")", flags);
43
+ }
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
+
55
+ function Rule(data, states) {
56
+ if (data.next || data.push) ensureState(states, data.next || data.push);
57
+ this.regex = toRegex(data.regex);
58
+ this.token = asToken(data.token);
59
+ this.data = data;
60
+ }
61
+
62
+ function tokenFunction(states) {
63
+ return function(stream, state) {
64
+ if (state.pending) {
65
+ var pend = state.pending.shift();
66
+ if (state.pending.length == 0) state.pending = null;
67
+ stream.pos += pend.text.length;
68
+ return pend.token;
69
+ }
70
+
71
+ var curState = states[state.state];
72
+ for (var i = 0; i < curState.length; i++) {
73
+ var rule = curState[i];
74
+ var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
75
+ if (matches) {
76
+ if (rule.data.next) {
77
+ state.state = rule.data.next;
78
+ } else if (rule.data.push) {
79
+ (state.stack || (state.stack = [])).push(state.state);
80
+ state.state = rule.data.push;
81
+ } else if (rule.data.pop && state.stack && state.stack.length) {
82
+ state.state = state.stack.pop();
83
+ }
84
+
85
+ if (rule.data.indent)
86
+ state.indent.push(stream.indentation() + stream.indentUnit);
87
+ if (rule.data.dedent)
88
+ state.indent.pop();
89
+ var token = rule.token;
90
+ if (token && token.apply) token = token(matches);
91
+ if (matches.length > 2 && rule.token && typeof rule.token != "string") {
92
+ state.pending = [];
93
+ for (var j = 2; j < matches.length; j++)
94
+ if (matches[j])
95
+ state.pending.push({text: matches[j], token: rule.token[j - 1]});
96
+ stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
97
+ return token[0];
98
+ } else if (token && token.join) {
99
+ return token[0];
100
+ } else {
101
+ return token;
102
+ }
103
+ }
104
+ }
105
+ stream.next();
106
+ return null;
107
+ };
108
+ }
109
+
110
+ function indentFunction(states, meta) {
111
+ return function(state, textAfter) {
112
+ if (state.indent == null || meta.dontIndentStates && meta.doneIndentState.indexOf(state.state) > -1)
113
+ return null
114
+
115
+ var pos = state.indent.length - 1, rules = states[state.state];
116
+ scan: for (;;) {
117
+ for (var i = 0; i < rules.length; i++) {
118
+ var rule = rules[i];
119
+ if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
120
+ var m = rule.regex.exec(textAfter);
121
+ if (m && m[0]) {
122
+ pos--;
123
+ if (rule.next || rule.push) rules = states[rule.next || rule.push];
124
+ textAfter = textAfter.slice(m[0].length);
125
+ continue scan;
126
+ }
127
+ }
128
+ }
129
+ break;
130
+ }
131
+ return pos < 0 ? 0 : state.indent[pos];
132
+ };
133
+ }
134
+
135
+ export { simpleMode as s };
@@ -0,0 +1,153 @@
1
+ var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
2
+ var keywords = /true|false|nil|self|super|thisContext/;
3
+
4
+ var Context = function(tokenizer, parent) {
5
+ this.next = tokenizer;
6
+ this.parent = parent;
7
+ };
8
+
9
+ var Token = function(name, context, eos) {
10
+ this.name = name;
11
+ this.context = context;
12
+ this.eos = eos;
13
+ };
14
+
15
+ var State = function() {
16
+ this.context = new Context(next, null);
17
+ this.expectVariable = true;
18
+ this.indentation = 0;
19
+ this.userIndentationDelta = 0;
20
+ };
21
+
22
+ State.prototype.userIndent = function(indentation, indentUnit) {
23
+ this.userIndentationDelta = indentation > 0 ? (indentation / indentUnit - this.indentation) : 0;
24
+ };
25
+
26
+ var next = function(stream, context, state) {
27
+ var token = new Token(null, context, false);
28
+ var aChar = stream.next();
29
+
30
+ if (aChar === '"') {
31
+ token = nextComment(stream, new Context(nextComment, context));
32
+
33
+ } else if (aChar === '\'') {
34
+ token = nextString(stream, new Context(nextString, context));
35
+
36
+ } else if (aChar === '#') {
37
+ if (stream.peek() === '\'') {
38
+ stream.next();
39
+ token = nextSymbol(stream, new Context(nextSymbol, context));
40
+ } else {
41
+ if (stream.eatWhile(/[^\s.{}\[\]()]/))
42
+ token.name = 'string.special';
43
+ else
44
+ token.name = 'meta';
45
+ }
46
+
47
+ } else if (aChar === '$') {
48
+ if (stream.next() === '<') {
49
+ stream.eatWhile(/[^\s>]/);
50
+ stream.next();
51
+ }
52
+ token.name = 'string.special';
53
+
54
+ } else if (aChar === '|' && state.expectVariable) {
55
+ token.context = new Context(nextTemporaries, context);
56
+
57
+ } else if (/[\[\]{}()]/.test(aChar)) {
58
+ token.name = 'bracket';
59
+ token.eos = /[\[{(]/.test(aChar);
60
+
61
+ if (aChar === '[') {
62
+ state.indentation++;
63
+ } else if (aChar === ']') {
64
+ state.indentation = Math.max(0, state.indentation - 1);
65
+ }
66
+
67
+ } else if (specialChars.test(aChar)) {
68
+ stream.eatWhile(specialChars);
69
+ token.name = 'operator';
70
+ token.eos = aChar !== ';'; // ; cascaded message expression
71
+
72
+ } else if (/\d/.test(aChar)) {
73
+ stream.eatWhile(/[\w\d]/);
74
+ token.name = 'number';
75
+
76
+ } else if (/[\w_]/.test(aChar)) {
77
+ stream.eatWhile(/[\w\d_]/);
78
+ token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
79
+
80
+ } else {
81
+ token.eos = state.expectVariable;
82
+ }
83
+
84
+ return token;
85
+ };
86
+
87
+ var nextComment = function(stream, context) {
88
+ stream.eatWhile(/[^"]/);
89
+ return new Token('comment', stream.eat('"') ? context.parent : context, true);
90
+ };
91
+
92
+ var nextString = function(stream, context) {
93
+ stream.eatWhile(/[^']/);
94
+ return new Token('string', stream.eat('\'') ? context.parent : context, false);
95
+ };
96
+
97
+ var nextSymbol = function(stream, context) {
98
+ stream.eatWhile(/[^']/);
99
+ return new Token('string.special', stream.eat('\'') ? context.parent : context, false);
100
+ };
101
+
102
+ var nextTemporaries = function(stream, context) {
103
+ var token = new Token(null, context, false);
104
+ var aChar = stream.next();
105
+
106
+ if (aChar === '|') {
107
+ token.context = context.parent;
108
+ token.eos = true;
109
+
110
+ } else {
111
+ stream.eatWhile(/[^|]/);
112
+ token.name = 'variable';
113
+ }
114
+
115
+ return token;
116
+ };
117
+
118
+ const smalltalk = {
119
+ name: "smalltalk",
120
+
121
+ startState: function() {
122
+ return new State;
123
+ },
124
+
125
+ token: function(stream, state) {
126
+ state.userIndent(stream.indentation(), stream.indentUnit);
127
+
128
+ if (stream.eatSpace()) {
129
+ return null;
130
+ }
131
+
132
+ var token = state.context.next(stream, state.context, state);
133
+ state.context = token.context;
134
+ state.expectVariable = token.eos;
135
+
136
+ return token.name;
137
+ },
138
+
139
+ blankLine: function(state, indentUnit) {
140
+ state.userIndent(0, indentUnit);
141
+ },
142
+
143
+ indent: function(state, textAfter, cx) {
144
+ var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
145
+ return (state.indentation + i) * cx.unit;
146
+ },
147
+
148
+ languageData: {
149
+ indentOnInput: /^\s*\]$/
150
+ }
151
+ };
152
+
153
+ export { smalltalk };
@@ -0,0 +1,80 @@
1
+ var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/;
2
+ var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/;
3
+ var isOperatorString = /^(OR|AND|NOT|TO)$/;
4
+
5
+ function isNumber(word) {
6
+ return parseFloat(word).toString() === word;
7
+ }
8
+
9
+ function tokenString(quote) {
10
+ return function(stream, state) {
11
+ var escaped = false, next;
12
+ while ((next = stream.next()) != null) {
13
+ if (next == quote && !escaped) break;
14
+ escaped = !escaped && next == "\\";
15
+ }
16
+
17
+ if (!escaped) state.tokenize = tokenBase;
18
+ return "string";
19
+ };
20
+ }
21
+
22
+ function tokenOperator(operator) {
23
+ return function(stream, state) {
24
+ if (operator == "|")
25
+ stream.eat(/\|/);
26
+ else if (operator == "&")
27
+ stream.eat(/\&/);
28
+
29
+ state.tokenize = tokenBase;
30
+ return "operator";
31
+ };
32
+ }
33
+
34
+ function tokenWord(ch) {
35
+ return function(stream, state) {
36
+ var word = ch;
37
+ while ((ch = stream.peek()) && ch.match(isStringChar) != null) {
38
+ word += stream.next();
39
+ }
40
+
41
+ state.tokenize = tokenBase;
42
+ if (isOperatorString.test(word))
43
+ return "operator";
44
+ else if (isNumber(word))
45
+ return "number";
46
+ else if (stream.peek() == ":")
47
+ return "propertyName";
48
+ else
49
+ return "string";
50
+ };
51
+ }
52
+
53
+ function tokenBase(stream, state) {
54
+ var ch = stream.next();
55
+ if (ch == '"')
56
+ state.tokenize = tokenString(ch);
57
+ else if (isOperatorChar.test(ch))
58
+ state.tokenize = tokenOperator(ch);
59
+ else if (isStringChar.test(ch))
60
+ state.tokenize = tokenWord(ch);
61
+
62
+ return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null;
63
+ }
64
+
65
+ const solr = {
66
+ name: "solr",
67
+
68
+ startState: function() {
69
+ return {
70
+ tokenize: tokenBase
71
+ };
72
+ },
73
+
74
+ token: function(stream, state) {
75
+ if (stream.eatSpace()) return null;
76
+ return state.tokenize(stream, state);
77
+ }
78
+ };
79
+
80
+ export { solr };
@@ -0,0 +1,170 @@
1
+ var curPunc;
2
+
3
+ function wordRegexp(words) {
4
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
5
+ }
6
+ var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
7
+ "iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample",
8
+ "group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen",
9
+ "replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends",
10
+ "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds",
11
+ "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384",
12
+ "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists",
13
+ "isblank", "isliteral", "a", "bind"]);
14
+ var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
15
+ "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
16
+ "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group",
17
+ "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union",
18
+ "true", "false", "with",
19
+ "data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]);
20
+ var operatorChars = /[*+\-<>=&|\^\/!\?]/;
21
+ var PN_CHARS = "[A-Za-z_\\-0-9]";
22
+ var PREFIX_START = new RegExp("[A-Za-z]");
23
+ var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");
24
+
25
+ function tokenBase(stream, state) {
26
+ var ch = stream.next();
27
+ curPunc = null;
28
+ if (ch == "$" || ch == "?") {
29
+ if(ch == "?" && stream.match(/\s/, false)){
30
+ return "operator";
31
+ }
32
+ 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]*/);
33
+ return "variableName.local";
34
+ }
35
+ else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
36
+ stream.match(/^[^\s\u00a0>]*>?/);
37
+ return "atom";
38
+ }
39
+ else if (ch == "\"" || ch == "'") {
40
+ state.tokenize = tokenLiteral(ch);
41
+ return state.tokenize(stream, state);
42
+ }
43
+ else if (/[{}\(\),\.;\[\]]/.test(ch)) {
44
+ curPunc = ch;
45
+ return "bracket";
46
+ }
47
+ else if (ch == "#") {
48
+ stream.skipToEnd();
49
+ return "comment";
50
+ }
51
+ else if (operatorChars.test(ch)) {
52
+ return "operator";
53
+ }
54
+ else if (ch == ":") {
55
+ eatPnLocal(stream);
56
+ return "atom";
57
+ }
58
+ else if (ch == "@") {
59
+ stream.eatWhile(/[a-z\d\-]/i);
60
+ return "meta";
61
+ }
62
+ else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
63
+ eatPnLocal(stream);
64
+ return "atom";
65
+ }
66
+ stream.eatWhile(/[_\w\d]/);
67
+ var word = stream.current();
68
+ if (ops.test(word))
69
+ return "builtin";
70
+ else if (keywords.test(word))
71
+ return "keyword";
72
+ else
73
+ return "variable";
74
+ }
75
+
76
+ function eatPnLocal(stream) {
77
+ stream.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i);
78
+ }
79
+
80
+ function tokenLiteral(quote) {
81
+ return function(stream, state) {
82
+ var escaped = false, ch;
83
+ while ((ch = stream.next()) != null) {
84
+ if (ch == quote && !escaped) {
85
+ state.tokenize = tokenBase;
86
+ break;
87
+ }
88
+ escaped = !escaped && ch == "\\";
89
+ }
90
+ return "string";
91
+ };
92
+ }
93
+
94
+ function pushContext(state, type, col) {
95
+ state.context = {prev: state.context, indent: state.indent, col: col, type: type};
96
+ }
97
+ function popContext(state) {
98
+ state.indent = state.context.indent;
99
+ state.context = state.context.prev;
100
+ }
101
+
102
+ const sparql = {
103
+ name: "sparql",
104
+
105
+ startState: function() {
106
+ return {tokenize: tokenBase,
107
+ context: null,
108
+ indent: 0,
109
+ col: 0};
110
+ },
111
+
112
+ token: function(stream, state) {
113
+ if (stream.sol()) {
114
+ if (state.context && state.context.align == null) state.context.align = false;
115
+ state.indent = stream.indentation();
116
+ }
117
+ if (stream.eatSpace()) return null;
118
+ var style = state.tokenize(stream, state);
119
+
120
+ if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
121
+ state.context.align = true;
122
+ }
123
+
124
+ if (curPunc == "(") pushContext(state, ")", stream.column());
125
+ else if (curPunc == "[") pushContext(state, "]", stream.column());
126
+ else if (curPunc == "{") pushContext(state, "}", stream.column());
127
+ else if (/[\]\}\)]/.test(curPunc)) {
128
+ while (state.context && state.context.type == "pattern") popContext(state);
129
+ if (state.context && curPunc == state.context.type) {
130
+ popContext(state);
131
+ if (curPunc == "}" && state.context && state.context.type == "pattern")
132
+ popContext(state);
133
+ }
134
+ }
135
+ else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
136
+ else if (/atom|string|variable/.test(style) && state.context) {
137
+ if (/[\}\]]/.test(state.context.type))
138
+ pushContext(state, "pattern", stream.column());
139
+ else if (state.context.type == "pattern" && !state.context.align) {
140
+ state.context.align = true;
141
+ state.context.col = stream.column();
142
+ }
143
+ }
144
+
145
+ return style;
146
+ },
147
+
148
+ indent: function(state, textAfter, cx) {
149
+ var firstChar = textAfter && textAfter.charAt(0);
150
+ var context = state.context;
151
+ if (/[\]\}]/.test(firstChar))
152
+ while (context && context.type == "pattern") context = context.prev;
153
+
154
+ var closing = context && firstChar == context.type;
155
+ if (!context)
156
+ return 0;
157
+ else if (context.type == "pattern")
158
+ return context.col;
159
+ else if (context.align)
160
+ return context.col + (closing ? 0 : 1);
161
+ else
162
+ return context.indent + (closing ? 0 : cx.unit);
163
+ },
164
+
165
+ languageData: {
166
+ commentTokens: {line: "#"}
167
+ }
168
+ };
169
+
170
+ export { sparql };
@@ -0,0 +1,98 @@
1
+ const spreadsheet = {
2
+ name: "spreadsheet",
3
+
4
+ startState: function () {
5
+ return {
6
+ stringType: null,
7
+ stack: []
8
+ };
9
+ },
10
+ token: function (stream, state) {
11
+ if (!stream) return;
12
+
13
+ //check for state changes
14
+ if (state.stack.length === 0) {
15
+ //strings
16
+ if ((stream.peek() == '"') || (stream.peek() == "'")) {
17
+ state.stringType = stream.peek();
18
+ stream.next(); // Skip quote
19
+ state.stack.unshift("string");
20
+ }
21
+ }
22
+
23
+ //return state
24
+ //stack has
25
+ switch (state.stack[0]) {
26
+ case "string":
27
+ while (state.stack[0] === "string" && !stream.eol()) {
28
+ if (stream.peek() === state.stringType) {
29
+ stream.next(); // Skip quote
30
+ state.stack.shift(); // Clear flag
31
+ } else if (stream.peek() === "\\") {
32
+ stream.next();
33
+ stream.next();
34
+ } else {
35
+ stream.match(/^.[^\\\"\']*/);
36
+ }
37
+ }
38
+ return "string";
39
+
40
+ case "characterClass":
41
+ while (state.stack[0] === "characterClass" && !stream.eol()) {
42
+ if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./)))
43
+ state.stack.shift();
44
+ }
45
+ return "operator";
46
+ }
47
+
48
+ var peek = stream.peek();
49
+
50
+ //no stack
51
+ switch (peek) {
52
+ case "[":
53
+ stream.next();
54
+ state.stack.unshift("characterClass");
55
+ return "bracket";
56
+ case ":":
57
+ stream.next();
58
+ return "operator";
59
+ case "\\":
60
+ if (stream.match(/\\[a-z]+/)) return "string.special";
61
+ else {
62
+ stream.next();
63
+ return "atom";
64
+ }
65
+ case ".":
66
+ case ",":
67
+ case ";":
68
+ case "*":
69
+ case "-":
70
+ case "+":
71
+ case "^":
72
+ case "<":
73
+ case "/":
74
+ case "=":
75
+ stream.next();
76
+ return "atom";
77
+ case "$":
78
+ stream.next();
79
+ return "builtin";
80
+ }
81
+
82
+ if (stream.match(/\d+/)) {
83
+ if (stream.match(/^\w+/)) return "error";
84
+ return "number";
85
+ } else if (stream.match(/^[a-zA-Z_]\w*/)) {
86
+ if (stream.match(/(?=[\(.])/, false)) return "keyword";
87
+ return "variable";
88
+ } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) {
89
+ stream.next();
90
+ return "bracket";
91
+ } else if (!stream.eatSpace()) {
92
+ stream.next();
93
+ }
94
+ return null;
95
+ }
96
+ };
97
+
98
+ export { spreadsheet };