@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.
- package/dist/apl-NdZ6-T1z.js +142 -0
- package/dist/apps/depthai-visualizer/lib/src/components/Panel.d.ts +2 -0
- package/dist/apps/depthai-visualizer/lib/src/components/Panel.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/components/Panel.js +2 -2
- package/dist/apps/depthai-visualizer/lib/src/components/Panel.js.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.d.ts +4 -1
- package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.js +25 -13
- package/dist/apps/depthai-visualizer/lib/src/components/PanelToolbar.js.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.d.ts +2 -8
- package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.js +1 -1
- package/dist/apps/depthai-visualizer/lib/src/panels/ImagePanel.js.map +1 -1
- package/dist/apps/depthai-visualizer/lib/src/panels/PointCloudPanel.js +2 -2
- package/dist/apps/depthai-visualizer/lib/src/panels/PointCloudPanel.js.map +1 -1
- package/dist/asciiarmor-CmJEbAuq.js +56 -0
- package/dist/asn1-CG_zvzH1.js +192 -0
- package/dist/asterisk-D6r__RMF.js +187 -0
- package/dist/brainfuck-COwWCBpq.js +70 -0
- package/dist/clike-BjlaHgsH.js +1018 -0
- package/dist/clojure-C2XPrGCa.js +274 -0
- package/dist/cmake-BGrEgXCL.js +81 -0
- package/dist/cobol-BfwG5XeO.js +235 -0
- package/dist/coffeescript-BG8vTfSz.js +329 -0
- package/dist/commonlisp-8oE2EpEe.js +108 -0
- package/dist/crystal--rIRMl16.js +419 -0
- package/dist/css-C_ZeEwz2.js +847 -0
- package/dist/cypher-Bayei42D.js +122 -0
- package/dist/d-B0hhz6be.js +205 -0
- package/dist/diff-DQutOIXs.js +30 -0
- package/dist/dockerfile-FAjn0vs9.js +199 -0
- package/dist/dtd-C1CeYVnM.js +121 -0
- package/dist/dylan-Dm9-uD-A.js +337 -0
- package/dist/ebnf-jWG_1Yly.js +151 -0
- package/dist/ecl-CgJPA6z9.js +190 -0
- package/dist/eiffel-lj7uLahq.js +146 -0
- package/dist/elm-Cz7o1ijk.js +230 -0
- package/dist/erlang-CyL5QOyR.js +581 -0
- package/dist/factor-B0KnwW_L.js +65 -0
- package/dist/fcl-DiozYjc8.js +154 -0
- package/dist/forth-B7vn5ze0.js +164 -0
- package/dist/fortran-D2XNEnBT.js +172 -0
- package/dist/gas-B_Tj57Ve.js +343 -0
- package/dist/gherkin-CJ6Qk4EZ.js +147 -0
- package/dist/groovy-BD9p_7sW.js +230 -0
- package/dist/haskell-BHnm1B83.js +239 -0
- package/dist/haxe-DWtZc5G9.js +490 -0
- package/dist/http-BOd5SYCT.js +89 -0
- package/dist/idl-FSFk8_xX.js +274 -0
- package/dist/index-B2YTRRfg.js +77 -0
- package/dist/{index-B8tJ5E-v.js → index-Beii0-_3.js} +7 -4
- package/dist/index-BjWYigIi.js +124 -0
- package/dist/index-Bx-Bh4nu.js +114 -0
- package/dist/index-Bya68zyH.js +154265 -0
- package/dist/index-C3_VkVgd.js +626 -0
- package/dist/index-CIOyzzeT.js +199 -0
- package/dist/index-CY_MdHWz.js +810 -0
- package/dist/index-D8b2daZv.js +155 -0
- package/dist/index-DW9KaYNb.js +149 -0
- package/dist/index-DZ4eTPnT.js +497 -0
- package/dist/index-DZeM9OAW.js +356 -0
- package/dist/index-DgQXSEwG.js +348 -0
- package/dist/index-DuTu94nj.js +436 -0
- package/dist/{index-CDLN8AQd.js → index-KZ3VqQGp.js} +88 -35
- package/dist/index-WQmqQNn4.js +205 -0
- package/dist/index-o4kozweh.js +458 -0
- package/dist/index-rTpSqKsn.js +103 -0
- package/dist/index-tmy4XtHv.js +346 -0
- package/dist/index.js +7 -3
- package/dist/javascript-CWIx5LQU.js +922 -0
- package/dist/jinja2-D9k5QrXv.js +171 -0
- package/dist/julia-DM42tOPB.js +369 -0
- package/dist/livescript-Jd_p-LwX.js +259 -0
- package/dist/lua-CByQu4v6.js +137 -0
- package/dist/mathematica-Dkv0uCYF.js +153 -0
- package/dist/mbox-CYTvs5kC.js +114 -0
- package/dist/mirc-DpgP3GCo.js +176 -0
- package/dist/mllike-Ti5DOjKW.js +346 -0
- package/dist/modelica-CR6hTSce.js +192 -0
- package/dist/mscgen-D0GXtzMS.js +149 -0
- package/dist/mumps-Bf1EyDa6.js +129 -0
- package/dist/nginx-By9Phklj.js +163 -0
- package/dist/nsis-27gzqCGG.js +80 -0
- package/dist/ntriples-C7VJ7pnm.js +141 -0
- package/dist/octave-6yR_ix15.js +112 -0
- package/dist/oz-CEUnktiQ.js +235 -0
- package/dist/package.json +1 -0
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.d.ts +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.d.ts.map +1 -1
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js +47 -18
- package/dist/packages/studio-base/src/panels/ThreeDeeRender/renderables/ImageMode/MessageHandler.js.map +1 -1
- package/dist/pascal-AdN1jbEG.js +124 -0
- package/dist/perl-B99DUQQt.js +819 -0
- package/dist/pig-DFeDRta6.js +149 -0
- package/dist/powershell-DhwsNWMx.js +381 -0
- package/dist/properties-o21uErwC.js +62 -0
- package/dist/protobuf-YxlANsmD.js +54 -0
- package/dist/pug-OXF_6qhs.js +504 -0
- package/dist/puppet-B8WICGYE.js +205 -0
- package/dist/python-D3FFx1Id.js +389 -0
- package/dist/q-D2Hjhl2C.js +123 -0
- package/dist/r-D73k5lac.js +174 -0
- package/dist/rpm-Duv_WH0z.js +89 -0
- package/dist/ruby-DGCVqZDt.js +287 -0
- package/dist/sas-XjPv1Vy5.js +268 -0
- package/dist/scheme-DeaA28vt.js +263 -0
- package/dist/shell-Bx6QZTgx.js +145 -0
- package/dist/sieve-CWCD62sW.js +178 -0
- package/dist/simple-mode-DAYwfn8M.js +135 -0
- package/dist/smalltalk-DSQbF4MF.js +153 -0
- package/dist/solr-v_XRf31C.js +80 -0
- package/dist/sparql-BrfDqf0-.js +170 -0
- package/dist/spreadsheet-Csn84Pef.js +98 -0
- package/dist/sql-Bhuc3u9R.js +481 -0
- package/dist/stex-DBkktma-.js +246 -0
- package/dist/stylus-dNd_pqKl.js +750 -0
- package/dist/swift-CHbTprt3.js +202 -0
- package/dist/tcl-BRlMUELr.js +125 -0
- package/dist/textile-CqfTUjd4.js +441 -0
- package/dist/tiddlywiki-BrsoM8KB.js +278 -0
- package/dist/tiki-D-ivWPkc.js +289 -0
- package/dist/toml-t_IhJu83.js +75 -0
- package/dist/troff-DckGF2AE.js +64 -0
- package/dist/ttcn-DlN2TOzU.js +257 -0
- package/dist/ttcn-cfg-pHSvg1fS.js +201 -0
- package/dist/turtle-D9Js0BlL.js +141 -0
- package/dist/vb-CbIGLrpY.js +249 -0
- package/dist/vbscript-8ANWle9n.js +320 -0
- package/dist/velocity-D6hz3Hzw.js +186 -0
- package/dist/verilog-DIV442at.js +565 -0
- package/dist/vhdl-BlTiZo_v.js +174 -0
- package/dist/webidl-Cp3tcqdk.js +179 -0
- package/dist/xquery-BOQU-_D-.js +425 -0
- package/dist/yacas-DQ1WucF0.js +182 -0
- package/dist/z80-P1j44jDI.js +102 -0
- package/package.json +2 -1
- package/dist/index-BoCFgPcb.js +0 -23123
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
var ERRORCLASS = "error";
|
|
2
|
+
|
|
3
|
+
function wordRegexp(words) {
|
|
4
|
+
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
|
|
8
|
+
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
|
|
9
|
+
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
|
|
10
|
+
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
|
|
11
|
+
|
|
12
|
+
var wordOperators = wordRegexp(["and", "or", "not",
|
|
13
|
+
"is", "isnt", "in",
|
|
14
|
+
"instanceof", "typeof"]);
|
|
15
|
+
var indentKeywords = ["for", "while", "loop", "if", "unless", "else",
|
|
16
|
+
"switch", "try", "catch", "finally", "class"];
|
|
17
|
+
var commonKeywords = ["break", "by", "continue", "debugger", "delete",
|
|
18
|
+
"do", "in", "of", "new", "return", "then",
|
|
19
|
+
"this", "@", "throw", "when", "until", "extends"];
|
|
20
|
+
|
|
21
|
+
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
|
|
22
|
+
|
|
23
|
+
indentKeywords = wordRegexp(indentKeywords);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var stringPrefixes = /^('{3}|\"{3}|['\"])/;
|
|
27
|
+
var regexPrefixes = /^(\/{3}|\/)/;
|
|
28
|
+
var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"];
|
|
29
|
+
var constants = wordRegexp(commonConstants);
|
|
30
|
+
|
|
31
|
+
// Tokenizers
|
|
32
|
+
function tokenBase(stream, state) {
|
|
33
|
+
// Handle scope changes
|
|
34
|
+
if (stream.sol()) {
|
|
35
|
+
if (state.scope.align === null) state.scope.align = false;
|
|
36
|
+
var scopeOffset = state.scope.offset;
|
|
37
|
+
if (stream.eatSpace()) {
|
|
38
|
+
var lineOffset = stream.indentation();
|
|
39
|
+
if (lineOffset > scopeOffset && state.scope.type == "coffee") {
|
|
40
|
+
return "indent";
|
|
41
|
+
} else if (lineOffset < scopeOffset) {
|
|
42
|
+
return "dedent";
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
} else {
|
|
46
|
+
if (scopeOffset > 0) {
|
|
47
|
+
dedent(stream, state);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (stream.eatSpace()) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var ch = stream.peek();
|
|
56
|
+
|
|
57
|
+
// Handle docco title comment (single line)
|
|
58
|
+
if (stream.match("####")) {
|
|
59
|
+
stream.skipToEnd();
|
|
60
|
+
return "comment";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Handle multi line comments
|
|
64
|
+
if (stream.match("###")) {
|
|
65
|
+
state.tokenize = longComment;
|
|
66
|
+
return state.tokenize(stream, state);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Single line comment
|
|
70
|
+
if (ch === "#") {
|
|
71
|
+
stream.skipToEnd();
|
|
72
|
+
return "comment";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Handle number literals
|
|
76
|
+
if (stream.match(/^-?[0-9\.]/, false)) {
|
|
77
|
+
var floatLiteral = false;
|
|
78
|
+
// Floats
|
|
79
|
+
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
|
|
80
|
+
floatLiteral = true;
|
|
81
|
+
}
|
|
82
|
+
if (stream.match(/^-?\d+\.\d*/)) {
|
|
83
|
+
floatLiteral = true;
|
|
84
|
+
}
|
|
85
|
+
if (stream.match(/^-?\.\d+/)) {
|
|
86
|
+
floatLiteral = true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (floatLiteral) {
|
|
90
|
+
// prevent from getting extra . on 1..
|
|
91
|
+
if (stream.peek() == "."){
|
|
92
|
+
stream.backUp(1);
|
|
93
|
+
}
|
|
94
|
+
return "number";
|
|
95
|
+
}
|
|
96
|
+
// Integers
|
|
97
|
+
var intLiteral = false;
|
|
98
|
+
// Hex
|
|
99
|
+
if (stream.match(/^-?0x[0-9a-f]+/i)) {
|
|
100
|
+
intLiteral = true;
|
|
101
|
+
}
|
|
102
|
+
// Decimal
|
|
103
|
+
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
|
|
104
|
+
intLiteral = true;
|
|
105
|
+
}
|
|
106
|
+
// Zero by itself with no other piece of number.
|
|
107
|
+
if (stream.match(/^-?0(?![\dx])/i)) {
|
|
108
|
+
intLiteral = true;
|
|
109
|
+
}
|
|
110
|
+
if (intLiteral) {
|
|
111
|
+
return "number";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Handle strings
|
|
116
|
+
if (stream.match(stringPrefixes)) {
|
|
117
|
+
state.tokenize = tokenFactory(stream.current(), false, "string");
|
|
118
|
+
return state.tokenize(stream, state);
|
|
119
|
+
}
|
|
120
|
+
// Handle regex literals
|
|
121
|
+
if (stream.match(regexPrefixes)) {
|
|
122
|
+
if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
|
|
123
|
+
state.tokenize = tokenFactory(stream.current(), true, "string.special");
|
|
124
|
+
return state.tokenize(stream, state);
|
|
125
|
+
} else {
|
|
126
|
+
stream.backUp(1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// Handle operators and delimiters
|
|
133
|
+
if (stream.match(operators) || stream.match(wordOperators)) {
|
|
134
|
+
return "operator";
|
|
135
|
+
}
|
|
136
|
+
if (stream.match(delimiters)) {
|
|
137
|
+
return "punctuation";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (stream.match(constants)) {
|
|
141
|
+
return "atom";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
|
|
145
|
+
return "property";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (stream.match(keywords)) {
|
|
149
|
+
return "keyword";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (stream.match(identifiers)) {
|
|
153
|
+
return "variable";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Handle non-detected items
|
|
157
|
+
stream.next();
|
|
158
|
+
return ERRORCLASS;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function tokenFactory(delimiter, singleline, outclass) {
|
|
162
|
+
return function(stream, state) {
|
|
163
|
+
while (!stream.eol()) {
|
|
164
|
+
stream.eatWhile(/[^'"\/\\]/);
|
|
165
|
+
if (stream.eat("\\")) {
|
|
166
|
+
stream.next();
|
|
167
|
+
if (singleline && stream.eol()) {
|
|
168
|
+
return outclass;
|
|
169
|
+
}
|
|
170
|
+
} else if (stream.match(delimiter)) {
|
|
171
|
+
state.tokenize = tokenBase;
|
|
172
|
+
return outclass;
|
|
173
|
+
} else {
|
|
174
|
+
stream.eat(/['"\/]/);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (singleline) {
|
|
178
|
+
state.tokenize = tokenBase;
|
|
179
|
+
}
|
|
180
|
+
return outclass;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function longComment(stream, state) {
|
|
185
|
+
while (!stream.eol()) {
|
|
186
|
+
stream.eatWhile(/[^#]/);
|
|
187
|
+
if (stream.match("###")) {
|
|
188
|
+
state.tokenize = tokenBase;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
stream.eatWhile("#");
|
|
192
|
+
}
|
|
193
|
+
return "comment";
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function indent(stream, state, type = "coffee") {
|
|
197
|
+
var offset = 0, align = false, alignOffset = null;
|
|
198
|
+
for (var scope = state.scope; scope; scope = scope.prev) {
|
|
199
|
+
if (scope.type === "coffee" || scope.type == "}") {
|
|
200
|
+
offset = scope.offset + stream.indentUnit;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (type !== "coffee") {
|
|
205
|
+
align = null;
|
|
206
|
+
alignOffset = stream.column() + stream.current().length;
|
|
207
|
+
} else if (state.scope.align) {
|
|
208
|
+
state.scope.align = false;
|
|
209
|
+
}
|
|
210
|
+
state.scope = {
|
|
211
|
+
offset: offset,
|
|
212
|
+
type: type,
|
|
213
|
+
prev: state.scope,
|
|
214
|
+
align: align,
|
|
215
|
+
alignOffset: alignOffset
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function dedent(stream, state) {
|
|
220
|
+
if (!state.scope.prev) return;
|
|
221
|
+
if (state.scope.type === "coffee") {
|
|
222
|
+
var _indent = stream.indentation();
|
|
223
|
+
var matched = false;
|
|
224
|
+
for (var scope = state.scope; scope; scope = scope.prev) {
|
|
225
|
+
if (_indent === scope.offset) {
|
|
226
|
+
matched = true;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (!matched) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
while (state.scope.prev && state.scope.offset !== _indent) {
|
|
234
|
+
state.scope = state.scope.prev;
|
|
235
|
+
}
|
|
236
|
+
return false;
|
|
237
|
+
} else {
|
|
238
|
+
state.scope = state.scope.prev;
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function tokenLexer(stream, state) {
|
|
244
|
+
var style = state.tokenize(stream, state);
|
|
245
|
+
var current = stream.current();
|
|
246
|
+
|
|
247
|
+
// Handle scope changes.
|
|
248
|
+
if (current === "return") {
|
|
249
|
+
state.dedent = true;
|
|
250
|
+
}
|
|
251
|
+
if (((current === "->" || current === "=>") && stream.eol())
|
|
252
|
+
|| style === "indent") {
|
|
253
|
+
indent(stream, state);
|
|
254
|
+
}
|
|
255
|
+
var delimiter_index = "[({".indexOf(current);
|
|
256
|
+
if (delimiter_index !== -1) {
|
|
257
|
+
indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
|
258
|
+
}
|
|
259
|
+
if (indentKeywords.exec(current)){
|
|
260
|
+
indent(stream, state);
|
|
261
|
+
}
|
|
262
|
+
if (current == "then"){
|
|
263
|
+
dedent(stream, state);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if (style === "dedent") {
|
|
268
|
+
if (dedent(stream, state)) {
|
|
269
|
+
return ERRORCLASS;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
delimiter_index = "])}".indexOf(current);
|
|
273
|
+
if (delimiter_index !== -1) {
|
|
274
|
+
while (state.scope.type == "coffee" && state.scope.prev)
|
|
275
|
+
state.scope = state.scope.prev;
|
|
276
|
+
if (state.scope.type == current)
|
|
277
|
+
state.scope = state.scope.prev;
|
|
278
|
+
}
|
|
279
|
+
if (state.dedent && stream.eol()) {
|
|
280
|
+
if (state.scope.type == "coffee" && state.scope.prev)
|
|
281
|
+
state.scope = state.scope.prev;
|
|
282
|
+
state.dedent = false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return style == "indent" || style == "dedent" ? null : style;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const coffeeScript = {
|
|
289
|
+
name: "coffeescript",
|
|
290
|
+
startState: function() {
|
|
291
|
+
return {
|
|
292
|
+
tokenize: tokenBase,
|
|
293
|
+
scope: {offset: 0, type:"coffee", prev: null, align: false},
|
|
294
|
+
prop: false,
|
|
295
|
+
dedent: 0
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
token: function(stream, state) {
|
|
300
|
+
var fillAlign = state.scope.align === null && state.scope;
|
|
301
|
+
if (fillAlign && stream.sol()) fillAlign.align = false;
|
|
302
|
+
|
|
303
|
+
var style = tokenLexer(stream, state);
|
|
304
|
+
if (style && style != "comment") {
|
|
305
|
+
if (fillAlign) fillAlign.align = true;
|
|
306
|
+
state.prop = style == "punctuation" && stream.current() == ".";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return style;
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
indent: function(state, text) {
|
|
313
|
+
if (state.tokenize != tokenBase) return 0;
|
|
314
|
+
var scope = state.scope;
|
|
315
|
+
var closer = text && "])}".indexOf(text.charAt(0)) > -1;
|
|
316
|
+
if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev;
|
|
317
|
+
var closes = closer && scope.type === text.charAt(0);
|
|
318
|
+
if (scope.align)
|
|
319
|
+
return scope.alignOffset - (closes ? 1 : 0);
|
|
320
|
+
else
|
|
321
|
+
return (closes ? scope.prev : scope).offset;
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
languageData: {
|
|
325
|
+
commentTokens: {line: "#"}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export { coffeeScript };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var specialForm = /^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/;
|
|
2
|
+
var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/;
|
|
3
|
+
var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/;
|
|
4
|
+
var symbol = /[^\s'`,@()\[\]";]/;
|
|
5
|
+
var type;
|
|
6
|
+
|
|
7
|
+
function readSym(stream) {
|
|
8
|
+
var ch;
|
|
9
|
+
while (ch = stream.next()) {
|
|
10
|
+
if (ch == "\\") stream.next();
|
|
11
|
+
else if (!symbol.test(ch)) { stream.backUp(1); break; }
|
|
12
|
+
}
|
|
13
|
+
return stream.current();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function base(stream, state) {
|
|
17
|
+
if (stream.eatSpace()) {type = "ws"; return null;}
|
|
18
|
+
if (stream.match(numLiteral)) return "number";
|
|
19
|
+
var ch = stream.next();
|
|
20
|
+
if (ch == "\\") ch = stream.next();
|
|
21
|
+
|
|
22
|
+
if (ch == '"') return (state.tokenize = inString)(stream, state);
|
|
23
|
+
else if (ch == "(") { type = "open"; return "bracket"; }
|
|
24
|
+
else if (ch == ")") { type = "close"; return "bracket"; }
|
|
25
|
+
else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
|
|
26
|
+
else if (/['`,@]/.test(ch)) return null;
|
|
27
|
+
else if (ch == "|") {
|
|
28
|
+
if (stream.skipTo("|")) { stream.next(); return "variableName"; }
|
|
29
|
+
else { stream.skipToEnd(); return "error"; }
|
|
30
|
+
} else if (ch == "#") {
|
|
31
|
+
var ch = stream.next();
|
|
32
|
+
if (ch == "(") { type = "open"; return "bracket"; }
|
|
33
|
+
else if (/[+\-=\.']/.test(ch)) return null;
|
|
34
|
+
else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
|
|
35
|
+
else if (ch == "|") return (state.tokenize = inComment)(stream, state);
|
|
36
|
+
else if (ch == ":") { readSym(stream); return "meta"; }
|
|
37
|
+
else if (ch == "\\") { stream.next(); readSym(stream); return "string.special" }
|
|
38
|
+
else return "error";
|
|
39
|
+
} else {
|
|
40
|
+
var name = readSym(stream);
|
|
41
|
+
if (name == ".") return null;
|
|
42
|
+
type = "symbol";
|
|
43
|
+
if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom";
|
|
44
|
+
if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword";
|
|
45
|
+
if (name.charAt(0) == "&") return "variableName.special";
|
|
46
|
+
return "variableName";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function inString(stream, state) {
|
|
51
|
+
var escaped = false, next;
|
|
52
|
+
while (next = stream.next()) {
|
|
53
|
+
if (next == '"' && !escaped) { state.tokenize = base; break; }
|
|
54
|
+
escaped = !escaped && next == "\\";
|
|
55
|
+
}
|
|
56
|
+
return "string";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function inComment(stream, state) {
|
|
60
|
+
var next, last;
|
|
61
|
+
while (next = stream.next()) {
|
|
62
|
+
if (next == "#" && last == "|") { state.tokenize = base; break; }
|
|
63
|
+
last = next;
|
|
64
|
+
}
|
|
65
|
+
type = "ws";
|
|
66
|
+
return "comment";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const commonLisp = {
|
|
70
|
+
name: "commonlisp",
|
|
71
|
+
startState: function () {
|
|
72
|
+
return {ctx: {prev: null, start: 0, indentTo: 0}, lastType: null, tokenize: base};
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
token: function (stream, state) {
|
|
76
|
+
if (stream.sol() && typeof state.ctx.indentTo != "number")
|
|
77
|
+
state.ctx.indentTo = state.ctx.start + 1;
|
|
78
|
+
|
|
79
|
+
type = null;
|
|
80
|
+
var style = state.tokenize(stream, state);
|
|
81
|
+
if (type != "ws") {
|
|
82
|
+
if (state.ctx.indentTo == null) {
|
|
83
|
+
if (type == "symbol" && assumeBody.test(stream.current()))
|
|
84
|
+
state.ctx.indentTo = state.ctx.start + stream.indentUnit;
|
|
85
|
+
else
|
|
86
|
+
state.ctx.indentTo = "next";
|
|
87
|
+
} else if (state.ctx.indentTo == "next") {
|
|
88
|
+
state.ctx.indentTo = stream.column();
|
|
89
|
+
}
|
|
90
|
+
state.lastType = type;
|
|
91
|
+
}
|
|
92
|
+
if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
|
|
93
|
+
else if (type == "close") state.ctx = state.ctx.prev || state.ctx;
|
|
94
|
+
return style;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
indent: function (state) {
|
|
98
|
+
var i = state.ctx.indentTo;
|
|
99
|
+
return typeof i == "number" ? i : state.ctx.start + 1;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
languageData: {
|
|
103
|
+
commentTokens: {line: ";;", block: {open: "#|", close: "|#"}},
|
|
104
|
+
closeBrackets: {brackets: ["(", "[", "{", '"']}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { commonLisp };
|