ether-code 0.1.5 → 0.1.7
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/cli/ether.js +1 -1
- package/generators/css-generator.js +42 -55
- package/generators/graphql-generator.js +19 -22
- package/generators/html-generator.js +51 -182
- package/generators/js-generator.js +76 -157
- package/generators/node-generator.js +49 -93
- package/generators/php-generator.js +46 -68
- package/generators/python-generator.js +35 -54
- package/generators/react-generator.js +37 -47
- package/generators/ruby-generator.js +59 -119
- package/generators/sql-generator.js +42 -63
- package/generators/ts-generator.js +59 -133
- package/i18n/i18n-css.json +147 -147
- package/i18n/i18n-graphql.json +6 -6
- package/i18n/i18n-html.json +135 -135
- package/i18n/i18n-js.json +107 -107
- package/i18n/i18n-node.json +14 -14
- package/i18n/i18n-php.json +177 -177
- package/i18n/i18n-python.json +16 -16
- package/i18n/i18n-react.json +97 -97
- package/i18n/i18n-ruby.json +22 -22
- package/i18n/i18n-sql.json +153 -153
- package/i18n/i18n-ts.json +10 -10
- package/lexer/ether-lexer.js +175 -34
- package/lexer/tokens.js +6 -6
- package/package.json +1 -1
- package/parsers/ast-css.js +0 -545
- package/parsers/ast-graphql.js +0 -424
- package/parsers/ast-html.js +0 -886
- package/parsers/ast-js.js +0 -750
- package/parsers/ast-node.js +0 -2440
- package/parsers/ast-php.js +0 -957
- package/parsers/ast-react.js +0 -580
- package/parsers/ast-ruby.js +0 -895
- package/parsers/ast-ts.js +0 -1352
- package/parsers/css-parser.js +0 -1981
- package/parsers/graphql-parser.js +0 -2011
- package/parsers/html-parser.js +0 -1182
- package/parsers/js-parser.js +0 -2564
- package/parsers/node-parser.js +0 -2644
- package/parsers/php-parser.js +0 -3037
- package/parsers/react-parser.js +0 -1035
- package/parsers/ruby-parser.js +0 -2680
- package/parsers/ts-parser.js +0 -3881
package/parsers/ast-ruby.js
DELETED
|
@@ -1,895 +0,0 @@
|
|
|
1
|
-
class ASTNode {
|
|
2
|
-
constructor(type, loc = null) {
|
|
3
|
-
this.type = type
|
|
4
|
-
this.loc = loc
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
class Program extends ASTNode {
|
|
9
|
-
constructor(body = [], loc = null) {
|
|
10
|
-
super('Program', loc)
|
|
11
|
-
this.body = body
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class Identifier extends ASTNode {
|
|
16
|
-
constructor(name, loc = null) {
|
|
17
|
-
super('Identifier', loc)
|
|
18
|
-
this.name = name
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class InstanceVariable extends ASTNode {
|
|
23
|
-
constructor(name, loc = null) {
|
|
24
|
-
super('InstanceVariable', loc)
|
|
25
|
-
this.name = name
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
class ClassVariable extends ASTNode {
|
|
30
|
-
constructor(name, loc = null) {
|
|
31
|
-
super('ClassVariable', loc)
|
|
32
|
-
this.name = name
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
class GlobalVariable extends ASTNode {
|
|
37
|
-
constructor(name, loc = null) {
|
|
38
|
-
super('GlobalVariable', loc)
|
|
39
|
-
this.name = name
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
class Constant extends ASTNode {
|
|
44
|
-
constructor(name, loc = null) {
|
|
45
|
-
super('Constant', loc)
|
|
46
|
-
this.name = name
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
class ScopedConstant extends ASTNode {
|
|
51
|
-
constructor(scope, name, loc = null) {
|
|
52
|
-
super('ScopedConstant', loc)
|
|
53
|
-
this.scope = scope
|
|
54
|
-
this.name = name
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class Symbol extends ASTNode {
|
|
59
|
-
constructor(value, loc = null) {
|
|
60
|
-
super('Symbol', loc)
|
|
61
|
-
this.value = value
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
class StringLiteral extends ASTNode {
|
|
66
|
-
constructor(value, raw = null, interpolated = false, loc = null) {
|
|
67
|
-
super('StringLiteral', loc)
|
|
68
|
-
this.value = value
|
|
69
|
-
this.raw = raw
|
|
70
|
-
this.interpolated = interpolated
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
class InterpolatedString extends ASTNode {
|
|
75
|
-
constructor(parts = [], loc = null) {
|
|
76
|
-
super('InterpolatedString', loc)
|
|
77
|
-
this.parts = parts
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
class StringPart extends ASTNode {
|
|
82
|
-
constructor(value, loc = null) {
|
|
83
|
-
super('StringPart', loc)
|
|
84
|
-
this.value = value
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
class InterpolationPart extends ASTNode {
|
|
89
|
-
constructor(expression, loc = null) {
|
|
90
|
-
super('InterpolationPart', loc)
|
|
91
|
-
this.expression = expression
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
class NumericLiteral extends ASTNode {
|
|
96
|
-
constructor(value, raw = null, loc = null) {
|
|
97
|
-
super('NumericLiteral', loc)
|
|
98
|
-
this.value = value
|
|
99
|
-
this.raw = raw
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
class FloatLiteral extends ASTNode {
|
|
104
|
-
constructor(value, raw = null, loc = null) {
|
|
105
|
-
super('FloatLiteral', loc)
|
|
106
|
-
this.value = value
|
|
107
|
-
this.raw = raw
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
class RationalLiteral extends ASTNode {
|
|
112
|
-
constructor(value, raw = null, loc = null) {
|
|
113
|
-
super('RationalLiteral', loc)
|
|
114
|
-
this.value = value
|
|
115
|
-
this.raw = raw
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
class ComplexLiteral extends ASTNode {
|
|
120
|
-
constructor(value, raw = null, loc = null) {
|
|
121
|
-
super('ComplexLiteral', loc)
|
|
122
|
-
this.value = value
|
|
123
|
-
this.raw = raw
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
class BooleanLiteral extends ASTNode {
|
|
128
|
-
constructor(value, loc = null) {
|
|
129
|
-
super('BooleanLiteral', loc)
|
|
130
|
-
this.value = value
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
class NilLiteral extends ASTNode {
|
|
135
|
-
constructor(loc = null) {
|
|
136
|
-
super('NilLiteral', loc)
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
class ArrayLiteral extends ASTNode {
|
|
141
|
-
constructor(elements = [], loc = null) {
|
|
142
|
-
super('ArrayLiteral', loc)
|
|
143
|
-
this.elements = elements
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
class HashLiteral extends ASTNode {
|
|
148
|
-
constructor(pairs = [], loc = null) {
|
|
149
|
-
super('HashLiteral', loc)
|
|
150
|
-
this.pairs = pairs
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
class HashPair extends ASTNode {
|
|
155
|
-
constructor(key, value, loc = null) {
|
|
156
|
-
super('HashPair', loc)
|
|
157
|
-
this.key = key
|
|
158
|
-
this.value = value
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
class RangeLiteral extends ASTNode {
|
|
163
|
-
constructor(start, end, exclusive = false, loc = null) {
|
|
164
|
-
super('RangeLiteral', loc)
|
|
165
|
-
this.start = start
|
|
166
|
-
this.end = end
|
|
167
|
-
this.exclusive = exclusive
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
class RegexpLiteral extends ASTNode {
|
|
172
|
-
constructor(pattern, flags = '', loc = null) {
|
|
173
|
-
super('RegexpLiteral', loc)
|
|
174
|
-
this.pattern = pattern
|
|
175
|
-
this.flags = flags
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
class PercentArray extends ASTNode {
|
|
180
|
-
constructor(elements = [], type = 'w', loc = null) {
|
|
181
|
-
super('PercentArray', loc)
|
|
182
|
-
this.elements = elements
|
|
183
|
-
this.type = type
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
class HeredocLiteral extends ASTNode {
|
|
188
|
-
constructor(content, delimiter, squiggly = false, loc = null) {
|
|
189
|
-
super('HeredocLiteral', loc)
|
|
190
|
-
this.content = content
|
|
191
|
-
this.delimiter = delimiter
|
|
192
|
-
this.squiggly = squiggly
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
class BinaryExpression extends ASTNode {
|
|
197
|
-
constructor(operator, left, right, loc = null) {
|
|
198
|
-
super('BinaryExpression', loc)
|
|
199
|
-
this.operator = operator
|
|
200
|
-
this.left = left
|
|
201
|
-
this.right = right
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
class UnaryExpression extends ASTNode {
|
|
206
|
-
constructor(operator, argument, prefix = true, loc = null) {
|
|
207
|
-
super('UnaryExpression', loc)
|
|
208
|
-
this.operator = operator
|
|
209
|
-
this.argument = argument
|
|
210
|
-
this.prefix = prefix
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
class AssignmentExpression extends ASTNode {
|
|
215
|
-
constructor(operator, left, right, loc = null) {
|
|
216
|
-
super('AssignmentExpression', loc)
|
|
217
|
-
this.operator = operator
|
|
218
|
-
this.left = left
|
|
219
|
-
this.right = right
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
class MultipleAssignment extends ASTNode {
|
|
224
|
-
constructor(targets = [], value, loc = null) {
|
|
225
|
-
super('MultipleAssignment', loc)
|
|
226
|
-
this.targets = targets
|
|
227
|
-
this.value = value
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
class SplatExpression extends ASTNode {
|
|
232
|
-
constructor(argument, loc = null) {
|
|
233
|
-
super('SplatExpression', loc)
|
|
234
|
-
this.argument = argument
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
class DoubleSplatExpression extends ASTNode {
|
|
239
|
-
constructor(argument, loc = null) {
|
|
240
|
-
super('DoubleSplatExpression', loc)
|
|
241
|
-
this.argument = argument
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
class ConditionalExpression extends ASTNode {
|
|
246
|
-
constructor(test, consequent, alternate, loc = null) {
|
|
247
|
-
super('ConditionalExpression', loc)
|
|
248
|
-
this.test = test
|
|
249
|
-
this.consequent = consequent
|
|
250
|
-
this.alternate = alternate
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
class LogicalExpression extends ASTNode {
|
|
255
|
-
constructor(operator, left, right, loc = null) {
|
|
256
|
-
super('LogicalExpression', loc)
|
|
257
|
-
this.operator = operator
|
|
258
|
-
this.left = left
|
|
259
|
-
this.right = right
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
class MethodCall extends ASTNode {
|
|
264
|
-
constructor(receiver, method, arguments_ = [], block = null, safeNavigation = false, loc = null) {
|
|
265
|
-
super('MethodCall', loc)
|
|
266
|
-
this.receiver = receiver
|
|
267
|
-
this.method = method
|
|
268
|
-
this.arguments = arguments_
|
|
269
|
-
this.block = block
|
|
270
|
-
this.safeNavigation = safeNavigation
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
class IndexAccess extends ASTNode {
|
|
275
|
-
constructor(object, index, loc = null) {
|
|
276
|
-
super('IndexAccess', loc)
|
|
277
|
-
this.object = object
|
|
278
|
-
this.index = index
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
class IndexAssignment extends ASTNode {
|
|
283
|
-
constructor(object, index, value, loc = null) {
|
|
284
|
-
super('IndexAssignment', loc)
|
|
285
|
-
this.object = object
|
|
286
|
-
this.index = index
|
|
287
|
-
this.value = value
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
class AttributeAccess extends ASTNode {
|
|
292
|
-
constructor(object, attribute, safeNavigation = false, loc = null) {
|
|
293
|
-
super('AttributeAccess', loc)
|
|
294
|
-
this.object = object
|
|
295
|
-
this.attribute = attribute
|
|
296
|
-
this.safeNavigation = safeNavigation
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
class AttributeAssignment extends ASTNode {
|
|
301
|
-
constructor(object, attribute, value, safeNavigation = false, loc = null) {
|
|
302
|
-
super('AttributeAssignment', loc)
|
|
303
|
-
this.object = object
|
|
304
|
-
this.attribute = attribute
|
|
305
|
-
this.value = value
|
|
306
|
-
this.safeNavigation = safeNavigation
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
class SuperCall extends ASTNode {
|
|
311
|
-
constructor(arguments_ = null, block = null, loc = null) {
|
|
312
|
-
super('SuperCall', loc)
|
|
313
|
-
this.arguments = arguments_
|
|
314
|
-
this.block = block
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
class YieldExpression extends ASTNode {
|
|
319
|
-
constructor(arguments_ = [], loc = null) {
|
|
320
|
-
super('YieldExpression', loc)
|
|
321
|
-
this.arguments = arguments_
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
class SelfExpression extends ASTNode {
|
|
326
|
-
constructor(loc = null) {
|
|
327
|
-
super('SelfExpression', loc)
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
class DefinedExpression extends ASTNode {
|
|
332
|
-
constructor(expression, loc = null) {
|
|
333
|
-
super('DefinedExpression', loc)
|
|
334
|
-
this.expression = expression
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
class NotExpression extends ASTNode {
|
|
339
|
-
constructor(argument, loc = null) {
|
|
340
|
-
super('NotExpression', loc)
|
|
341
|
-
this.argument = argument
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
class Block extends ASTNode {
|
|
346
|
-
constructor(parameters = [], body = [], loc = null) {
|
|
347
|
-
super('Block', loc)
|
|
348
|
-
this.parameters = parameters
|
|
349
|
-
this.body = body
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
class BlockParameter extends ASTNode {
|
|
354
|
-
constructor(name, defaultValue = null, splat = false, doubleSplat = false, blockArg = false, loc = null) {
|
|
355
|
-
super('BlockParameter', loc)
|
|
356
|
-
this.name = name
|
|
357
|
-
this.defaultValue = defaultValue
|
|
358
|
-
this.splat = splat
|
|
359
|
-
this.doubleSplat = doubleSplat
|
|
360
|
-
this.blockArg = blockArg
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
class ProcLiteral extends ASTNode {
|
|
365
|
-
constructor(parameters = [], body = [], loc = null) {
|
|
366
|
-
super('ProcLiteral', loc)
|
|
367
|
-
this.parameters = parameters
|
|
368
|
-
this.body = body
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
class LambdaLiteral extends ASTNode {
|
|
373
|
-
constructor(parameters = [], body = [], loc = null) {
|
|
374
|
-
super('LambdaLiteral', loc)
|
|
375
|
-
this.parameters = parameters
|
|
376
|
-
this.body = body
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
class MethodDefinition extends ASTNode {
|
|
381
|
-
constructor(name, parameters = [], body = [], singleton = null, loc = null) {
|
|
382
|
-
super('MethodDefinition', loc)
|
|
383
|
-
this.name = name
|
|
384
|
-
this.parameters = parameters
|
|
385
|
-
this.body = body
|
|
386
|
-
this.singleton = singleton
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
class MethodParameter extends ASTNode {
|
|
391
|
-
constructor(name, defaultValue = null, splat = false, doubleSplat = false, blockArg = false, keyword = false, loc = null) {
|
|
392
|
-
super('MethodParameter', loc)
|
|
393
|
-
this.name = name
|
|
394
|
-
this.defaultValue = defaultValue
|
|
395
|
-
this.splat = splat
|
|
396
|
-
this.doubleSplat = doubleSplat
|
|
397
|
-
this.blockArg = blockArg
|
|
398
|
-
this.keyword = keyword
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
class ClassDefinition extends ASTNode {
|
|
403
|
-
constructor(name, superclass = null, body = [], loc = null) {
|
|
404
|
-
super('ClassDefinition', loc)
|
|
405
|
-
this.name = name
|
|
406
|
-
this.superclass = superclass
|
|
407
|
-
this.body = body
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
class SingletonClass extends ASTNode {
|
|
412
|
-
constructor(object, body = [], loc = null) {
|
|
413
|
-
super('SingletonClass', loc)
|
|
414
|
-
this.object = object
|
|
415
|
-
this.body = body
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
class ModuleDefinition extends ASTNode {
|
|
420
|
-
constructor(name, body = [], loc = null) {
|
|
421
|
-
super('ModuleDefinition', loc)
|
|
422
|
-
this.name = name
|
|
423
|
-
this.body = body
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
class IncludeStatement extends ASTNode {
|
|
428
|
-
constructor(modules = [], loc = null) {
|
|
429
|
-
super('IncludeStatement', loc)
|
|
430
|
-
this.modules = modules
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
class ExtendStatement extends ASTNode {
|
|
435
|
-
constructor(modules = [], loc = null) {
|
|
436
|
-
super('ExtendStatement', loc)
|
|
437
|
-
this.modules = modules
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
class PrependStatement extends ASTNode {
|
|
442
|
-
constructor(modules = [], loc = null) {
|
|
443
|
-
super('PrependStatement', loc)
|
|
444
|
-
this.modules = modules
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
class AttrAccessor extends ASTNode {
|
|
449
|
-
constructor(type, attributes = [], loc = null) {
|
|
450
|
-
super('AttrAccessor', loc)
|
|
451
|
-
this.accessorType = type
|
|
452
|
-
this.attributes = attributes
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
class AliasStatement extends ASTNode {
|
|
457
|
-
constructor(newName, oldName, loc = null) {
|
|
458
|
-
super('AliasStatement', loc)
|
|
459
|
-
this.newName = newName
|
|
460
|
-
this.oldName = oldName
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
class UndefStatement extends ASTNode {
|
|
465
|
-
constructor(methods = [], loc = null) {
|
|
466
|
-
super('UndefStatement', loc)
|
|
467
|
-
this.methods = methods
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
class IfStatement extends ASTNode {
|
|
472
|
-
constructor(test, consequent = [], alternate = null, modifier = false, loc = null) {
|
|
473
|
-
super('IfStatement', loc)
|
|
474
|
-
this.test = test
|
|
475
|
-
this.consequent = consequent
|
|
476
|
-
this.alternate = alternate
|
|
477
|
-
this.modifier = modifier
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
class UnlessStatement extends ASTNode {
|
|
482
|
-
constructor(test, consequent = [], alternate = null, modifier = false, loc = null) {
|
|
483
|
-
super('UnlessStatement', loc)
|
|
484
|
-
this.test = test
|
|
485
|
-
this.consequent = consequent
|
|
486
|
-
this.alternate = alternate
|
|
487
|
-
this.modifier = modifier
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
class ElsifClause extends ASTNode {
|
|
492
|
-
constructor(test, consequent = [], loc = null) {
|
|
493
|
-
super('ElsifClause', loc)
|
|
494
|
-
this.test = test
|
|
495
|
-
this.consequent = consequent
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
class CaseStatement extends ASTNode {
|
|
500
|
-
constructor(expression, whens = [], elseBody = null, loc = null) {
|
|
501
|
-
super('CaseStatement', loc)
|
|
502
|
-
this.expression = expression
|
|
503
|
-
this.whens = whens
|
|
504
|
-
this.elseBody = elseBody
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
class WhenClause extends ASTNode {
|
|
509
|
-
constructor(conditions = [], body = [], loc = null) {
|
|
510
|
-
super('WhenClause', loc)
|
|
511
|
-
this.conditions = conditions
|
|
512
|
-
this.body = body
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
class CaseInStatement extends ASTNode {
|
|
517
|
-
constructor(expression, ins = [], elseBody = null, loc = null) {
|
|
518
|
-
super('CaseInStatement', loc)
|
|
519
|
-
this.expression = expression
|
|
520
|
-
this.ins = ins
|
|
521
|
-
this.elseBody = elseBody
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
class InClause extends ASTNode {
|
|
526
|
-
constructor(pattern, guard = null, body = [], loc = null) {
|
|
527
|
-
super('InClause', loc)
|
|
528
|
-
this.pattern = pattern
|
|
529
|
-
this.guard = guard
|
|
530
|
-
this.body = body
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
class ArrayPattern extends ASTNode {
|
|
535
|
-
constructor(elements = [], rest = null, loc = null) {
|
|
536
|
-
super('ArrayPattern', loc)
|
|
537
|
-
this.elements = elements
|
|
538
|
-
this.rest = rest
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
class HashPattern extends ASTNode {
|
|
543
|
-
constructor(pairs = [], rest = null, loc = null) {
|
|
544
|
-
super('HashPattern', loc)
|
|
545
|
-
this.pairs = pairs
|
|
546
|
-
this.rest = rest
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
class AlternativePattern extends ASTNode {
|
|
551
|
-
constructor(patterns = [], loc = null) {
|
|
552
|
-
super('AlternativePattern', loc)
|
|
553
|
-
this.patterns = patterns
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
class AsPattern extends ASTNode {
|
|
558
|
-
constructor(pattern, variable, loc = null) {
|
|
559
|
-
super('AsPattern', loc)
|
|
560
|
-
this.pattern = pattern
|
|
561
|
-
this.variable = variable
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
class PinExpression extends ASTNode {
|
|
566
|
-
constructor(variable, loc = null) {
|
|
567
|
-
super('PinExpression', loc)
|
|
568
|
-
this.variable = variable
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
class WhileStatement extends ASTNode {
|
|
573
|
-
constructor(test, body = [], modifier = false, loc = null) {
|
|
574
|
-
super('WhileStatement', loc)
|
|
575
|
-
this.test = test
|
|
576
|
-
this.body = body
|
|
577
|
-
this.modifier = modifier
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
class UntilStatement extends ASTNode {
|
|
582
|
-
constructor(test, body = [], modifier = false, loc = null) {
|
|
583
|
-
super('UntilStatement', loc)
|
|
584
|
-
this.test = test
|
|
585
|
-
this.body = body
|
|
586
|
-
this.modifier = modifier
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
class ForStatement extends ASTNode {
|
|
591
|
-
constructor(variable, iterable, body = [], loc = null) {
|
|
592
|
-
super('ForStatement', loc)
|
|
593
|
-
this.variable = variable
|
|
594
|
-
this.iterable = iterable
|
|
595
|
-
this.body = body
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
class LoopStatement extends ASTNode {
|
|
600
|
-
constructor(body = [], loc = null) {
|
|
601
|
-
super('LoopStatement', loc)
|
|
602
|
-
this.body = body
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
class BreakStatement extends ASTNode {
|
|
607
|
-
constructor(value = null, loc = null) {
|
|
608
|
-
super('BreakStatement', loc)
|
|
609
|
-
this.value = value
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
class NextStatement extends ASTNode {
|
|
614
|
-
constructor(value = null, loc = null) {
|
|
615
|
-
super('NextStatement', loc)
|
|
616
|
-
this.value = value
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
class RedoStatement extends ASTNode {
|
|
621
|
-
constructor(loc = null) {
|
|
622
|
-
super('RedoStatement', loc)
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
class RetryStatement extends ASTNode {
|
|
627
|
-
constructor(loc = null) {
|
|
628
|
-
super('RetryStatement', loc)
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
class ReturnStatement extends ASTNode {
|
|
633
|
-
constructor(value = null, loc = null) {
|
|
634
|
-
super('ReturnStatement', loc)
|
|
635
|
-
this.value = value
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
class BeginBlock extends ASTNode {
|
|
640
|
-
constructor(body = [], rescues = [], elseBody = null, ensure = null, loc = null) {
|
|
641
|
-
super('BeginBlock', loc)
|
|
642
|
-
this.body = body
|
|
643
|
-
this.rescues = rescues
|
|
644
|
-
this.elseBody = elseBody
|
|
645
|
-
this.ensure = ensure
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
class RescueClause extends ASTNode {
|
|
650
|
-
constructor(exceptionTypes = [], variable = null, body = [], loc = null) {
|
|
651
|
-
super('RescueClause', loc)
|
|
652
|
-
this.exceptionTypes = exceptionTypes
|
|
653
|
-
this.variable = variable
|
|
654
|
-
this.body = body
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
class EnsureClause extends ASTNode {
|
|
659
|
-
constructor(body = [], loc = null) {
|
|
660
|
-
super('EnsureClause', loc)
|
|
661
|
-
this.body = body
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
class RaiseStatement extends ASTNode {
|
|
666
|
-
constructor(exception = null, message = null, backtrace = null, loc = null) {
|
|
667
|
-
super('RaiseStatement', loc)
|
|
668
|
-
this.exception = exception
|
|
669
|
-
this.message = message
|
|
670
|
-
this.backtrace = backtrace
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
class RescueModifier extends ASTNode {
|
|
675
|
-
constructor(expression, rescue, loc = null) {
|
|
676
|
-
super('RescueModifier', loc)
|
|
677
|
-
this.expression = expression
|
|
678
|
-
this.rescue = rescue
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
class RequireStatement extends ASTNode {
|
|
683
|
-
constructor(path, relative = false, loc = null) {
|
|
684
|
-
super('RequireStatement', loc)
|
|
685
|
-
this.path = path
|
|
686
|
-
this.relative = relative
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
class LoadStatement extends ASTNode {
|
|
691
|
-
constructor(path, wrap = false, loc = null) {
|
|
692
|
-
super('LoadStatement', loc)
|
|
693
|
-
this.path = path
|
|
694
|
-
this.wrap = wrap
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
class BeginStatement extends ASTNode {
|
|
699
|
-
constructor(body = [], loc = null) {
|
|
700
|
-
super('BeginStatement', loc)
|
|
701
|
-
this.body = body
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
class EndStatement extends ASTNode {
|
|
706
|
-
constructor(body = [], loc = null) {
|
|
707
|
-
super('EndStatement', loc)
|
|
708
|
-
this.body = body
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
class ExpressionStatement extends ASTNode {
|
|
713
|
-
constructor(expression, loc = null) {
|
|
714
|
-
super('ExpressionStatement', loc)
|
|
715
|
-
this.expression = expression
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
class FlipFlop extends ASTNode {
|
|
720
|
-
constructor(start, end, exclusive = false, loc = null) {
|
|
721
|
-
super('FlipFlop', loc)
|
|
722
|
-
this.start = start
|
|
723
|
-
this.end = end
|
|
724
|
-
this.exclusive = exclusive
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
class MatchExpression extends ASTNode {
|
|
729
|
-
constructor(left, right, loc = null) {
|
|
730
|
-
super('MatchExpression', loc)
|
|
731
|
-
this.left = left
|
|
732
|
-
this.right = right
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
class NotMatchExpression extends ASTNode {
|
|
737
|
-
constructor(left, right, loc = null) {
|
|
738
|
-
super('NotMatchExpression', loc)
|
|
739
|
-
this.left = left
|
|
740
|
-
this.right = right
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
class BacktickLiteral extends ASTNode {
|
|
745
|
-
constructor(command, loc = null) {
|
|
746
|
-
super('BacktickLiteral', loc)
|
|
747
|
-
this.command = command
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
class ParenthesizedExpression extends ASTNode {
|
|
752
|
-
constructor(expression, loc = null) {
|
|
753
|
-
super('ParenthesizedExpression', loc)
|
|
754
|
-
this.expression = expression
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
class SafeNavigationCall extends ASTNode {
|
|
759
|
-
constructor(object, method, arguments_ = [], block = null, loc = null) {
|
|
760
|
-
super('SafeNavigationCall', loc)
|
|
761
|
-
this.object = object
|
|
762
|
-
this.method = method
|
|
763
|
-
this.arguments = arguments_
|
|
764
|
-
this.block = block
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
class Encoding extends ASTNode {
|
|
769
|
-
constructor(loc = null) {
|
|
770
|
-
super('Encoding', loc)
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
class File extends ASTNode {
|
|
775
|
-
constructor(loc = null) {
|
|
776
|
-
super('File', loc)
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
class Line extends ASTNode {
|
|
781
|
-
constructor(loc = null) {
|
|
782
|
-
super('Line', loc)
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
class EtherNaturalExpression extends ASTNode {
|
|
787
|
-
constructor(original, translated, loc = null) {
|
|
788
|
-
super('EtherNaturalExpression', loc)
|
|
789
|
-
this.original = original
|
|
790
|
-
this.translated = translated
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
module.exports = {
|
|
795
|
-
ASTNode,
|
|
796
|
-
Program,
|
|
797
|
-
Identifier,
|
|
798
|
-
InstanceVariable,
|
|
799
|
-
ClassVariable,
|
|
800
|
-
GlobalVariable,
|
|
801
|
-
Constant,
|
|
802
|
-
ScopedConstant,
|
|
803
|
-
Symbol,
|
|
804
|
-
StringLiteral,
|
|
805
|
-
InterpolatedString,
|
|
806
|
-
StringPart,
|
|
807
|
-
InterpolationPart,
|
|
808
|
-
NumericLiteral,
|
|
809
|
-
FloatLiteral,
|
|
810
|
-
RationalLiteral,
|
|
811
|
-
ComplexLiteral,
|
|
812
|
-
BooleanLiteral,
|
|
813
|
-
NilLiteral,
|
|
814
|
-
ArrayLiteral,
|
|
815
|
-
HashLiteral,
|
|
816
|
-
HashPair,
|
|
817
|
-
RangeLiteral,
|
|
818
|
-
RegexpLiteral,
|
|
819
|
-
PercentArray,
|
|
820
|
-
HeredocLiteral,
|
|
821
|
-
BinaryExpression,
|
|
822
|
-
UnaryExpression,
|
|
823
|
-
AssignmentExpression,
|
|
824
|
-
MultipleAssignment,
|
|
825
|
-
SplatExpression,
|
|
826
|
-
DoubleSplatExpression,
|
|
827
|
-
ConditionalExpression,
|
|
828
|
-
LogicalExpression,
|
|
829
|
-
MethodCall,
|
|
830
|
-
IndexAccess,
|
|
831
|
-
IndexAssignment,
|
|
832
|
-
AttributeAccess,
|
|
833
|
-
AttributeAssignment,
|
|
834
|
-
SuperCall,
|
|
835
|
-
YieldExpression,
|
|
836
|
-
SelfExpression,
|
|
837
|
-
DefinedExpression,
|
|
838
|
-
NotExpression,
|
|
839
|
-
Block,
|
|
840
|
-
BlockParameter,
|
|
841
|
-
ProcLiteral,
|
|
842
|
-
LambdaLiteral,
|
|
843
|
-
MethodDefinition,
|
|
844
|
-
MethodParameter,
|
|
845
|
-
ClassDefinition,
|
|
846
|
-
SingletonClass,
|
|
847
|
-
ModuleDefinition,
|
|
848
|
-
IncludeStatement,
|
|
849
|
-
ExtendStatement,
|
|
850
|
-
PrependStatement,
|
|
851
|
-
AttrAccessor,
|
|
852
|
-
AliasStatement,
|
|
853
|
-
UndefStatement,
|
|
854
|
-
IfStatement,
|
|
855
|
-
UnlessStatement,
|
|
856
|
-
ElsifClause,
|
|
857
|
-
CaseStatement,
|
|
858
|
-
WhenClause,
|
|
859
|
-
CaseInStatement,
|
|
860
|
-
InClause,
|
|
861
|
-
ArrayPattern,
|
|
862
|
-
HashPattern,
|
|
863
|
-
AlternativePattern,
|
|
864
|
-
AsPattern,
|
|
865
|
-
PinExpression,
|
|
866
|
-
WhileStatement,
|
|
867
|
-
UntilStatement,
|
|
868
|
-
ForStatement,
|
|
869
|
-
LoopStatement,
|
|
870
|
-
BreakStatement,
|
|
871
|
-
NextStatement,
|
|
872
|
-
RedoStatement,
|
|
873
|
-
RetryStatement,
|
|
874
|
-
ReturnStatement,
|
|
875
|
-
BeginBlock,
|
|
876
|
-
RescueClause,
|
|
877
|
-
EnsureClause,
|
|
878
|
-
RaiseStatement,
|
|
879
|
-
RescueModifier,
|
|
880
|
-
RequireStatement,
|
|
881
|
-
LoadStatement,
|
|
882
|
-
BeginStatement,
|
|
883
|
-
EndStatement,
|
|
884
|
-
ExpressionStatement,
|
|
885
|
-
FlipFlop,
|
|
886
|
-
MatchExpression,
|
|
887
|
-
NotMatchExpression,
|
|
888
|
-
BacktickLiteral,
|
|
889
|
-
ParenthesizedExpression,
|
|
890
|
-
SafeNavigationCall,
|
|
891
|
-
Encoding,
|
|
892
|
-
File,
|
|
893
|
-
Line,
|
|
894
|
-
EtherNaturalExpression
|
|
895
|
-
}
|