@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,122 @@
|
|
|
1
|
+
var wordRegexp = function(words) {
|
|
2
|
+
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
var tokenBase = function(stream/*, state*/) {
|
|
6
|
+
curPunc = null;
|
|
7
|
+
var ch = stream.next();
|
|
8
|
+
if (ch ==='"') {
|
|
9
|
+
stream.match(/^.*?"/);
|
|
10
|
+
return "string";
|
|
11
|
+
}
|
|
12
|
+
if (ch === "'") {
|
|
13
|
+
stream.match(/^.*?'/);
|
|
14
|
+
return "string";
|
|
15
|
+
}
|
|
16
|
+
if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
|
17
|
+
curPunc = ch;
|
|
18
|
+
return "punctuation";
|
|
19
|
+
} else if (ch === "/" && stream.eat("/")) {
|
|
20
|
+
stream.skipToEnd();
|
|
21
|
+
return "comment";
|
|
22
|
+
} else if (operatorChars.test(ch)) {
|
|
23
|
+
stream.eatWhile(operatorChars);
|
|
24
|
+
return null;
|
|
25
|
+
} else {
|
|
26
|
+
stream.eatWhile(/[_\w\d]/);
|
|
27
|
+
if (stream.eat(":")) {
|
|
28
|
+
stream.eatWhile(/[\w\d_\-]/);
|
|
29
|
+
return "atom";
|
|
30
|
+
}
|
|
31
|
+
var word = stream.current();
|
|
32
|
+
if (funcs.test(word)) return "builtin";
|
|
33
|
+
if (preds.test(word)) return "def";
|
|
34
|
+
if (keywords.test(word) || systemKeywords.test(word)) return "keyword";
|
|
35
|
+
return "variable";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var pushContext = function(state, type, col) {
|
|
39
|
+
return state.context = {
|
|
40
|
+
prev: state.context,
|
|
41
|
+
indent: state.indent,
|
|
42
|
+
col: col,
|
|
43
|
+
type: type
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var popContext = function(state) {
|
|
47
|
+
state.indent = state.context.indent;
|
|
48
|
+
return state.context = state.context.prev;
|
|
49
|
+
};
|
|
50
|
+
var curPunc;
|
|
51
|
+
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
|
|
52
|
+
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
|
|
53
|
+
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
|
|
54
|
+
var systemKeywords = wordRegexp(["access", "active", "assign", "all", "alter", "as", "catalog", "change", "copy", "create", "constraint", "constraints", "current", "database", "databases", "dbms", "default", "deny", "drop", "element", "elements", "exists", "from", "grant", "graph", "graphs", "if", "index", "indexes", "label", "labels", "management", "match", "name", "names", "new", "node", "nodes", "not", "of", "on", "or", "password", "populated", "privileges", "property", "read", "relationship", "relationships", "remove", "replace", "required", "revoke", "role", "roles", "set", "show", "start", "status", "stop", "suspended", "to", "traverse", "type", "types", "user", "users", "with", "write"]);
|
|
55
|
+
var operatorChars = /[*+\-<>=&|~%^]/;
|
|
56
|
+
|
|
57
|
+
const cypher = {
|
|
58
|
+
name: "cypher",
|
|
59
|
+
startState: function() {
|
|
60
|
+
return {
|
|
61
|
+
tokenize: tokenBase,
|
|
62
|
+
context: null,
|
|
63
|
+
indent: 0,
|
|
64
|
+
col: 0
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
token: function(stream, state) {
|
|
68
|
+
if (stream.sol()) {
|
|
69
|
+
if (state.context && (state.context.align == null)) {
|
|
70
|
+
state.context.align = false;
|
|
71
|
+
}
|
|
72
|
+
state.indent = stream.indentation();
|
|
73
|
+
}
|
|
74
|
+
if (stream.eatSpace()) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
var style = state.tokenize(stream, state);
|
|
78
|
+
if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
|
|
79
|
+
state.context.align = true;
|
|
80
|
+
}
|
|
81
|
+
if (curPunc === "(") {
|
|
82
|
+
pushContext(state, ")", stream.column());
|
|
83
|
+
} else if (curPunc === "[") {
|
|
84
|
+
pushContext(state, "]", stream.column());
|
|
85
|
+
} else if (curPunc === "{") {
|
|
86
|
+
pushContext(state, "}", stream.column());
|
|
87
|
+
} else if (/[\]\}\)]/.test(curPunc)) {
|
|
88
|
+
while (state.context && state.context.type === "pattern") {
|
|
89
|
+
popContext(state);
|
|
90
|
+
}
|
|
91
|
+
if (state.context && curPunc === state.context.type) {
|
|
92
|
+
popContext(state);
|
|
93
|
+
}
|
|
94
|
+
} else if (curPunc === "." && state.context && state.context.type === "pattern") {
|
|
95
|
+
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") {
|
|
111
|
+
context = context.prev;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var closing = context && firstChar === context.type;
|
|
115
|
+
if (!context) return 0;
|
|
116
|
+
if (context.type === "keywords") return null
|
|
117
|
+
if (context.align) return context.col + (closing ? 0 : 1);
|
|
118
|
+
return context.indent + (closing ? 0 : cx.unit);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { cypher };
|
|
@@ -0,0 +1,205 @@
|
|
|
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 blockKeywordsStr = "body catch class do else enum for foreach foreach_reverse if in interface mixin " +
|
|
8
|
+
"out scope struct switch try union unittest version while with";
|
|
9
|
+
|
|
10
|
+
const parserConfig = {
|
|
11
|
+
keywords: words("abstract alias align asm assert auto break case cast cdouble cent cfloat const continue " +
|
|
12
|
+
"debug default delegate delete deprecated export extern final finally function goto immutable " +
|
|
13
|
+
"import inout invariant is lazy macro module new nothrow override package pragma private " +
|
|
14
|
+
"protected public pure ref return shared short static super synchronized template this " +
|
|
15
|
+
"throw typedef typeid typeof volatile __FILE__ __LINE__ __gshared __traits __vector __parameters " +
|
|
16
|
+
blockKeywordsStr),
|
|
17
|
+
blockKeywords: words(blockKeywordsStr),
|
|
18
|
+
builtin: words("bool byte char creal dchar double float idouble ifloat int ireal long real short ubyte " +
|
|
19
|
+
"ucent uint ulong ushort wchar wstring void size_t sizediff_t"),
|
|
20
|
+
atoms: words("exit failure success true false null"),
|
|
21
|
+
hooks: {
|
|
22
|
+
"@": function(stream, _state) {
|
|
23
|
+
stream.eatWhile(/[\w\$_]/);
|
|
24
|
+
return "meta";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var statementIndentUnit = parserConfig.statementIndentUnit,
|
|
30
|
+
keywords = parserConfig.keywords,
|
|
31
|
+
builtin = parserConfig.builtin,
|
|
32
|
+
blockKeywords = parserConfig.blockKeywords,
|
|
33
|
+
atoms = parserConfig.atoms,
|
|
34
|
+
hooks = parserConfig.hooks,
|
|
35
|
+
multiLineStrings = parserConfig.multiLineStrings;
|
|
36
|
+
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
|
37
|
+
|
|
38
|
+
var curPunc;
|
|
39
|
+
|
|
40
|
+
function tokenBase(stream, state) {
|
|
41
|
+
var ch = stream.next();
|
|
42
|
+
if (hooks[ch]) {
|
|
43
|
+
var result = hooks[ch](stream, state);
|
|
44
|
+
if (result !== false) return result;
|
|
45
|
+
}
|
|
46
|
+
if (ch == '"' || ch == "'" || ch == "`") {
|
|
47
|
+
state.tokenize = tokenString(ch);
|
|
48
|
+
return state.tokenize(stream, state);
|
|
49
|
+
}
|
|
50
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
|
51
|
+
curPunc = ch;
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (/\d/.test(ch)) {
|
|
55
|
+
stream.eatWhile(/[\w\.]/);
|
|
56
|
+
return "number";
|
|
57
|
+
}
|
|
58
|
+
if (ch == "/") {
|
|
59
|
+
if (stream.eat("+")) {
|
|
60
|
+
state.tokenize = tokenNestedComment;
|
|
61
|
+
return tokenNestedComment(stream, state);
|
|
62
|
+
}
|
|
63
|
+
if (stream.eat("*")) {
|
|
64
|
+
state.tokenize = tokenComment;
|
|
65
|
+
return tokenComment(stream, state);
|
|
66
|
+
}
|
|
67
|
+
if (stream.eat("/")) {
|
|
68
|
+
stream.skipToEnd();
|
|
69
|
+
return "comment";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (isOperatorChar.test(ch)) {
|
|
73
|
+
stream.eatWhile(isOperatorChar);
|
|
74
|
+
return "operator";
|
|
75
|
+
}
|
|
76
|
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
|
77
|
+
var cur = stream.current();
|
|
78
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
|
79
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
|
80
|
+
return "keyword";
|
|
81
|
+
}
|
|
82
|
+
if (builtin.propertyIsEnumerable(cur)) {
|
|
83
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
|
84
|
+
return "builtin";
|
|
85
|
+
}
|
|
86
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
|
87
|
+
return "variable";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function tokenString(quote) {
|
|
91
|
+
return function(stream, state) {
|
|
92
|
+
var escaped = false, next, end = false;
|
|
93
|
+
while ((next = stream.next()) != null) {
|
|
94
|
+
if (next == quote && !escaped) {end = true; break;}
|
|
95
|
+
escaped = !escaped && next == "\\";
|
|
96
|
+
}
|
|
97
|
+
if (end || !(escaped || multiLineStrings))
|
|
98
|
+
state.tokenize = null;
|
|
99
|
+
return "string";
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function tokenComment(stream, state) {
|
|
104
|
+
var maybeEnd = false, ch;
|
|
105
|
+
while (ch = stream.next()) {
|
|
106
|
+
if (ch == "/" && maybeEnd) {
|
|
107
|
+
state.tokenize = null;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
maybeEnd = (ch == "*");
|
|
111
|
+
}
|
|
112
|
+
return "comment";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function tokenNestedComment(stream, state) {
|
|
116
|
+
var maybeEnd = false, ch;
|
|
117
|
+
while (ch = stream.next()) {
|
|
118
|
+
if (ch == "/" && maybeEnd) {
|
|
119
|
+
state.tokenize = null;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
maybeEnd = (ch == "+");
|
|
123
|
+
}
|
|
124
|
+
return "comment";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function Context(indented, column, type, align, prev) {
|
|
128
|
+
this.indented = indented;
|
|
129
|
+
this.column = column;
|
|
130
|
+
this.type = type;
|
|
131
|
+
this.align = align;
|
|
132
|
+
this.prev = prev;
|
|
133
|
+
}
|
|
134
|
+
function pushContext(state, col, type) {
|
|
135
|
+
var indent = state.indented;
|
|
136
|
+
if (state.context && state.context.type == "statement")
|
|
137
|
+
indent = state.context.indented;
|
|
138
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
|
139
|
+
}
|
|
140
|
+
function popContext(state) {
|
|
141
|
+
var t = state.context.type;
|
|
142
|
+
if (t == ")" || t == "]" || t == "}")
|
|
143
|
+
state.indented = state.context.indented;
|
|
144
|
+
return state.context = state.context.prev;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Interface
|
|
148
|
+
|
|
149
|
+
const d = {
|
|
150
|
+
name: "d",
|
|
151
|
+
startState: function(indentUnit) {
|
|
152
|
+
return {
|
|
153
|
+
tokenize: null,
|
|
154
|
+
context: new Context(-indentUnit, 0, "top", false),
|
|
155
|
+
indented: 0,
|
|
156
|
+
startOfLine: true
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
token: function(stream, state) {
|
|
161
|
+
var ctx = state.context;
|
|
162
|
+
if (stream.sol()) {
|
|
163
|
+
if (ctx.align == null) ctx.align = false;
|
|
164
|
+
state.indented = stream.indentation();
|
|
165
|
+
state.startOfLine = true;
|
|
166
|
+
}
|
|
167
|
+
if (stream.eatSpace()) return null;
|
|
168
|
+
curPunc = null;
|
|
169
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
|
170
|
+
if (style == "comment" || style == "meta") return style;
|
|
171
|
+
if (ctx.align == null) ctx.align = true;
|
|
172
|
+
|
|
173
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
|
|
174
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
|
175
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
|
176
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
|
177
|
+
else if (curPunc == "}") {
|
|
178
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
|
179
|
+
if (ctx.type == "}") ctx = popContext(state);
|
|
180
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
|
181
|
+
}
|
|
182
|
+
else if (curPunc == ctx.type) popContext(state);
|
|
183
|
+
else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement"))
|
|
184
|
+
pushContext(state, stream.column(), "statement");
|
|
185
|
+
state.startOfLine = false;
|
|
186
|
+
return style;
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
indent: function(state, textAfter, cx) {
|
|
190
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return null;
|
|
191
|
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
|
192
|
+
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
|
193
|
+
var closing = firstChar == ctx.type;
|
|
194
|
+
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit || cx.unit);
|
|
195
|
+
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
|
196
|
+
else return ctx.indented + (closing ? 0 : cx.unit);
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
languageData: {
|
|
200
|
+
indentOnInput: /^\s*[{}]$/,
|
|
201
|
+
commentTokens: {line: "//", block: {open: "/*", close: "*/"}}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export { d };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var TOKEN_NAMES = {
|
|
2
|
+
'+': 'inserted',
|
|
3
|
+
'-': 'deleted',
|
|
4
|
+
'@': 'meta'
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const diff = {
|
|
8
|
+
name: "diff",
|
|
9
|
+
token: function(stream) {
|
|
10
|
+
var tw_pos = stream.string.search(/[\t ]+?$/);
|
|
11
|
+
|
|
12
|
+
if (!stream.sol() || tw_pos === 0) {
|
|
13
|
+
stream.skipToEnd();
|
|
14
|
+
return ("error " + (
|
|
15
|
+
TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
|
|
19
|
+
|
|
20
|
+
if (tw_pos === -1) {
|
|
21
|
+
stream.skipToEnd();
|
|
22
|
+
} else {
|
|
23
|
+
stream.pos = tw_pos;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return token_name;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { diff };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { s as simpleMode } from './simple-mode-DAYwfn8M.js';
|
|
2
|
+
|
|
3
|
+
var from = "from";
|
|
4
|
+
var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
|
|
5
|
+
|
|
6
|
+
var shells = ["run", "cmd", "entrypoint", "shell"];
|
|
7
|
+
var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join('|') + ")(\\s+\\[)", "i");
|
|
8
|
+
|
|
9
|
+
var expose = "expose";
|
|
10
|
+
var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
|
|
11
|
+
|
|
12
|
+
var others = [
|
|
13
|
+
"arg", "from", "maintainer", "label", "env",
|
|
14
|
+
"add", "copy", "volume", "user",
|
|
15
|
+
"workdir", "onbuild", "stopsignal", "healthcheck", "shell"
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// Collect all Dockerfile directives
|
|
19
|
+
var instructions = [from, expose].concat(shells).concat(others),
|
|
20
|
+
instructionRegex = "(" + instructions.join('|') + ")",
|
|
21
|
+
instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"),
|
|
22
|
+
instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
|
|
23
|
+
|
|
24
|
+
const dockerFile = simpleMode({
|
|
25
|
+
start: [
|
|
26
|
+
// Block comment: This is a line starting with a comment
|
|
27
|
+
{
|
|
28
|
+
regex: /^\s*#.*$/,
|
|
29
|
+
sol: true,
|
|
30
|
+
token: "comment"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
regex: fromRegex,
|
|
34
|
+
token: [null, "keyword"],
|
|
35
|
+
sol: true,
|
|
36
|
+
next: "from"
|
|
37
|
+
},
|
|
38
|
+
// Highlight an instruction without any arguments (for convenience)
|
|
39
|
+
{
|
|
40
|
+
regex: instructionOnlyLine,
|
|
41
|
+
token: [null, "keyword", null, "error"],
|
|
42
|
+
sol: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
regex: shellsAsArrayRegex,
|
|
46
|
+
token: [null, "keyword", null],
|
|
47
|
+
sol: true,
|
|
48
|
+
next: "array"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
regex: exposeRegex,
|
|
52
|
+
token: [null, "keyword", null],
|
|
53
|
+
sol: true,
|
|
54
|
+
next: "expose"
|
|
55
|
+
},
|
|
56
|
+
// Highlight an instruction followed by arguments
|
|
57
|
+
{
|
|
58
|
+
regex: instructionWithArguments,
|
|
59
|
+
token: [null, "keyword", null],
|
|
60
|
+
sol: true,
|
|
61
|
+
next: "arguments"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
regex: /./,
|
|
65
|
+
token: null
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
from: [
|
|
69
|
+
{
|
|
70
|
+
regex: /\s*$/,
|
|
71
|
+
token: null,
|
|
72
|
+
next: "start"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// Line comment without instruction arguments is an error
|
|
76
|
+
regex: /(\s*)(#.*)$/,
|
|
77
|
+
token: [null, "error"],
|
|
78
|
+
next: "start"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
regex: /(\s*\S+\s+)(as)/i,
|
|
82
|
+
token: [null, "keyword"],
|
|
83
|
+
next: "start"
|
|
84
|
+
},
|
|
85
|
+
// Fail safe return to start
|
|
86
|
+
{
|
|
87
|
+
token: null,
|
|
88
|
+
next: "start"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
single: [
|
|
92
|
+
{
|
|
93
|
+
regex: /(?:[^\\']|\\.)/,
|
|
94
|
+
token: "string"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
regex: /'/,
|
|
98
|
+
token: "string",
|
|
99
|
+
pop: true
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
double: [
|
|
103
|
+
{
|
|
104
|
+
regex: /(?:[^\\"]|\\.)/,
|
|
105
|
+
token: "string"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
regex: /"/,
|
|
109
|
+
token: "string",
|
|
110
|
+
pop: true
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
array: [
|
|
114
|
+
{
|
|
115
|
+
regex: /\]/,
|
|
116
|
+
token: null,
|
|
117
|
+
next: "start"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
regex: /"(?:[^\\"]|\\.)*"?/,
|
|
121
|
+
token: "string"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
expose: [
|
|
125
|
+
{
|
|
126
|
+
regex: /\d+$/,
|
|
127
|
+
token: "number",
|
|
128
|
+
next: "start"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
regex: /[^\d]+$/,
|
|
132
|
+
token: null,
|
|
133
|
+
next: "start"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
regex: /\d+/,
|
|
137
|
+
token: "number"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
regex: /[^\d]+/,
|
|
141
|
+
token: null
|
|
142
|
+
},
|
|
143
|
+
// Fail safe return to start
|
|
144
|
+
{
|
|
145
|
+
token: null,
|
|
146
|
+
next: "start"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
arguments: [
|
|
150
|
+
{
|
|
151
|
+
regex: /^\s*#.*$/,
|
|
152
|
+
sol: true,
|
|
153
|
+
token: "comment"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
regex: /"(?:[^\\"]|\\.)*"?$/,
|
|
157
|
+
token: "string",
|
|
158
|
+
next: "start"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
regex: /"/,
|
|
162
|
+
token: "string",
|
|
163
|
+
push: "double"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
regex: /'(?:[^\\']|\\.)*'?$/,
|
|
167
|
+
token: "string",
|
|
168
|
+
next: "start"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
regex: /'/,
|
|
172
|
+
token: "string",
|
|
173
|
+
push: "single"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
regex: /[^#"']+[\\`]$/,
|
|
177
|
+
token: null
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
regex: /[^#"']+$/,
|
|
181
|
+
token: null,
|
|
182
|
+
next: "start"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
regex: /[^#"']+/,
|
|
186
|
+
token: null
|
|
187
|
+
},
|
|
188
|
+
// Fail safe return to start
|
|
189
|
+
{
|
|
190
|
+
token: null,
|
|
191
|
+
next: "start"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
languageData: {
|
|
195
|
+
commentTokens: {line: "#"}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
export { dockerFile };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var type;
|
|
2
|
+
function ret(style, tp) {type = tp; return style;}
|
|
3
|
+
|
|
4
|
+
function tokenBase(stream, state) {
|
|
5
|
+
var ch = stream.next();
|
|
6
|
+
|
|
7
|
+
if (ch == "<" && stream.eat("!") ) {
|
|
8
|
+
if (stream.eatWhile(/[\-]/)) {
|
|
9
|
+
state.tokenize = tokenSGMLComment;
|
|
10
|
+
return tokenSGMLComment(stream, state);
|
|
11
|
+
} else if (stream.eatWhile(/[\w]/)) return ret("keyword", "doindent");
|
|
12
|
+
} else if (ch == "<" && stream.eat("?")) { //xml declaration
|
|
13
|
+
state.tokenize = inBlock("meta", "?>");
|
|
14
|
+
return ret("meta", ch);
|
|
15
|
+
} else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag");
|
|
16
|
+
else if (ch == "|") return ret("keyword", "separator");
|
|
17
|
+
else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);//if(ch === ">") return ret(null, "endtag"); else
|
|
18
|
+
else if (ch.match(/[\[\]]/)) return ret("rule", ch);
|
|
19
|
+
else if (ch == "\"" || ch == "'") {
|
|
20
|
+
state.tokenize = tokenString(ch);
|
|
21
|
+
return state.tokenize(stream, state);
|
|
22
|
+
} else if (stream.eatWhile(/[a-zA-Z\?\+\d]/)) {
|
|
23
|
+
var sc = stream.current();
|
|
24
|
+
if( sc.substr(sc.length-1,sc.length).match(/\?|\+/) !== null )stream.backUp(1);
|
|
25
|
+
return ret("tag", "tag");
|
|
26
|
+
} else if (ch == "%" || ch == "*" ) return ret("number", "number");
|
|
27
|
+
else {
|
|
28
|
+
stream.eatWhile(/[\w\\\-_%.{,]/);
|
|
29
|
+
return ret(null, null);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function tokenSGMLComment(stream, state) {
|
|
34
|
+
var dashes = 0, ch;
|
|
35
|
+
while ((ch = stream.next()) != null) {
|
|
36
|
+
if (dashes >= 2 && ch == ">") {
|
|
37
|
+
state.tokenize = tokenBase;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
dashes = (ch == "-") ? dashes + 1 : 0;
|
|
41
|
+
}
|
|
42
|
+
return ret("comment", "comment");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function tokenString(quote) {
|
|
46
|
+
return function(stream, state) {
|
|
47
|
+
var escaped = false, ch;
|
|
48
|
+
while ((ch = stream.next()) != null) {
|
|
49
|
+
if (ch == quote && !escaped) {
|
|
50
|
+
state.tokenize = tokenBase;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
escaped = !escaped && ch == "\\";
|
|
54
|
+
}
|
|
55
|
+
return ret("string", "tag");
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function inBlock(style, terminator) {
|
|
60
|
+
return function(stream, state) {
|
|
61
|
+
while (!stream.eol()) {
|
|
62
|
+
if (stream.match(terminator)) {
|
|
63
|
+
state.tokenize = tokenBase;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
stream.next();
|
|
67
|
+
}
|
|
68
|
+
return style;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const dtd = {
|
|
73
|
+
name: "dtd",
|
|
74
|
+
startState: function() {
|
|
75
|
+
return {tokenize: tokenBase,
|
|
76
|
+
baseIndent: 0,
|
|
77
|
+
stack: []};
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
token: function(stream, state) {
|
|
81
|
+
if (stream.eatSpace()) return null;
|
|
82
|
+
var style = state.tokenize(stream, state);
|
|
83
|
+
|
|
84
|
+
var context = state.stack[state.stack.length-1];
|
|
85
|
+
if (stream.current() == "[" || type === "doindent" || type == "[") state.stack.push("rule");
|
|
86
|
+
else if (type === "endtag") state.stack[state.stack.length-1] = "endtag";
|
|
87
|
+
else if (stream.current() == "]" || type == "]" || (type == ">" && context == "rule")) state.stack.pop();
|
|
88
|
+
else if (type == "[") state.stack.push("[");
|
|
89
|
+
return style;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
indent: function(state, textAfter, cx) {
|
|
93
|
+
var n = state.stack.length;
|
|
94
|
+
|
|
95
|
+
if( textAfter.charAt(0) === ']' )n--;
|
|
96
|
+
else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
|
|
97
|
+
if(textAfter.substr(0,1) === "<") ;
|
|
98
|
+
else if( type == "doindent" && textAfter.length > 1 ) ;
|
|
99
|
+
else if( type == "doindent")n--;
|
|
100
|
+
else if( type == ">" && textAfter.length > 1) ;
|
|
101
|
+
else if( type == "tag" && textAfter !== ">") ;
|
|
102
|
+
else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
|
|
103
|
+
else if( type == "tag")n++;
|
|
104
|
+
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
|
|
105
|
+
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") ;
|
|
106
|
+
else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
|
|
107
|
+
else if( textAfter === ">") ;
|
|
108
|
+
else n=n-1;
|
|
109
|
+
//over rule them all
|
|
110
|
+
if(type == null || type == "]")n--;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return state.baseIndent + n * cx.unit;
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
languageData: {
|
|
117
|
+
indentOnInput: /^\s*[\]>]$/
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export { dtd };
|