jexl-lezer 0.4.0 → 0.5.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/README.md +14 -1
- package/dist/index.cjs +25 -294
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24 -293
- package/package.json +17 -7
- package/rollup.config.js +4 -4
- package/src/highlight.js +62 -192
- package/src/{jexl.grammar → javascript.grammar} +735 -745
- package/src/parser.js +21 -21
- package/src/parser.terms.js +166 -165
- package/test/decorator.txt +64 -0
- package/test/expression.txt +686 -0
- package/test/jsx.txt +79 -0
- package/test/semicolon.txt +77 -0
- package/test/statement.txt +404 -0
- package/test/test-javascript.js +17 -0
- package/test/typescript.txt +401 -0
package/src/parser.terms.js
CHANGED
|
@@ -1,176 +1,177 @@
|
|
|
1
1
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
2
|
export const
|
|
3
|
-
noSemi =
|
|
4
|
-
noSemiType =
|
|
3
|
+
noSemi = 316,
|
|
4
|
+
noSemiType = 317,
|
|
5
5
|
incdec = 1,
|
|
6
6
|
incdecPrefix = 2,
|
|
7
7
|
questionDot = 3,
|
|
8
8
|
JSXStartTag = 4,
|
|
9
|
-
insertSemi =
|
|
10
|
-
spaces =
|
|
11
|
-
newline =
|
|
9
|
+
insertSemi = 318,
|
|
10
|
+
spaces = 320,
|
|
11
|
+
newline = 321,
|
|
12
12
|
LineComment = 5,
|
|
13
13
|
BlockComment = 6,
|
|
14
14
|
Script = 7,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
15
|
+
Hashbang = 8,
|
|
16
|
+
ExportDeclaration = 9,
|
|
17
|
+
_export = 10,
|
|
18
|
+
Star = 11,
|
|
19
|
+
as = 12,
|
|
20
|
+
VariableName = 13,
|
|
21
|
+
String = 14,
|
|
22
|
+
Escape = 15,
|
|
23
|
+
from = 16,
|
|
24
|
+
_default = 18,
|
|
25
|
+
FunctionDeclaration = 19,
|
|
26
|
+
async = 64,
|
|
27
|
+
_function = 21,
|
|
28
|
+
VariableDefinition = 22,
|
|
29
|
+
TypeParamList = 25,
|
|
30
|
+
_in = 26,
|
|
31
|
+
out = 27,
|
|
32
|
+
_const = 28,
|
|
33
|
+
TypeDefinition = 29,
|
|
34
|
+
_extends = 30,
|
|
35
|
+
_this = 32,
|
|
36
|
+
Number = 35,
|
|
37
|
+
BooleanLiteral = 36,
|
|
38
|
+
TemplateType = 37,
|
|
39
|
+
InterpolationEnd = 38,
|
|
40
|
+
templateType = 39,
|
|
41
|
+
InterpolationStart = 40,
|
|
42
|
+
_null = 42,
|
|
43
|
+
_void = 44,
|
|
44
|
+
_typeof = 46,
|
|
45
|
+
PropertyName = 49,
|
|
46
|
+
TemplateString = 51,
|
|
47
|
+
templateEscape = 52,
|
|
48
|
+
templateExpr = 53,
|
|
49
|
+
_super = 54,
|
|
50
|
+
RegExp = 55,
|
|
51
|
+
ArrayExpression = 57,
|
|
52
|
+
Property = 63,
|
|
53
|
+
get = 65,
|
|
54
|
+
set = 66,
|
|
55
|
+
PropertyDefinition = 67,
|
|
56
|
+
Block = 68,
|
|
57
|
+
_new = 200,
|
|
58
|
+
ArgList = 75,
|
|
59
|
+
UnaryExpression = 76,
|
|
60
|
+
_delete = 77,
|
|
61
|
+
YieldExpression = 80,
|
|
62
|
+
_yield = 81,
|
|
63
|
+
AwaitExpression = 82,
|
|
64
|
+
_await = 83,
|
|
65
|
+
ParenthesizedExpression = 84,
|
|
66
|
+
ClassExpression = 85,
|
|
67
|
+
_class = 86,
|
|
68
|
+
ClassBody = 87,
|
|
69
|
+
MethodDeclaration = 88,
|
|
70
|
+
Decorator = 89,
|
|
71
|
+
PrivatePropertyName = 92,
|
|
72
|
+
TypeArgList = 94,
|
|
73
|
+
LessThan = 95,
|
|
74
|
+
declare = 225,
|
|
75
|
+
Privacy = 117,
|
|
76
|
+
_static = 99,
|
|
77
|
+
abstract = 208,
|
|
78
|
+
override = 101,
|
|
79
|
+
PrivatePropertyDefinition = 102,
|
|
80
|
+
PropertyDeclaration = 103,
|
|
81
|
+
readonly = 118,
|
|
82
|
+
accessor = 105,
|
|
83
|
+
Optional = 106,
|
|
84
|
+
TypeAnnotation = 107,
|
|
85
|
+
StaticBlock = 109,
|
|
86
|
+
FunctionExpression = 110,
|
|
87
|
+
ArrowFunction = 111,
|
|
88
|
+
ParamList = 113,
|
|
89
|
+
ArrayPattern = 114,
|
|
90
|
+
ObjectPattern = 115,
|
|
91
|
+
PatternProperty = 116,
|
|
92
|
+
MemberExpression = 120,
|
|
93
|
+
BinaryExpression = 121,
|
|
94
|
+
divide = 123,
|
|
95
|
+
_instanceof = 128,
|
|
96
|
+
satisfies = 129,
|
|
97
|
+
questionOp = 137,
|
|
98
|
+
AssignmentExpression = 139,
|
|
99
|
+
_import = 146,
|
|
100
|
+
JSXElement = 148,
|
|
101
|
+
JSXSelfCloseEndTag = 149,
|
|
102
|
+
JSXSelfClosingTag = 150,
|
|
103
|
+
JSXIdentifier = 151,
|
|
104
|
+
JSXLowerIdentifier = 153,
|
|
105
|
+
JSXNamespacedName = 154,
|
|
106
|
+
JSXMemberExpression = 155,
|
|
107
|
+
JSXAttributeValue = 158,
|
|
108
|
+
JSXEndTag = 160,
|
|
109
|
+
JSXOpenTag = 161,
|
|
110
|
+
JSXFragmentTag = 162,
|
|
111
|
+
JSXText = 163,
|
|
112
|
+
JSXEscape = 164,
|
|
113
|
+
JSXStartCloseTag = 165,
|
|
114
|
+
JSXCloseTag = 166,
|
|
115
|
+
tsAngleOpen = 168,
|
|
116
|
+
SequenceExpression = 171,
|
|
117
|
+
keyof = 174,
|
|
118
|
+
unique = 176,
|
|
119
|
+
infer = 179,
|
|
120
|
+
TypeName = 180,
|
|
121
|
+
ParamTypeList = 183,
|
|
122
|
+
IndexedType = 185,
|
|
123
|
+
Label = 187,
|
|
124
|
+
ObjectType = 190,
|
|
125
|
+
MethodType = 191,
|
|
126
|
+
PropertyType = 192,
|
|
127
|
+
IndexSignature = 193,
|
|
128
|
+
TypePredicate = 196,
|
|
129
|
+
asserts = 197,
|
|
130
|
+
is = 198,
|
|
131
|
+
unionOp = 202,
|
|
132
|
+
intersectionOp = 204,
|
|
133
|
+
ClassDeclaration = 207,
|
|
134
|
+
_implements = 209,
|
|
135
|
+
type = 210,
|
|
136
|
+
VariableDeclaration = 211,
|
|
137
|
+
_let = 212,
|
|
138
|
+
_var = 213,
|
|
139
|
+
using = 214,
|
|
140
|
+
TypeAliasDeclaration = 215,
|
|
141
|
+
InterfaceDeclaration = 216,
|
|
142
|
+
_interface = 217,
|
|
143
|
+
EnumDeclaration = 218,
|
|
144
|
+
_enum = 219,
|
|
145
|
+
NamespaceDeclaration = 221,
|
|
146
|
+
namespace = 222,
|
|
147
|
+
module = 223,
|
|
148
|
+
AmbientDeclaration = 224,
|
|
149
|
+
global = 227,
|
|
150
|
+
ExportGroup = 231,
|
|
151
|
+
ImportDeclaration = 234,
|
|
152
|
+
defer = 235,
|
|
153
|
+
ImportGroup = 236,
|
|
154
|
+
_for = 238,
|
|
155
|
+
ForSpec = 239,
|
|
156
|
+
ForInSpec = 240,
|
|
157
|
+
ForOfSpec = 241,
|
|
158
|
+
of = 242,
|
|
159
|
+
_while = 244,
|
|
160
|
+
_with = 246,
|
|
161
|
+
_do = 248,
|
|
162
|
+
_if = 250,
|
|
163
|
+
_else = 251,
|
|
164
|
+
_switch = 253,
|
|
165
|
+
_case = 256,
|
|
166
|
+
_try = 259,
|
|
167
|
+
_catch = 261,
|
|
168
|
+
_finally = 263,
|
|
169
|
+
_return = 265,
|
|
170
|
+
_throw = 267,
|
|
171
|
+
_break = 269,
|
|
172
|
+
_continue = 271,
|
|
173
|
+
_debugger = 273,
|
|
174
|
+
SingleExpression = 276,
|
|
175
|
+
SingleClassItem = 277,
|
|
175
176
|
Dialect_jsx = 0,
|
|
176
177
|
Dialect_ts = 1
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Decorators on classes and class fields
|
|
2
|
+
|
|
3
|
+
@d1 class Foo {
|
|
4
|
+
@d2 bar() {}
|
|
5
|
+
@d3 get baz() { return 1 }
|
|
6
|
+
@d4 quux = 1
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
==>
|
|
10
|
+
|
|
11
|
+
Script(ClassDeclaration(
|
|
12
|
+
Decorator(VariableName),
|
|
13
|
+
class,VariableDefinition,ClassBody(
|
|
14
|
+
MethodDeclaration(Decorator(VariableName),PropertyDefinition,ParamList,Block),
|
|
15
|
+
MethodDeclaration(Decorator(VariableName),get,PropertyDefinition,ParamList,Block(
|
|
16
|
+
ReturnStatement(return,Number))),
|
|
17
|
+
PropertyDeclaration(Decorator(VariableName),PropertyDefinition,Equals,Number))))
|
|
18
|
+
|
|
19
|
+
# Multiple decorators
|
|
20
|
+
|
|
21
|
+
@d1 @d2 class Y {}
|
|
22
|
+
|
|
23
|
+
==>
|
|
24
|
+
|
|
25
|
+
Script(ClassDeclaration(Decorator(VariableName),Decorator(VariableName),class,VariableDefinition,ClassBody))
|
|
26
|
+
|
|
27
|
+
# Member decorators
|
|
28
|
+
|
|
29
|
+
@one.two class X {}
|
|
30
|
+
|
|
31
|
+
==>
|
|
32
|
+
|
|
33
|
+
Script(ClassDeclaration(Decorator(MemberExpression(VariableName,PropertyName)),class,VariableDefinition,ClassBody))
|
|
34
|
+
|
|
35
|
+
# Call decorators
|
|
36
|
+
|
|
37
|
+
@d(2) @a.b() class Z {}
|
|
38
|
+
|
|
39
|
+
==>
|
|
40
|
+
|
|
41
|
+
Script(ClassDeclaration(
|
|
42
|
+
Decorator(CallExpression(VariableName,ArgList(Number))),
|
|
43
|
+
Decorator(CallExpression(MemberExpression(VariableName,PropertyName),ArgList)),
|
|
44
|
+
class,VariableDefinition,ClassBody))
|
|
45
|
+
|
|
46
|
+
# Parenthesized decorators
|
|
47
|
+
|
|
48
|
+
@(a instanceof Array ? x : y)(2) class P {}
|
|
49
|
+
|
|
50
|
+
==>
|
|
51
|
+
|
|
52
|
+
Script(ClassDeclaration(
|
|
53
|
+
Decorator(CallExpression(ParenthesizedExpression(
|
|
54
|
+
ConditionalExpression(BinaryExpression(VariableName,instanceof,VariableName),LogicOp,VariableName,LogicOp,VariableName)),
|
|
55
|
+
ArgList(Number))),
|
|
56
|
+
class,VariableDefinition,ClassBody))
|
|
57
|
+
|
|
58
|
+
# Parameter decorators
|
|
59
|
+
|
|
60
|
+
function foo(@d bar) {}
|
|
61
|
+
|
|
62
|
+
==>
|
|
63
|
+
|
|
64
|
+
Script(FunctionDeclaration(function,VariableDefinition,ParamList(Decorator(VariableName),VariableDefinition),Block))
|