@seljs/cel-lezer 1.0.0 → 1.0.1-beta.9

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.
@@ -0,0 +1,134 @@
1
+ let _codemirror_language = require("@codemirror/language");
2
+ let _lezer_highlight = require("@lezer/highlight");
3
+ //#region src/highlight.ts
4
+ const celHighlighting = (0, _lezer_highlight.styleTags)({
5
+ Identifier: _lezer_highlight.tags.variableName,
6
+ Number: _lezer_highlight.tags.number,
7
+ String: _lezer_highlight.tags.string,
8
+ BooleanLiteral: _lezer_highlight.tags.bool,
9
+ NullLiteral: _lezer_highlight.tags.null,
10
+ LogicOp: _lezer_highlight.tags.logicOperator,
11
+ CompareOp: _lezer_highlight.tags.compareOperator,
12
+ AddOp: _lezer_highlight.tags.arithmeticOperator,
13
+ MulOp: _lezer_highlight.tags.arithmeticOperator,
14
+ in: _lezer_highlight.tags.operatorKeyword,
15
+ LineComment: _lezer_highlight.tags.lineComment,
16
+ "( )": _lezer_highlight.tags.paren,
17
+ "[ ]": _lezer_highlight.tags.squareBracket,
18
+ "{ }": _lezer_highlight.tags.brace,
19
+ ", ;": _lezer_highlight.tags.separator
20
+ });
21
+ const celLightHighlightStyle = _codemirror_language.HighlightStyle.define([
22
+ {
23
+ tag: _lezer_highlight.tags.number,
24
+ color: "#2e7d32"
25
+ },
26
+ {
27
+ tag: _lezer_highlight.tags.string,
28
+ color: "#a65417"
29
+ },
30
+ {
31
+ tag: _lezer_highlight.tags.bool,
32
+ color: "#0d47a1"
33
+ },
34
+ {
35
+ tag: _lezer_highlight.tags.null,
36
+ color: "#0d47a1"
37
+ },
38
+ {
39
+ tag: _lezer_highlight.tags.logicOperator,
40
+ color: "#7c4dff"
41
+ },
42
+ {
43
+ tag: _lezer_highlight.tags.compareOperator,
44
+ color: "#7c4dff"
45
+ },
46
+ {
47
+ tag: _lezer_highlight.tags.arithmeticOperator,
48
+ color: "#7c4dff"
49
+ },
50
+ {
51
+ tag: _lezer_highlight.tags.operatorKeyword,
52
+ color: "#7c4dff"
53
+ },
54
+ {
55
+ tag: _lezer_highlight.tags.lineComment,
56
+ color: "#9e9e9e"
57
+ },
58
+ {
59
+ tag: _lezer_highlight.tags.paren,
60
+ color: "#795548"
61
+ },
62
+ {
63
+ tag: _lezer_highlight.tags.squareBracket,
64
+ color: "#795548"
65
+ },
66
+ {
67
+ tag: _lezer_highlight.tags.brace,
68
+ color: "#795548"
69
+ },
70
+ {
71
+ tag: _lezer_highlight.tags.separator,
72
+ color: "#795548"
73
+ }
74
+ ]);
75
+ const celDarkHighlightStyle = _codemirror_language.HighlightStyle.define([
76
+ {
77
+ tag: _lezer_highlight.tags.number,
78
+ color: "#b5cea8"
79
+ },
80
+ {
81
+ tag: _lezer_highlight.tags.string,
82
+ color: "#ce9178"
83
+ },
84
+ {
85
+ tag: _lezer_highlight.tags.bool,
86
+ color: "#569cd6"
87
+ },
88
+ {
89
+ tag: _lezer_highlight.tags.null,
90
+ color: "#569cd6"
91
+ },
92
+ {
93
+ tag: _lezer_highlight.tags.logicOperator,
94
+ color: "#c586c0"
95
+ },
96
+ {
97
+ tag: _lezer_highlight.tags.compareOperator,
98
+ color: "#c586c0"
99
+ },
100
+ {
101
+ tag: _lezer_highlight.tags.arithmeticOperator,
102
+ color: "#c586c0"
103
+ },
104
+ {
105
+ tag: _lezer_highlight.tags.operatorKeyword,
106
+ color: "#c586c0"
107
+ },
108
+ {
109
+ tag: _lezer_highlight.tags.lineComment,
110
+ color: "#6a9955"
111
+ },
112
+ {
113
+ tag: _lezer_highlight.tags.paren,
114
+ color: "#808080"
115
+ },
116
+ {
117
+ tag: _lezer_highlight.tags.squareBracket,
118
+ color: "#808080"
119
+ },
120
+ {
121
+ tag: _lezer_highlight.tags.brace,
122
+ color: "#808080"
123
+ },
124
+ {
125
+ tag: _lezer_highlight.tags.separator,
126
+ color: "#808080"
127
+ }
128
+ ]);
129
+ const celSyntaxHighlighting = (dark = false) => (0, _codemirror_language.syntaxHighlighting)(dark ? celDarkHighlightStyle : celLightHighlightStyle);
130
+ //#endregion
131
+ exports.celDarkHighlightStyle = celDarkHighlightStyle;
132
+ exports.celHighlighting = celHighlighting;
133
+ exports.celLightHighlightStyle = celLightHighlightStyle;
134
+ exports.celSyntaxHighlighting = celSyntaxHighlighting;
@@ -0,0 +1,11 @@
1
+ import { HighlightStyle } from "@codemirror/language";
2
+ import * as _lezer_common0 from "@lezer/common";
3
+ import * as _codemirror_state0 from "@codemirror/state";
4
+
5
+ //#region src/highlight.d.ts
6
+ declare const celHighlighting: _lezer_common0.NodePropSource;
7
+ declare const celLightHighlightStyle: HighlightStyle;
8
+ declare const celDarkHighlightStyle: HighlightStyle;
9
+ declare const celSyntaxHighlighting: (dark?: boolean) => _codemirror_state0.Extension;
10
+ //#endregion
11
+ export { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting };
@@ -0,0 +1,11 @@
1
+ import { HighlightStyle } from "@codemirror/language";
2
+ import * as _lezer_common0 from "@lezer/common";
3
+ import * as _codemirror_state0 from "@codemirror/state";
4
+
5
+ //#region src/highlight.d.ts
6
+ declare const celHighlighting: _lezer_common0.NodePropSource;
7
+ declare const celLightHighlightStyle: HighlightStyle;
8
+ declare const celDarkHighlightStyle: HighlightStyle;
9
+ declare const celSyntaxHighlighting: (dark?: boolean) => _codemirror_state0.Extension;
10
+ //#endregion
11
+ export { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting };
@@ -0,0 +1,131 @@
1
+ import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
2
+ import { styleTags, tags } from "@lezer/highlight";
3
+ //#region src/highlight.ts
4
+ const celHighlighting = styleTags({
5
+ Identifier: tags.variableName,
6
+ Number: tags.number,
7
+ String: tags.string,
8
+ BooleanLiteral: tags.bool,
9
+ NullLiteral: tags.null,
10
+ LogicOp: tags.logicOperator,
11
+ CompareOp: tags.compareOperator,
12
+ AddOp: tags.arithmeticOperator,
13
+ MulOp: tags.arithmeticOperator,
14
+ in: tags.operatorKeyword,
15
+ LineComment: tags.lineComment,
16
+ "( )": tags.paren,
17
+ "[ ]": tags.squareBracket,
18
+ "{ }": tags.brace,
19
+ ", ;": tags.separator
20
+ });
21
+ const celLightHighlightStyle = HighlightStyle.define([
22
+ {
23
+ tag: tags.number,
24
+ color: "#2e7d32"
25
+ },
26
+ {
27
+ tag: tags.string,
28
+ color: "#a65417"
29
+ },
30
+ {
31
+ tag: tags.bool,
32
+ color: "#0d47a1"
33
+ },
34
+ {
35
+ tag: tags.null,
36
+ color: "#0d47a1"
37
+ },
38
+ {
39
+ tag: tags.logicOperator,
40
+ color: "#7c4dff"
41
+ },
42
+ {
43
+ tag: tags.compareOperator,
44
+ color: "#7c4dff"
45
+ },
46
+ {
47
+ tag: tags.arithmeticOperator,
48
+ color: "#7c4dff"
49
+ },
50
+ {
51
+ tag: tags.operatorKeyword,
52
+ color: "#7c4dff"
53
+ },
54
+ {
55
+ tag: tags.lineComment,
56
+ color: "#9e9e9e"
57
+ },
58
+ {
59
+ tag: tags.paren,
60
+ color: "#795548"
61
+ },
62
+ {
63
+ tag: tags.squareBracket,
64
+ color: "#795548"
65
+ },
66
+ {
67
+ tag: tags.brace,
68
+ color: "#795548"
69
+ },
70
+ {
71
+ tag: tags.separator,
72
+ color: "#795548"
73
+ }
74
+ ]);
75
+ const celDarkHighlightStyle = HighlightStyle.define([
76
+ {
77
+ tag: tags.number,
78
+ color: "#b5cea8"
79
+ },
80
+ {
81
+ tag: tags.string,
82
+ color: "#ce9178"
83
+ },
84
+ {
85
+ tag: tags.bool,
86
+ color: "#569cd6"
87
+ },
88
+ {
89
+ tag: tags.null,
90
+ color: "#569cd6"
91
+ },
92
+ {
93
+ tag: tags.logicOperator,
94
+ color: "#c586c0"
95
+ },
96
+ {
97
+ tag: tags.compareOperator,
98
+ color: "#c586c0"
99
+ },
100
+ {
101
+ tag: tags.arithmeticOperator,
102
+ color: "#c586c0"
103
+ },
104
+ {
105
+ tag: tags.operatorKeyword,
106
+ color: "#c586c0"
107
+ },
108
+ {
109
+ tag: tags.lineComment,
110
+ color: "#6a9955"
111
+ },
112
+ {
113
+ tag: tags.paren,
114
+ color: "#808080"
115
+ },
116
+ {
117
+ tag: tags.squareBracket,
118
+ color: "#808080"
119
+ },
120
+ {
121
+ tag: tags.brace,
122
+ color: "#808080"
123
+ },
124
+ {
125
+ tag: tags.separator,
126
+ color: "#808080"
127
+ }
128
+ ]);
129
+ const celSyntaxHighlighting = (dark = false) => syntaxHighlighting(dark ? celDarkHighlightStyle : celLightHighlightStyle);
130
+ //#endregion
131
+ export { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting };
package/dist/index.cjs ADDED
@@ -0,0 +1,27 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_highlight = require("./highlight.cjs");
3
+ const require_parser = require("./parser.cjs");
4
+ let _codemirror_language = require("@codemirror/language");
5
+ //#region src/index.ts
6
+ const celLanguage = _codemirror_language.LRLanguage.define({
7
+ name: "cel",
8
+ parser: require_parser.parser.configure({ props: [require_highlight.celHighlighting] }),
9
+ languageData: {
10
+ commentTokens: { line: "//" },
11
+ closeBrackets: { brackets: [
12
+ "(",
13
+ "[",
14
+ "{",
15
+ "\"",
16
+ "'"
17
+ ] }
18
+ }
19
+ });
20
+ const celLanguageSupport = (dark = false) => new _codemirror_language.LanguageSupport(celLanguage, [require_highlight.celSyntaxHighlighting(dark)]);
21
+ //#endregion
22
+ exports.celDarkHighlightStyle = require_highlight.celDarkHighlightStyle;
23
+ exports.celHighlighting = require_highlight.celHighlighting;
24
+ exports.celLanguage = celLanguage;
25
+ exports.celLanguageSupport = celLanguageSupport;
26
+ exports.celLightHighlightStyle = require_highlight.celLightHighlightStyle;
27
+ exports.celSyntaxHighlighting = require_highlight.celSyntaxHighlighting;
@@ -0,0 +1,8 @@
1
+ import { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting } from "./highlight.cjs";
2
+ import { LRLanguage, LanguageSupport } from "@codemirror/language";
3
+
4
+ //#region src/index.d.ts
5
+ declare const celLanguage: LRLanguage;
6
+ declare const celLanguageSupport: (dark?: boolean) => LanguageSupport;
7
+ //#endregion
8
+ export { celDarkHighlightStyle, celHighlighting, celLanguage, celLanguageSupport, celLightHighlightStyle, celSyntaxHighlighting };
@@ -0,0 +1,8 @@
1
+ import { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting } from "./highlight.mjs";
2
+ import { LRLanguage, LanguageSupport } from "@codemirror/language";
3
+
4
+ //#region src/index.d.ts
5
+ declare const celLanguage: LRLanguage;
6
+ declare const celLanguageSupport: (dark?: boolean) => LanguageSupport;
7
+ //#endregion
8
+ export { celDarkHighlightStyle, celHighlighting, celLanguage, celLanguageSupport, celLightHighlightStyle, celSyntaxHighlighting };
package/dist/index.mjs ADDED
@@ -0,0 +1,21 @@
1
+ import { celDarkHighlightStyle, celHighlighting, celLightHighlightStyle, celSyntaxHighlighting } from "./highlight.mjs";
2
+ import { parser } from "./parser.mjs";
3
+ import { LRLanguage, LanguageSupport } from "@codemirror/language";
4
+ //#region src/index.ts
5
+ const celLanguage = LRLanguage.define({
6
+ name: "cel",
7
+ parser: parser.configure({ props: [celHighlighting] }),
8
+ languageData: {
9
+ commentTokens: { line: "//" },
10
+ closeBrackets: { brackets: [
11
+ "(",
12
+ "[",
13
+ "{",
14
+ "\"",
15
+ "'"
16
+ ] }
17
+ }
18
+ });
19
+ const celLanguageSupport = (dark = false) => new LanguageSupport(celLanguage, [celSyntaxHighlighting(dark)]);
20
+ //#endregion
21
+ export { celDarkHighlightStyle, celHighlighting, celLanguage, celLanguageSupport, celLightHighlightStyle, celSyntaxHighlighting };
@@ -0,0 +1,26 @@
1
+ let _lezer_lr = require("@lezer/lr");
2
+ //#region src/parser.ts
3
+ const spec_Identifier = {
4
+ __proto__: null,
5
+ in: 20
6
+ };
7
+ const parser = _lezer_lr.LRParser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",
11
+ goto: "$i!RPPP!S!SP!SP!SPP!SP!SP!S!S!S!S!h!S!SPPPP!S!S!x#OPPP#UPPPPPPP$YPPPPP$`$cuUOQRSTVWXYZ[]^_uxy}m`Pegjklmnopq!Q!S!VQveR!RvQzhR!UzQPOQcQQdRSeS_SgTyQjVQkWQlXQmYQnZQo[Qp]Qq^Q!QuQ!SxR!V}QfSRr_RiTQhTR!Ty",
12
+ nodeNames: "⚠ LineComment Expression ConditionalExpression BinaryExpression LogicOp BinaryExpression CompareOp BinaryExpression Identifier in BinaryExpression AddOp BinaryExpression MulOp BinaryExpression BinaryExpression IndexExpression CallExpression ArgList OptionalExpression MemberExpression Number String BooleanLiteral NullLiteral ListLiteral MapLiteral",
13
+ maxTerm: 49,
14
+ skippedNodes: [0, 1],
15
+ repeatNodeCount: 2,
16
+ tokenData: "3y~R|X^#{pq#{qr$prs$}uv&kvw&pwx&{xy(dyz(iz{&k{|(n|}(s}!O(x!O!P)P!P!Q)^!Q!R)}!R![+}![!]-W!^!_-]!_!`-e!`!a-]!a!b-k!c!}-p!}#O.R#P#Q.W#R#S-p#T#Y-p#Y#Z.]#Z#b-p#b#c0m#c#h-p#h#i2i#i#o-p#o#p3i#p#q3n#q#r3t#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{~$QYp~X^#{pq#{#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{R$uPtP!_!`$xQ$}OVQ~%QVOr$}rs%gs#O$}#O#P%l#P;'S$};'S;=`&e<%lO$}~%lOg~~%oRO;'S$};'S;=`%x;=`O$}~%{WOr$}rs%gs#O$}#O#P%l#P;'S$};'S;=`&e;=`<%l$}<%lO$}~&hP;=`<%l$}~&pO^~~&sPvw&v~&{OT~~'OVOw&{wx%gx#O&{#O#P'e#P;'S&{;'S;=`(^<%lO&{~'hRO;'S&{;'S;=`'q;=`O&{~'tWOw&{wx%gx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+ term: 9,
21
+ get: (value) => spec_Identifier[value] || -1
22
+ }],
23
+ tokenPrec: 442
24
+ });
25
+ //#endregion
26
+ exports.parser = parser;
@@ -0,0 +1,26 @@
1
+ import { LRParser } from "@lezer/lr";
2
+ //#region src/parser.ts
3
+ const spec_Identifier = {
4
+ __proto__: null,
5
+ in: 20
6
+ };
7
+ const parser = LRParser.deserialize({
8
+ version: 14,
9
+ states: "(QQYQPOOQzQQOOOYQPO'#CkOYQPO'#ClO!lQPO'#CvO!sQPO'#CwOOQO'#C}'#C}OYQPO'#C}OYQPO,58yOYQPO,58zOYQPO,58|OYQPO,59OOYQPO,59ROYQPO,59TOYQPO,59XO!zQPO'#CoOOQO,59Y,59YO#RQPO,59[O#WQPO,59]OOQO,59V,59VOOQO,59W,59WO#]QQO'#DVO#jQPO,59bO#oQQO'#D^O#vQPO'#D]O$OQPO,59cO$TQQO,59iO$[QQO1G.eO$}QQO1G.fO%kQQO1G.hO&_QQO1G.jO'RQQO1G.mO'xQQO1G.oO(|QQO1G.sO)TQPO,59ZOOQO1G.v1G.vOOQO1G.w1G.wOYQPO'#CxO)YQPO,59qOOQO1G.|1G.|OYQPO,59xOYQPO'#CyO)eQPO,59wOOQO1G.}1G.}OOQO1G/T1G/TOYQPO7+$POOQO7+$_7+$_OOQO1G.u1G.uO)mQQO,59dOOQO-E6v-E6vO)zQQO1G/dOOQO,59e,59eOOQO-E6w-E6wO*UQQO<<Gk",
10
+ stateData: "*u~OpOSPOS~OXUOfUOgUOhUOiUOtQOuROvSOxVO!OTO~OTXOVYOYZO[[O^]OrWOv^Ox_O|aO}bO~OwyP~PYO!R!PP~PYO{yP~PYOXsO~OXtO~OzuOwyX{yX~PzOwwO~OsxO~PzOzyO!R!PX~O!R{O~O{|O~PzOs}O~PzOVYOYZO[[O^]Ov^Ox_O|aO}bO~OTSinSirSiwSizSisSi{Si!RSi~P$cOTUiVUiYUinUirUiwUizUisUi{Ui!RUi~P$iOTWiVWiYWinWirWiwWizWisWi{Wi!RWi~P$iOTZiVZiYZi[ZinZirZiwZizZisZi{Zi!RZi~P$lOv^Ox_O|aO}bOT]iV]iY]i[]i^]in]ir]iw]iz]is]i{]i!R]i~Ow!OO~PzO{!PO~OzuOwya{ya~OzyO!R!Pa~Owlazla{la~PzOz!Qi!R!Qi~PzOnRywRyzRysRy{Ry!RRy~PzOP|i^hXf}~",
11
+ goto: "$i!RPPP!S!SP!SP!SPP!SP!SP!S!S!S!S!h!S!SPPPP!S!S!x#OPPP#UPPPPPPP$YPPPPP$`$cuUOQRSTVWXYZ[]^_uxy}m`Pegjklmnopq!Q!S!VQveR!RvQzhR!UzQPOQcQQdRSeS_SgTyQjVQkWQlXQmYQnZQo[Qp]Qq^Q!QuQ!SxR!V}QfSRr_RiTQhTR!Ty",
12
+ nodeNames: "⚠ LineComment Expression ConditionalExpression BinaryExpression LogicOp BinaryExpression CompareOp BinaryExpression Identifier in BinaryExpression AddOp BinaryExpression MulOp BinaryExpression BinaryExpression IndexExpression CallExpression ArgList OptionalExpression MemberExpression Number String BooleanLiteral NullLiteral ListLiteral MapLiteral",
13
+ maxTerm: 49,
14
+ skippedNodes: [0, 1],
15
+ repeatNodeCount: 2,
16
+ tokenData: "3y~R|X^#{pq#{qr$prs$}uv&kvw&pwx&{xy(dyz(iz{&k{|(n|}(s}!O(x!O!P)P!P!Q)^!Q!R)}!R![+}![!]-W!^!_-]!_!`-e!`!a-]!a!b-k!c!}-p!}#O.R#P#Q.W#R#S-p#T#Y-p#Y#Z.]#Z#b-p#b#c0m#c#h-p#h#i2i#i#o-p#o#p3i#p#q3n#q#r3t#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{~$QYp~X^#{pq#{#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$KV$KW#{&FU&FV#{R$uPtP!_!`$xQ$}OVQ~%QVOr$}rs%gs#O$}#O#P%l#P;'S$};'S;=`&e<%lO$}~%l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~X~!Q![-p!c!}-p#R#S-p#T#o-p~2nUX~!Q![-p!c!}-p#R#S-p#T#f-p#f#g3Q#g#o-p~3VUX~!Q![-p!c!}-p#R#S-p#T#i-p#i#j/q#j#o-p~3nO!O~~3qP#p#q&v~3yO!R~",
17
+ tokenizers: [0, 1],
18
+ topRules: { "Expression": [0, 2] },
19
+ specialized: [{
20
+ term: 9,
21
+ get: (value) => spec_Identifier[value] || -1
22
+ }],
23
+ tokenPrec: 442
24
+ });
25
+ //#endregion
26
+ export { parser };
package/package.json CHANGED
@@ -1,30 +1,36 @@
1
1
  {
2
2
  "name": "@seljs/cel-lezer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta.9",
4
+ "repository": {
5
+ "url": "https://github.com/abinnovision/seljs"
6
+ },
4
7
  "license": "Apache-2.0",
5
8
  "author": {
6
9
  "name": "abi group GmbH",
7
10
  "email": "info@abigroup.io",
8
11
  "url": "https://abigroup.io/"
9
12
  },
10
- "repository": {
11
- "url": "https://github.com/abinnovision/seljs"
12
- },
13
13
  "type": "module",
14
14
  "exports": {
15
15
  ".": {
16
- "import": "./dist/index.js",
17
- "types": "./dist/index.d.ts"
16
+ "import": {
17
+ "types": "./dist/index.d.mts",
18
+ "default": "./dist/index.mjs"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.cjs"
23
+ }
18
24
  }
19
25
  },
20
- "main": "./dist/index.js",
21
- "types": "./dist/index.d.ts",
26
+ "main": "./dist/index.cjs",
27
+ "types": "./dist/index.d.cts",
22
28
  "files": [
23
29
  "dist",
24
30
  "LICENSE.md"
25
31
  ],
26
32
  "scripts": {
27
- "build": "tsc -p tsconfig.build.json",
33
+ "build": "tsdown",
28
34
  "format:check": "prettier --check '{{src,test}/**/*,*}.{{t,j}s{,x},json{,5},md,y{,a}ml}'",
29
35
  "format:fix": "prettier --write '{{src,test}/**/*,*}.{{t,j}s{,x},json{,5},md,y{,a}ml}'",
30
36
  "generate": "lezer-generator --typeScript -o src/parser.ts src/cel.grammar",
@@ -43,17 +49,18 @@
43
49
  ]
44
50
  },
45
51
  "dependencies": {
46
- "@codemirror/language": "^6.0.0",
47
- "@lezer/highlight": "^1.0.0",
48
- "@lezer/lr": "^1.0.0"
52
+ "@codemirror/language": "^6.12.2",
53
+ "@lezer/highlight": "^1.2.3",
54
+ "@lezer/lr": "^1.4.8"
49
55
  },
50
56
  "devDependencies": {
51
57
  "@abinnovision/eslint-config-base": "^3.2.0",
52
58
  "@abinnovision/prettier-config": "^2.1.5",
53
- "@lezer/generator": "^1.0.0",
59
+ "@lezer/generator": "^1.8.0",
54
60
  "@seljs-internal/tsconfig": "^0.0.0",
55
61
  "eslint": "^9.39.4",
56
62
  "prettier": "^3.8.1",
63
+ "tsdown": "^0.21.3",
57
64
  "typescript": "^5.9.3",
58
65
  "vitest": "^4.0.18"
59
66
  },
@@ -1,5 +0,0 @@
1
- import { HighlightStyle } from "@codemirror/language";
2
- export declare const celHighlighting: import("@lezer/common").NodePropSource;
3
- export declare const celLightHighlightStyle: HighlightStyle;
4
- export declare const celDarkHighlightStyle: HighlightStyle;
5
- export declare const celSyntaxHighlighting: (dark?: boolean) => import("@codemirror/state").Extension;
package/dist/highlight.js DELETED
@@ -1,50 +0,0 @@
1
- import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
2
- import { styleTags, tags } from "@lezer/highlight";
3
- export const celHighlighting = styleTags({
4
- Identifier: tags.variableName,
5
- Number: tags.number,
6
- String: tags.string,
7
- BooleanLiteral: tags.bool,
8
- NullLiteral: tags.null,
9
- LogicOp: tags.logicOperator,
10
- CompareOp: tags.compareOperator,
11
- AddOp: tags.arithmeticOperator,
12
- MulOp: tags.arithmeticOperator,
13
- in: tags.operatorKeyword,
14
- LineComment: tags.lineComment,
15
- "( )": tags.paren,
16
- "[ ]": tags.squareBracket,
17
- "{ }": tags.brace,
18
- ", ;": tags.separator,
19
- });
20
- export const celLightHighlightStyle = HighlightStyle.define([
21
- { tag: tags.number, color: "#2e7d32" },
22
- { tag: tags.string, color: "#a65417" },
23
- { tag: tags.bool, color: "#0d47a1" },
24
- { tag: tags.null, color: "#0d47a1" },
25
- { tag: tags.logicOperator, color: "#7c4dff" },
26
- { tag: tags.compareOperator, color: "#7c4dff" },
27
- { tag: tags.arithmeticOperator, color: "#7c4dff" },
28
- { tag: tags.operatorKeyword, color: "#7c4dff" },
29
- { tag: tags.lineComment, color: "#9e9e9e" },
30
- { tag: tags.paren, color: "#795548" },
31
- { tag: tags.squareBracket, color: "#795548" },
32
- { tag: tags.brace, color: "#795548" },
33
- { tag: tags.separator, color: "#795548" },
34
- ]);
35
- export const celDarkHighlightStyle = HighlightStyle.define([
36
- { tag: tags.number, color: "#b5cea8" },
37
- { tag: tags.string, color: "#ce9178" },
38
- { tag: tags.bool, color: "#569cd6" },
39
- { tag: tags.null, color: "#569cd6" },
40
- { tag: tags.logicOperator, color: "#c586c0" },
41
- { tag: tags.compareOperator, color: "#c586c0" },
42
- { tag: tags.arithmeticOperator, color: "#c586c0" },
43
- { tag: tags.operatorKeyword, color: "#c586c0" },
44
- { tag: tags.lineComment, color: "#6a9955" },
45
- { tag: tags.paren, color: "#808080" },
46
- { tag: tags.squareBracket, color: "#808080" },
47
- { tag: tags.brace, color: "#808080" },
48
- { tag: tags.separator, color: "#808080" },
49
- ]);
50
- export const celSyntaxHighlighting = (dark = false) => syntaxHighlighting(dark ? celDarkHighlightStyle : celLightHighlightStyle);
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { LRLanguage, LanguageSupport } from "@codemirror/language";
2
- export * from "./highlight.js";
3
- export declare const celLanguage: LRLanguage;
4
- export declare const celLanguageSupport: (dark?: boolean) => LanguageSupport;
package/dist/index.js DELETED
@@ -1,13 +0,0 @@
1
- import { LRLanguage, LanguageSupport } from "@codemirror/language";
2
- import { celHighlighting, celSyntaxHighlighting } from "./highlight.js";
3
- import { parser } from "./parser.js";
4
- export * from "./highlight.js";
5
- export const celLanguage = LRLanguage.define({
6
- name: "cel",
7
- parser: parser.configure({ props: [celHighlighting] }),
8
- languageData: {
9
- commentTokens: { line: "//" },
10
- closeBrackets: { brackets: ["(", "[", "{", '"', "'"] },
11
- },
12
- });
13
- export const celLanguageSupport = (dark = false) => new LanguageSupport(celLanguage, [celSyntaxHighlighting(dark)]);
package/dist/parser.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { LRParser } from "@lezer/lr";
2
- export declare const parser: LRParser;
package/dist/parser.js DELETED
@@ -1,18 +0,0 @@
1
- // This file was generated by lezer-generator. You probably shouldn't edit it.
2
- import { LRParser } from "@lezer/lr";
3
- const spec_Identifier = { __proto__: null, in: 20 };
4
- export const parser = LRParser.deserialize({
5
- version: 14,
6
- states: "(QQYQPOOQzQQOOOYQPO'#CkOYQPO'#ClO!lQPO'#CvO!sQPO'#CwOOQO'#C}'#C}OYQPO'#C}OYQPO,58yOYQPO,58zOYQPO,58|OYQPO,59OOYQPO,59ROYQPO,59TOYQPO,59XO!zQPO'#CoOOQO,59Y,59YO#RQPO,59[O#WQPO,59]OOQO,59V,59VOOQO,59W,59WO#]QQO'#DVO#jQPO,59bO#oQQO'#D^O#vQPO'#D]O$OQPO,59cO$TQQO,59iO$[QQO1G.eO$}QQO1G.fO%kQQO1G.hO&_QQO1G.jO'RQQO1G.mO'xQQO1G.oO(|QQO1G.sO)TQPO,59ZOOQO1G.v1G.vOOQO1G.w1G.wOYQPO'#CxO)YQPO,59qOOQO1G.|1G.|OYQPO,59xOYQPO'#CyO)eQPO,59wOOQO1G.}1G.}OOQO1G/T1G/TOYQPO7+$POOQO7+$_7+$_OOQO1G.u1G.uO)mQQO,59dOOQO-E6v-E6vO)zQQO1G/dOOQO,59e,59eOOQO-E6w-E6wO*UQQO<<Gk",
7
- stateData: "*u~OpOSPOS~OXUOfUOgUOhUOiUOtQOuROvSOxVO!OTO~OTXOVYOYZO[[O^]OrWOv^Ox_O|aO}bO~OwyP~PYO!R!PP~PYO{yP~PYOXsO~OXtO~OzuOwyX{yX~PzOwwO~OsxO~PzOzyO!R!PX~O!R{O~O{|O~PzOs}O~PzOVYOYZO[[O^]Ov^Ox_O|aO}bO~OTSinSirSiwSizSisSi{Si!RSi~P$cOTUiVUiYUinUirUiwUizUisUi{Ui!RUi~P$iOTWiVWiYWinWirWiwWizWisWi{Wi!RWi~P$iOTZiVZiYZi[ZinZirZiwZizZisZi{Zi!RZi~P$lOv^Ox_O|aO}bOT]iV]iY]i[]i^]in]ir]iw]iz]is]i{]i!R]i~Ow!OO~PzO{!PO~OzuOwya{ya~OzyO!R!Pa~Owlazla{la~PzOz!Qi!R!Qi~PzOnRywRyzRysRy{Ry!RRy~PzOP|i^hXf}~",
8
- goto: "$i!RPPP!S!SP!SP!SPP!SP!SP!S!S!S!S!h!S!SPPPP!S!S!x#OPPP#UPPPPPPP$YPPPPP$`$cuUOQRSTVWXYZ[]^_uxy}m`Pegjklmnopq!Q!S!VQveR!RvQzhR!UzQPOQcQQdRSeS_SgTyQjVQkWQlXQmYQnZQo[Qp]Qq^Q!QuQ!SxR!V}QfSRr_RiTQhTR!Ty",
9
- nodeNames: "⚠ LineComment Expression ConditionalExpression BinaryExpression LogicOp BinaryExpression CompareOp BinaryExpression Identifier in BinaryExpression AddOp BinaryExpression MulOp BinaryExpression BinaryExpression IndexExpression CallExpression ArgList OptionalExpression MemberExpression Number String BooleanLiteral NullLiteral ListLiteral MapLiteral",
10
- maxTerm: 49,
11
- skippedNodes: [0, 1],
12
- repeatNodeCount: 2,
13
- tokenData: "3y~R|X^#{pq#{qr$prs$}uv&kvw&pwx&{xy(dyz(iz{&k{|(n|}(s}!O(x!O!P)P!P!Q)^!Q!R)}!R![+}![!]-W!^!_-]!_!`-e!`!a-]!a!b-k!c!}-p!}#O.R#P#Q.W#R#S-p#T#Y-p#Y#Z.]#Z#b-p#b#c0m#c#h-p#h#i2i#i#o-p#o#p3i#p#q3n#q#r3t#y#z#{$f$g#{#BY#BZ#{$IS$I_#{$I|$JO#{$JT$JU#{$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!Q![-p!c!}-p#R#S-p#T#o-p~0rUX~!Q![-p!c!}-p#R#S-p#T#i-p#i#j1U#j#o-p~1ZUX~!Q![-p!c!}-p#R#S-p#T#`-p#`#a1m#a#o-p~1rUX~!Q![-p!c!}-p#R#S-p#T#`-p#`#a2U#a#o-p~2]Si~X~!Q![-p!c!}-p#R#S-p#T#o-p~2nUX~!Q![-p!c!}-p#R#S-p#T#f-p#f#g3Q#g#o-p~3VUX~!Q![-p!c!}-p#R#S-p#T#i-p#i#j/q#j#o-p~3nO!O~~3qP#p#q&v~3yO!R~",
14
- tokenizers: [0, 1],
15
- topRules: { "Expression": [0, 2] },
16
- specialized: [{ term: 9, get: (value) => spec_Identifier[value] || -1 }],
17
- tokenPrec: 442
18
- });
@@ -1 +0,0 @@
1
- export declare const LineComment = 1, Expression = 2, LogicOp = 5, CompareOp = 7, Identifier = 9, _in = 10, AddOp = 12, MulOp = 14, ArgList = 19, Number = 22, String = 23, BooleanLiteral = 24, NullLiteral = 25, ListLiteral = 26, MapLiteral = 27;
@@ -1,2 +0,0 @@
1
- // This file was generated by lezer-generator. You probably shouldn't edit it.
2
- export const LineComment = 1, Expression = 2, LogicOp = 5, CompareOp = 7, Identifier = 9, _in = 10, AddOp = 12, MulOp = 14, ArgList = 19, Number = 22, String = 23, BooleanLiteral = 24, NullLiteral = 25, ListLiteral = 26, MapLiteral = 27;