ether-code 0.1.6 → 0.1.8

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.
Files changed (45) hide show
  1. package/cli/compiler.js +9 -53
  2. package/cli/ether.js +1 -1
  3. package/generators/css-generator.js +42 -55
  4. package/generators/graphql-generator.js +19 -22
  5. package/generators/html-generator.js +51 -220
  6. package/generators/js-generator.js +76 -157
  7. package/generators/node-generator.js +49 -93
  8. package/generators/php-generator.js +46 -68
  9. package/generators/python-generator.js +35 -54
  10. package/generators/react-generator.js +37 -47
  11. package/generators/ruby-generator.js +59 -119
  12. package/generators/sql-generator.js +42 -63
  13. package/generators/ts-generator.js +59 -133
  14. package/i18n/i18n-css.json +147 -147
  15. package/i18n/i18n-graphql.json +6 -6
  16. package/i18n/i18n-html.json +135 -135
  17. package/i18n/i18n-js.json +107 -107
  18. package/i18n/i18n-node.json +14 -14
  19. package/i18n/i18n-php.json +177 -177
  20. package/i18n/i18n-python.json +16 -16
  21. package/i18n/i18n-react.json +97 -97
  22. package/i18n/i18n-ruby.json +22 -22
  23. package/i18n/i18n-sql.json +153 -153
  24. package/i18n/i18n-ts.json +10 -10
  25. package/lexer/ether-lexer.js +175 -34
  26. package/lexer/tokens.js +6 -6
  27. package/package.json +1 -1
  28. package/parsers/ast-css.js +0 -545
  29. package/parsers/ast-graphql.js +0 -424
  30. package/parsers/ast-html.js +0 -886
  31. package/parsers/ast-js.js +0 -750
  32. package/parsers/ast-node.js +0 -2440
  33. package/parsers/ast-php.js +0 -957
  34. package/parsers/ast-react.js +0 -580
  35. package/parsers/ast-ruby.js +0 -895
  36. package/parsers/ast-ts.js +0 -1352
  37. package/parsers/css-parser.js +0 -1981
  38. package/parsers/graphql-parser.js +0 -2011
  39. package/parsers/html-parser.js +0 -1182
  40. package/parsers/js-parser.js +0 -2564
  41. package/parsers/node-parser.js +0 -2644
  42. package/parsers/php-parser.js +0 -3037
  43. package/parsers/react-parser.js +0 -1035
  44. package/parsers/ruby-parser.js +0 -2680
  45. package/parsers/ts-parser.js +0 -3881
package/parsers/ast-ts.js DELETED
@@ -1,1352 +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 StringLiteral extends ASTNode {
23
- constructor(value, raw = null, loc = null) {
24
- super('StringLiteral', loc)
25
- this.value = value
26
- this.raw = raw || `"${value}"`
27
- }
28
- }
29
-
30
- class NumericLiteral extends ASTNode {
31
- constructor(value, raw = null, loc = null) {
32
- super('NumericLiteral', loc)
33
- this.value = value
34
- this.raw = raw || String(value)
35
- }
36
- }
37
-
38
- class BooleanLiteral extends ASTNode {
39
- constructor(value, loc = null) {
40
- super('BooleanLiteral', loc)
41
- this.value = value
42
- }
43
- }
44
-
45
- class NullLiteral extends ASTNode {
46
- constructor(loc = null) {
47
- super('NullLiteral', loc)
48
- this.value = null
49
- }
50
- }
51
-
52
- class UndefinedLiteral extends ASTNode {
53
- constructor(loc = null) {
54
- super('UndefinedLiteral', loc)
55
- }
56
- }
57
-
58
- class BigIntLiteral extends ASTNode {
59
- constructor(value, raw = null, loc = null) {
60
- super('BigIntLiteral', loc)
61
- this.value = value
62
- this.raw = raw
63
- }
64
- }
65
-
66
- class TemplateLiteral extends ASTNode {
67
- constructor(quasis = [], expressions = [], loc = null) {
68
- super('TemplateLiteral', loc)
69
- this.quasis = quasis
70
- this.expressions = expressions
71
- }
72
- }
73
-
74
- class TemplateElement extends ASTNode {
75
- constructor(value, tail = false, loc = null) {
76
- super('TemplateElement', loc)
77
- this.value = value
78
- this.tail = tail
79
- }
80
- }
81
-
82
- class RegExpLiteral extends ASTNode {
83
- constructor(pattern, flags = '', loc = null) {
84
- super('RegExpLiteral', loc)
85
- this.pattern = pattern
86
- this.flags = flags
87
- }
88
- }
89
-
90
- class ArrayExpression extends ASTNode {
91
- constructor(elements = [], loc = null) {
92
- super('ArrayExpression', loc)
93
- this.elements = elements
94
- }
95
- }
96
-
97
- class ObjectExpression extends ASTNode {
98
- constructor(properties = [], loc = null) {
99
- super('ObjectExpression', loc)
100
- this.properties = properties
101
- }
102
- }
103
-
104
- class Property extends ASTNode {
105
- constructor(key, value, kind = 'init', computed = false, shorthand = false, method = false, loc = null) {
106
- super('Property', loc)
107
- this.key = key
108
- this.value = value
109
- this.kind = kind
110
- this.computed = computed
111
- this.shorthand = shorthand
112
- this.method = method
113
- }
114
- }
115
-
116
- class SpreadElement extends ASTNode {
117
- constructor(argument, loc = null) {
118
- super('SpreadElement', loc)
119
- this.argument = argument
120
- }
121
- }
122
-
123
- class BinaryExpression extends ASTNode {
124
- constructor(operator, left, right, loc = null) {
125
- super('BinaryExpression', loc)
126
- this.operator = operator
127
- this.left = left
128
- this.right = right
129
- }
130
- }
131
-
132
- class UnaryExpression extends ASTNode {
133
- constructor(operator, argument, prefix = true, loc = null) {
134
- super('UnaryExpression', loc)
135
- this.operator = operator
136
- this.argument = argument
137
- this.prefix = prefix
138
- }
139
- }
140
-
141
- class UpdateExpression extends ASTNode {
142
- constructor(operator, argument, prefix = true, loc = null) {
143
- super('UpdateExpression', loc)
144
- this.operator = operator
145
- this.argument = argument
146
- this.prefix = prefix
147
- }
148
- }
149
-
150
- class AssignmentExpression extends ASTNode {
151
- constructor(operator, left, right, loc = null) {
152
- super('AssignmentExpression', loc)
153
- this.operator = operator
154
- this.left = left
155
- this.right = right
156
- }
157
- }
158
-
159
- class LogicalExpression extends ASTNode {
160
- constructor(operator, left, right, loc = null) {
161
- super('LogicalExpression', loc)
162
- this.operator = operator
163
- this.left = left
164
- this.right = right
165
- }
166
- }
167
-
168
- class ConditionalExpression extends ASTNode {
169
- constructor(test, consequent, alternate, loc = null) {
170
- super('ConditionalExpression', loc)
171
- this.test = test
172
- this.consequent = consequent
173
- this.alternate = alternate
174
- }
175
- }
176
-
177
- class CallExpression extends ASTNode {
178
- constructor(callee, arguments_ = [], optional = false, loc = null) {
179
- super('CallExpression', loc)
180
- this.callee = callee
181
- this.arguments = arguments_
182
- this.optional = optional
183
- }
184
- }
185
-
186
- class NewExpression extends ASTNode {
187
- constructor(callee, arguments_ = [], loc = null) {
188
- super('NewExpression', loc)
189
- this.callee = callee
190
- this.arguments = arguments_
191
- }
192
- }
193
-
194
- class MemberExpression extends ASTNode {
195
- constructor(object, property, computed = false, optional = false, loc = null) {
196
- super('MemberExpression', loc)
197
- this.object = object
198
- this.property = property
199
- this.computed = computed
200
- this.optional = optional
201
- }
202
- }
203
-
204
- class SequenceExpression extends ASTNode {
205
- constructor(expressions = [], loc = null) {
206
- super('SequenceExpression', loc)
207
- this.expressions = expressions
208
- }
209
- }
210
-
211
- class ArrowFunctionExpression extends ASTNode {
212
- constructor(params = [], body, async = false, expression = false, returnType = null, typeParameters = null, loc = null) {
213
- super('ArrowFunctionExpression', loc)
214
- this.params = params
215
- this.body = body
216
- this.async = async
217
- this.expression = expression
218
- this.returnType = returnType
219
- this.typeParameters = typeParameters
220
- }
221
- }
222
-
223
- class FunctionExpression extends ASTNode {
224
- constructor(id, params = [], body, async = false, generator = false, returnType = null, typeParameters = null, loc = null) {
225
- super('FunctionExpression', loc)
226
- this.id = id
227
- this.params = params
228
- this.body = body
229
- this.async = async
230
- this.generator = generator
231
- this.returnType = returnType
232
- this.typeParameters = typeParameters
233
- }
234
- }
235
-
236
- class FunctionDeclaration extends ASTNode {
237
- constructor(id, params = [], body, async = false, generator = false, returnType = null, typeParameters = null, loc = null) {
238
- super('FunctionDeclaration', loc)
239
- this.id = id
240
- this.params = params
241
- this.body = body
242
- this.async = async
243
- this.generator = generator
244
- this.returnType = returnType
245
- this.typeParameters = typeParameters
246
- }
247
- }
248
-
249
- class VariableDeclaration extends ASTNode {
250
- constructor(kind, declarations = [], loc = null) {
251
- super('VariableDeclaration', loc)
252
- this.kind = kind
253
- this.declarations = declarations
254
- }
255
- }
256
-
257
- class VariableDeclarator extends ASTNode {
258
- constructor(id, init = null, loc = null) {
259
- super('VariableDeclarator', loc)
260
- this.id = id
261
- this.init = init
262
- }
263
- }
264
-
265
- class ClassDeclaration extends ASTNode {
266
- constructor(id, body, superClass = null, implements_ = [], decorators = [], abstract = false, typeParameters = null, superTypeParameters = null, loc = null) {
267
- super('ClassDeclaration', loc)
268
- this.id = id
269
- this.body = body
270
- this.superClass = superClass
271
- this.implements = implements_
272
- this.decorators = decorators
273
- this.abstract = abstract
274
- this.typeParameters = typeParameters
275
- this.superTypeParameters = superTypeParameters
276
- }
277
- }
278
-
279
- class ClassExpression extends ASTNode {
280
- constructor(id, body, superClass = null, implements_ = [], decorators = [], abstract = false, typeParameters = null, loc = null) {
281
- super('ClassExpression', loc)
282
- this.id = id
283
- this.body = body
284
- this.superClass = superClass
285
- this.implements = implements_
286
- this.decorators = decorators
287
- this.abstract = abstract
288
- this.typeParameters = typeParameters
289
- }
290
- }
291
-
292
- class ClassBody extends ASTNode {
293
- constructor(body = [], loc = null) {
294
- super('ClassBody', loc)
295
- this.body = body
296
- }
297
- }
298
-
299
- class MethodDefinition extends ASTNode {
300
- constructor(key, value, kind = 'method', computed = false, isStatic = false, accessibility = null, abstract = false, override = false, decorators = [], loc = null) {
301
- super('MethodDefinition', loc)
302
- this.key = key
303
- this.value = value
304
- this.kind = kind
305
- this.computed = computed
306
- this.static = isStatic
307
- this.accessibility = accessibility
308
- this.abstract = abstract
309
- this.override = override
310
- this.decorators = decorators
311
- }
312
- }
313
-
314
- class PropertyDefinition extends ASTNode {
315
- constructor(key, value = null, computed = false, isStatic = false, accessibility = null, readonly = false, abstract = false, override = false, optional = false, definite = false, typeAnnotation = null, decorators = [], loc = null) {
316
- super('PropertyDefinition', loc)
317
- this.key = key
318
- this.value = value
319
- this.computed = computed
320
- this.static = isStatic
321
- this.accessibility = accessibility
322
- this.readonly = readonly
323
- this.abstract = abstract
324
- this.override = override
325
- this.optional = optional
326
- this.definite = definite
327
- this.typeAnnotation = typeAnnotation
328
- this.decorators = decorators
329
- }
330
- }
331
-
332
- class StaticBlock extends ASTNode {
333
- constructor(body = [], loc = null) {
334
- super('StaticBlock', loc)
335
- this.body = body
336
- }
337
- }
338
-
339
- class PrivateIdentifier extends ASTNode {
340
- constructor(name, loc = null) {
341
- super('PrivateIdentifier', loc)
342
- this.name = name
343
- }
344
- }
345
-
346
- class BlockStatement extends ASTNode {
347
- constructor(body = [], loc = null) {
348
- super('BlockStatement', loc)
349
- this.body = body
350
- }
351
- }
352
-
353
- class ExpressionStatement extends ASTNode {
354
- constructor(expression, loc = null) {
355
- super('ExpressionStatement', loc)
356
- this.expression = expression
357
- }
358
- }
359
-
360
- class EmptyStatement extends ASTNode {
361
- constructor(loc = null) {
362
- super('EmptyStatement', loc)
363
- }
364
- }
365
-
366
- class IfStatement extends ASTNode {
367
- constructor(test, consequent, alternate = null, loc = null) {
368
- super('IfStatement', loc)
369
- this.test = test
370
- this.consequent = consequent
371
- this.alternate = alternate
372
- }
373
- }
374
-
375
- class SwitchStatement extends ASTNode {
376
- constructor(discriminant, cases = [], loc = null) {
377
- super('SwitchStatement', loc)
378
- this.discriminant = discriminant
379
- this.cases = cases
380
- }
381
- }
382
-
383
- class SwitchCase extends ASTNode {
384
- constructor(test, consequent = [], loc = null) {
385
- super('SwitchCase', loc)
386
- this.test = test
387
- this.consequent = consequent
388
- }
389
- }
390
-
391
- class ForStatement extends ASTNode {
392
- constructor(init, test, update, body, loc = null) {
393
- super('ForStatement', loc)
394
- this.init = init
395
- this.test = test
396
- this.update = update
397
- this.body = body
398
- }
399
- }
400
-
401
- class ForInStatement extends ASTNode {
402
- constructor(left, right, body, loc = null) {
403
- super('ForInStatement', loc)
404
- this.left = left
405
- this.right = right
406
- this.body = body
407
- }
408
- }
409
-
410
- class ForOfStatement extends ASTNode {
411
- constructor(left, right, body, await_ = false, loc = null) {
412
- super('ForOfStatement', loc)
413
- this.left = left
414
- this.right = right
415
- this.body = body
416
- this.await = await_
417
- }
418
- }
419
-
420
- class WhileStatement extends ASTNode {
421
- constructor(test, body, loc = null) {
422
- super('WhileStatement', loc)
423
- this.test = test
424
- this.body = body
425
- }
426
- }
427
-
428
- class DoWhileStatement extends ASTNode {
429
- constructor(body, test, loc = null) {
430
- super('DoWhileStatement', loc)
431
- this.body = body
432
- this.test = test
433
- }
434
- }
435
-
436
- class BreakStatement extends ASTNode {
437
- constructor(label = null, loc = null) {
438
- super('BreakStatement', loc)
439
- this.label = label
440
- }
441
- }
442
-
443
- class ContinueStatement extends ASTNode {
444
- constructor(label = null, loc = null) {
445
- super('ContinueStatement', loc)
446
- this.label = label
447
- }
448
- }
449
-
450
- class ReturnStatement extends ASTNode {
451
- constructor(argument = null, loc = null) {
452
- super('ReturnStatement', loc)
453
- this.argument = argument
454
- }
455
- }
456
-
457
- class ThrowStatement extends ASTNode {
458
- constructor(argument, loc = null) {
459
- super('ThrowStatement', loc)
460
- this.argument = argument
461
- }
462
- }
463
-
464
- class TryStatement extends ASTNode {
465
- constructor(block, handler = null, finalizer = null, loc = null) {
466
- super('TryStatement', loc)
467
- this.block = block
468
- this.handler = handler
469
- this.finalizer = finalizer
470
- }
471
- }
472
-
473
- class CatchClause extends ASTNode {
474
- constructor(param, body, loc = null) {
475
- super('CatchClause', loc)
476
- this.param = param
477
- this.body = body
478
- }
479
- }
480
-
481
- class LabeledStatement extends ASTNode {
482
- constructor(label, body, loc = null) {
483
- super('LabeledStatement', loc)
484
- this.label = label
485
- this.body = body
486
- }
487
- }
488
-
489
- class WithStatement extends ASTNode {
490
- constructor(object, body, loc = null) {
491
- super('WithStatement', loc)
492
- this.object = object
493
- this.body = body
494
- }
495
- }
496
-
497
- class DebuggerStatement extends ASTNode {
498
- constructor(loc = null) {
499
- super('DebuggerStatement', loc)
500
- }
501
- }
502
-
503
- class ImportDeclaration extends ASTNode {
504
- constructor(specifiers = [], source, importKind = 'value', loc = null) {
505
- super('ImportDeclaration', loc)
506
- this.specifiers = specifiers
507
- this.source = source
508
- this.importKind = importKind
509
- }
510
- }
511
-
512
- class ImportSpecifier extends ASTNode {
513
- constructor(imported, local, importKind = 'value', loc = null) {
514
- super('ImportSpecifier', loc)
515
- this.imported = imported
516
- this.local = local
517
- this.importKind = importKind
518
- }
519
- }
520
-
521
- class ImportDefaultSpecifier extends ASTNode {
522
- constructor(local, loc = null) {
523
- super('ImportDefaultSpecifier', loc)
524
- this.local = local
525
- }
526
- }
527
-
528
- class ImportNamespaceSpecifier extends ASTNode {
529
- constructor(local, loc = null) {
530
- super('ImportNamespaceSpecifier', loc)
531
- this.local = local
532
- }
533
- }
534
-
535
- class ExportNamedDeclaration extends ASTNode {
536
- constructor(declaration, specifiers = [], source = null, exportKind = 'value', loc = null) {
537
- super('ExportNamedDeclaration', loc)
538
- this.declaration = declaration
539
- this.specifiers = specifiers
540
- this.source = source
541
- this.exportKind = exportKind
542
- }
543
- }
544
-
545
- class ExportDefaultDeclaration extends ASTNode {
546
- constructor(declaration, loc = null) {
547
- super('ExportDefaultDeclaration', loc)
548
- this.declaration = declaration
549
- }
550
- }
551
-
552
- class ExportAllDeclaration extends ASTNode {
553
- constructor(source, exported = null, exportKind = 'value', loc = null) {
554
- super('ExportAllDeclaration', loc)
555
- this.source = source
556
- this.exported = exported
557
- this.exportKind = exportKind
558
- }
559
- }
560
-
561
- class ExportSpecifier extends ASTNode {
562
- constructor(local, exported, exportKind = 'value', loc = null) {
563
- super('ExportSpecifier', loc)
564
- this.local = local
565
- this.exported = exported
566
- this.exportKind = exportKind
567
- }
568
- }
569
-
570
- class AwaitExpression extends ASTNode {
571
- constructor(argument, loc = null) {
572
- super('AwaitExpression', loc)
573
- this.argument = argument
574
- }
575
- }
576
-
577
- class YieldExpression extends ASTNode {
578
- constructor(argument = null, delegate = false, loc = null) {
579
- super('YieldExpression', loc)
580
- this.argument = argument
581
- this.delegate = delegate
582
- }
583
- }
584
-
585
- class ThisExpression extends ASTNode {
586
- constructor(loc = null) {
587
- super('ThisExpression', loc)
588
- }
589
- }
590
-
591
- class Super extends ASTNode {
592
- constructor(loc = null) {
593
- super('Super', loc)
594
- }
595
- }
596
-
597
- class MetaProperty extends ASTNode {
598
- constructor(meta, property, loc = null) {
599
- super('MetaProperty', loc)
600
- this.meta = meta
601
- this.property = property
602
- }
603
- }
604
-
605
- class TaggedTemplateExpression extends ASTNode {
606
- constructor(tag, quasi, loc = null) {
607
- super('TaggedTemplateExpression', loc)
608
- this.tag = tag
609
- this.quasi = quasi
610
- }
611
- }
612
-
613
- class ChainExpression extends ASTNode {
614
- constructor(expression, loc = null) {
615
- super('ChainExpression', loc)
616
- this.expression = expression
617
- }
618
- }
619
-
620
- class ImportExpression extends ASTNode {
621
- constructor(source, loc = null) {
622
- super('ImportExpression', loc)
623
- this.source = source
624
- }
625
- }
626
-
627
- class AssignmentPattern extends ASTNode {
628
- constructor(left, right, loc = null) {
629
- super('AssignmentPattern', loc)
630
- this.left = left
631
- this.right = right
632
- }
633
- }
634
-
635
- class ArrayPattern extends ASTNode {
636
- constructor(elements = [], typeAnnotation = null, loc = null) {
637
- super('ArrayPattern', loc)
638
- this.elements = elements
639
- this.typeAnnotation = typeAnnotation
640
- }
641
- }
642
-
643
- class ObjectPattern extends ASTNode {
644
- constructor(properties = [], typeAnnotation = null, loc = null) {
645
- super('ObjectPattern', loc)
646
- this.properties = properties
647
- this.typeAnnotation = typeAnnotation
648
- }
649
- }
650
-
651
- class RestElement extends ASTNode {
652
- constructor(argument, typeAnnotation = null, loc = null) {
653
- super('RestElement', loc)
654
- this.argument = argument
655
- this.typeAnnotation = typeAnnotation
656
- }
657
- }
658
-
659
- class TSTypeAnnotation extends ASTNode {
660
- constructor(typeAnnotation, loc = null) {
661
- super('TSTypeAnnotation', loc)
662
- this.typeAnnotation = typeAnnotation
663
- }
664
- }
665
-
666
- class TSTypeParameterDeclaration extends ASTNode {
667
- constructor(params = [], loc = null) {
668
- super('TSTypeParameterDeclaration', loc)
669
- this.params = params
670
- }
671
- }
672
-
673
- class TSTypeParameter extends ASTNode {
674
- constructor(name, constraint = null, default_ = null, in_ = false, out = false, const_ = false, loc = null) {
675
- super('TSTypeParameter', loc)
676
- this.name = name
677
- this.constraint = constraint
678
- this.default = default_
679
- this.in = in_
680
- this.out = out
681
- this.const = const_
682
- }
683
- }
684
-
685
- class TSTypeParameterInstantiation extends ASTNode {
686
- constructor(params = [], loc = null) {
687
- super('TSTypeParameterInstantiation', loc)
688
- this.params = params
689
- }
690
- }
691
-
692
- class TSTypeReference extends ASTNode {
693
- constructor(typeName, typeParameters = null, loc = null) {
694
- super('TSTypeReference', loc)
695
- this.typeName = typeName
696
- this.typeParameters = typeParameters
697
- }
698
- }
699
-
700
- class TSQualifiedName extends ASTNode {
701
- constructor(left, right, loc = null) {
702
- super('TSQualifiedName', loc)
703
- this.left = left
704
- this.right = right
705
- }
706
- }
707
-
708
- class TSStringKeyword extends ASTNode {
709
- constructor(loc = null) {
710
- super('TSStringKeyword', loc)
711
- }
712
- }
713
-
714
- class TSNumberKeyword extends ASTNode {
715
- constructor(loc = null) {
716
- super('TSNumberKeyword', loc)
717
- }
718
- }
719
-
720
- class TSBooleanKeyword extends ASTNode {
721
- constructor(loc = null) {
722
- super('TSBooleanKeyword', loc)
723
- }
724
- }
725
-
726
- class TSBigIntKeyword extends ASTNode {
727
- constructor(loc = null) {
728
- super('TSBigIntKeyword', loc)
729
- }
730
- }
731
-
732
- class TSSymbolKeyword extends ASTNode {
733
- constructor(loc = null) {
734
- super('TSSymbolKeyword', loc)
735
- }
736
- }
737
-
738
- class TSObjectKeyword extends ASTNode {
739
- constructor(loc = null) {
740
- super('TSObjectKeyword', loc)
741
- }
742
- }
743
-
744
- class TSAnyKeyword extends ASTNode {
745
- constructor(loc = null) {
746
- super('TSAnyKeyword', loc)
747
- }
748
- }
749
-
750
- class TSUnknownKeyword extends ASTNode {
751
- constructor(loc = null) {
752
- super('TSUnknownKeyword', loc)
753
- }
754
- }
755
-
756
- class TSNeverKeyword extends ASTNode {
757
- constructor(loc = null) {
758
- super('TSNeverKeyword', loc)
759
- }
760
- }
761
-
762
- class TSVoidKeyword extends ASTNode {
763
- constructor(loc = null) {
764
- super('TSVoidKeyword', loc)
765
- }
766
- }
767
-
768
- class TSUndefinedKeyword extends ASTNode {
769
- constructor(loc = null) {
770
- super('TSUndefinedKeyword', loc)
771
- }
772
- }
773
-
774
- class TSNullKeyword extends ASTNode {
775
- constructor(loc = null) {
776
- super('TSNullKeyword', loc)
777
- }
778
- }
779
-
780
- class TSThisType extends ASTNode {
781
- constructor(loc = null) {
782
- super('TSThisType', loc)
783
- }
784
- }
785
-
786
- class TSArrayType extends ASTNode {
787
- constructor(elementType, loc = null) {
788
- super('TSArrayType', loc)
789
- this.elementType = elementType
790
- }
791
- }
792
-
793
- class TSTupleType extends ASTNode {
794
- constructor(elementTypes = [], loc = null) {
795
- super('TSTupleType', loc)
796
- this.elementTypes = elementTypes
797
- }
798
- }
799
-
800
- class TSNamedTupleMember extends ASTNode {
801
- constructor(label, elementType, optional = false, loc = null) {
802
- super('TSNamedTupleMember', loc)
803
- this.label = label
804
- this.elementType = elementType
805
- this.optional = optional
806
- }
807
- }
808
-
809
- class TSOptionalType extends ASTNode {
810
- constructor(typeAnnotation, loc = null) {
811
- super('TSOptionalType', loc)
812
- this.typeAnnotation = typeAnnotation
813
- }
814
- }
815
-
816
- class TSRestType extends ASTNode {
817
- constructor(typeAnnotation, loc = null) {
818
- super('TSRestType', loc)
819
- this.typeAnnotation = typeAnnotation
820
- }
821
- }
822
-
823
- class TSUnionType extends ASTNode {
824
- constructor(types = [], loc = null) {
825
- super('TSUnionType', loc)
826
- this.types = types
827
- }
828
- }
829
-
830
- class TSIntersectionType extends ASTNode {
831
- constructor(types = [], loc = null) {
832
- super('TSIntersectionType', loc)
833
- this.types = types
834
- }
835
- }
836
-
837
- class TSParenthesizedType extends ASTNode {
838
- constructor(typeAnnotation, loc = null) {
839
- super('TSParenthesizedType', loc)
840
- this.typeAnnotation = typeAnnotation
841
- }
842
- }
843
-
844
- class TSTypeLiteral extends ASTNode {
845
- constructor(members = [], loc = null) {
846
- super('TSTypeLiteral', loc)
847
- this.members = members
848
- }
849
- }
850
-
851
- class TSPropertySignature extends ASTNode {
852
- constructor(key, typeAnnotation = null, computed = false, optional = false, readonly = false, loc = null) {
853
- super('TSPropertySignature', loc)
854
- this.key = key
855
- this.typeAnnotation = typeAnnotation
856
- this.computed = computed
857
- this.optional = optional
858
- this.readonly = readonly
859
- }
860
- }
861
-
862
- class TSMethodSignature extends ASTNode {
863
- constructor(key, params = [], returnType = null, computed = false, optional = false, typeParameters = null, loc = null) {
864
- super('TSMethodSignature', loc)
865
- this.key = key
866
- this.params = params
867
- this.returnType = returnType
868
- this.computed = computed
869
- this.optional = optional
870
- this.typeParameters = typeParameters
871
- }
872
- }
873
-
874
- class TSIndexSignature extends ASTNode {
875
- constructor(parameters = [], typeAnnotation = null, readonly = false, isStatic = false, loc = null) {
876
- super('TSIndexSignature', loc)
877
- this.parameters = parameters
878
- this.typeAnnotation = typeAnnotation
879
- this.readonly = readonly
880
- this.static = isStatic
881
- }
882
- }
883
-
884
- class TSCallSignatureDeclaration extends ASTNode {
885
- constructor(params = [], returnType = null, typeParameters = null, loc = null) {
886
- super('TSCallSignatureDeclaration', loc)
887
- this.params = params
888
- this.returnType = returnType
889
- this.typeParameters = typeParameters
890
- }
891
- }
892
-
893
- class TSConstructSignatureDeclaration extends ASTNode {
894
- constructor(params = [], returnType = null, typeParameters = null, loc = null) {
895
- super('TSConstructSignatureDeclaration', loc)
896
- this.params = params
897
- this.returnType = returnType
898
- this.typeParameters = typeParameters
899
- }
900
- }
901
-
902
- class TSFunctionType extends ASTNode {
903
- constructor(params = [], returnType = null, typeParameters = null, loc = null) {
904
- super('TSFunctionType', loc)
905
- this.params = params
906
- this.returnType = returnType
907
- this.typeParameters = typeParameters
908
- }
909
- }
910
-
911
- class TSConstructorType extends ASTNode {
912
- constructor(params = [], returnType = null, typeParameters = null, abstract = false, loc = null) {
913
- super('TSConstructorType', loc)
914
- this.params = params
915
- this.returnType = returnType
916
- this.typeParameters = typeParameters
917
- this.abstract = abstract
918
- }
919
- }
920
-
921
- class TSConditionalType extends ASTNode {
922
- constructor(checkType, extendsType, trueType, falseType, loc = null) {
923
- super('TSConditionalType', loc)
924
- this.checkType = checkType
925
- this.extendsType = extendsType
926
- this.trueType = trueType
927
- this.falseType = falseType
928
- }
929
- }
930
-
931
- class TSInferType extends ASTNode {
932
- constructor(typeParameter, loc = null) {
933
- super('TSInferType', loc)
934
- this.typeParameter = typeParameter
935
- }
936
- }
937
-
938
- class TSMappedType extends ASTNode {
939
- constructor(typeParameter, typeAnnotation = null, nameType = null, optional = null, readonly = null, loc = null) {
940
- super('TSMappedType', loc)
941
- this.typeParameter = typeParameter
942
- this.typeAnnotation = typeAnnotation
943
- this.nameType = nameType
944
- this.optional = optional
945
- this.readonly = readonly
946
- }
947
- }
948
-
949
- class TSIndexedAccessType extends ASTNode {
950
- constructor(objectType, indexType, loc = null) {
951
- super('TSIndexedAccessType', loc)
952
- this.objectType = objectType
953
- this.indexType = indexType
954
- }
955
- }
956
-
957
- class TSTypeOperator extends ASTNode {
958
- constructor(operator, typeAnnotation, loc = null) {
959
- super('TSTypeOperator', loc)
960
- this.operator = operator
961
- this.typeAnnotation = typeAnnotation
962
- }
963
- }
964
-
965
- class TSTypePredicate extends ASTNode {
966
- constructor(parameterName, typeAnnotation = null, asserts = false, loc = null) {
967
- super('TSTypePredicate', loc)
968
- this.parameterName = parameterName
969
- this.typeAnnotation = typeAnnotation
970
- this.asserts = asserts
971
- }
972
- }
973
-
974
- class TSTypeQuery extends ASTNode {
975
- constructor(exprName, typeParameters = null, loc = null) {
976
- super('TSTypeQuery', loc)
977
- this.exprName = exprName
978
- this.typeParameters = typeParameters
979
- }
980
- }
981
-
982
- class TSLiteralType extends ASTNode {
983
- constructor(literal, loc = null) {
984
- super('TSLiteralType', loc)
985
- this.literal = literal
986
- }
987
- }
988
-
989
- class TSTemplateLiteralType extends ASTNode {
990
- constructor(quasis = [], types = [], loc = null) {
991
- super('TSTemplateLiteralType', loc)
992
- this.quasis = quasis
993
- this.types = types
994
- }
995
- }
996
-
997
- class TSInterfaceDeclaration extends ASTNode {
998
- constructor(id, body, extends_ = [], typeParameters = null, declare = false, loc = null) {
999
- super('TSInterfaceDeclaration', loc)
1000
- this.id = id
1001
- this.body = body
1002
- this.extends = extends_
1003
- this.typeParameters = typeParameters
1004
- this.declare = declare
1005
- }
1006
- }
1007
-
1008
- class TSInterfaceBody extends ASTNode {
1009
- constructor(body = [], loc = null) {
1010
- super('TSInterfaceBody', loc)
1011
- this.body = body
1012
- }
1013
- }
1014
-
1015
- class TSInterfaceHeritage extends ASTNode {
1016
- constructor(expression, typeParameters = null, loc = null) {
1017
- super('TSInterfaceHeritage', loc)
1018
- this.expression = expression
1019
- this.typeParameters = typeParameters
1020
- }
1021
- }
1022
-
1023
- class TSTypeAliasDeclaration extends ASTNode {
1024
- constructor(id, typeAnnotation, typeParameters = null, declare = false, loc = null) {
1025
- super('TSTypeAliasDeclaration', loc)
1026
- this.id = id
1027
- this.typeAnnotation = typeAnnotation
1028
- this.typeParameters = typeParameters
1029
- this.declare = declare
1030
- }
1031
- }
1032
-
1033
- class TSEnumDeclaration extends ASTNode {
1034
- constructor(id, members = [], const_ = false, declare = false, loc = null) {
1035
- super('TSEnumDeclaration', loc)
1036
- this.id = id
1037
- this.members = members
1038
- this.const = const_
1039
- this.declare = declare
1040
- }
1041
- }
1042
-
1043
- class TSEnumMember extends ASTNode {
1044
- constructor(id, initializer = null, loc = null) {
1045
- super('TSEnumMember', loc)
1046
- this.id = id
1047
- this.initializer = initializer
1048
- }
1049
- }
1050
-
1051
- class TSModuleDeclaration extends ASTNode {
1052
- constructor(id, body = null, declare = false, global = false, loc = null) {
1053
- super('TSModuleDeclaration', loc)
1054
- this.id = id
1055
- this.body = body
1056
- this.declare = declare
1057
- this.global = global
1058
- }
1059
- }
1060
-
1061
- class TSModuleBlock extends ASTNode {
1062
- constructor(body = [], loc = null) {
1063
- super('TSModuleBlock', loc)
1064
- this.body = body
1065
- }
1066
- }
1067
-
1068
- class TSDeclareFunction extends ASTNode {
1069
- constructor(id, params = [], returnType = null, typeParameters = null, async = false, generator = false, loc = null) {
1070
- super('TSDeclareFunction', loc)
1071
- this.id = id
1072
- this.params = params
1073
- this.returnType = returnType
1074
- this.typeParameters = typeParameters
1075
- this.async = async
1076
- this.generator = generator
1077
- }
1078
- }
1079
-
1080
- class TSDeclareMethod extends ASTNode {
1081
- constructor(key, params = [], returnType = null, typeParameters = null, accessibility = null, isStatic = false, abstract = false, loc = null) {
1082
- super('TSDeclareMethod', loc)
1083
- this.key = key
1084
- this.params = params
1085
- this.returnType = returnType
1086
- this.typeParameters = typeParameters
1087
- this.accessibility = accessibility
1088
- this.static = isStatic
1089
- this.abstract = abstract
1090
- }
1091
- }
1092
-
1093
- class TSAsExpression extends ASTNode {
1094
- constructor(expression, typeAnnotation, loc = null) {
1095
- super('TSAsExpression', loc)
1096
- this.expression = expression
1097
- this.typeAnnotation = typeAnnotation
1098
- }
1099
- }
1100
-
1101
- class TSSatisfiesExpression extends ASTNode {
1102
- constructor(expression, typeAnnotation, loc = null) {
1103
- super('TSSatisfiesExpression', loc)
1104
- this.expression = expression
1105
- this.typeAnnotation = typeAnnotation
1106
- }
1107
- }
1108
-
1109
- class TSTypeAssertion extends ASTNode {
1110
- constructor(typeAnnotation, expression, loc = null) {
1111
- super('TSTypeAssertion', loc)
1112
- this.typeAnnotation = typeAnnotation
1113
- this.expression = expression
1114
- }
1115
- }
1116
-
1117
- class TSNonNullExpression extends ASTNode {
1118
- constructor(expression, loc = null) {
1119
- super('TSNonNullExpression', loc)
1120
- this.expression = expression
1121
- }
1122
- }
1123
-
1124
- class TSInstantiationExpression extends ASTNode {
1125
- constructor(expression, typeParameters, loc = null) {
1126
- super('TSInstantiationExpression', loc)
1127
- this.expression = expression
1128
- this.typeParameters = typeParameters
1129
- }
1130
- }
1131
-
1132
- class TSImportType extends ASTNode {
1133
- constructor(argument, qualifier = null, typeParameters = null, loc = null) {
1134
- super('TSImportType', loc)
1135
- this.argument = argument
1136
- this.qualifier = qualifier
1137
- this.typeParameters = typeParameters
1138
- }
1139
- }
1140
-
1141
- class TSImportEqualsDeclaration extends ASTNode {
1142
- constructor(id, moduleReference, isExport = false, loc = null) {
1143
- super('TSImportEqualsDeclaration', loc)
1144
- this.id = id
1145
- this.moduleReference = moduleReference
1146
- this.isExport = isExport
1147
- }
1148
- }
1149
-
1150
- class TSExternalModuleReference extends ASTNode {
1151
- constructor(expression, loc = null) {
1152
- super('TSExternalModuleReference', loc)
1153
- this.expression = expression
1154
- }
1155
- }
1156
-
1157
- class TSExportAssignment extends ASTNode {
1158
- constructor(expression, loc = null) {
1159
- super('TSExportAssignment', loc)
1160
- this.expression = expression
1161
- }
1162
- }
1163
-
1164
- class TSNamespaceExportDeclaration extends ASTNode {
1165
- constructor(id, loc = null) {
1166
- super('TSNamespaceExportDeclaration', loc)
1167
- this.id = id
1168
- }
1169
- }
1170
-
1171
- class Decorator extends ASTNode {
1172
- constructor(expression, loc = null) {
1173
- super('Decorator', loc)
1174
- this.expression = expression
1175
- }
1176
- }
1177
-
1178
- class TSParameterProperty extends ASTNode {
1179
- constructor(parameter, accessibility = null, readonly = false, override = false, loc = null) {
1180
- super('TSParameterProperty', loc)
1181
- this.parameter = parameter
1182
- this.accessibility = accessibility
1183
- this.readonly = readonly
1184
- this.override = override
1185
- }
1186
- }
1187
-
1188
- class EtherTypeAlias extends ASTNode {
1189
- constructor(name, typeAnnotation, typeParameters = null, loc = null) {
1190
- super('EtherTypeAlias', loc)
1191
- this.name = name
1192
- this.typeAnnotation = typeAnnotation
1193
- this.typeParameters = typeParameters
1194
- }
1195
- }
1196
-
1197
- class EtherGenericType extends ASTNode {
1198
- constructor(baseName, typeArguments = [], loc = null) {
1199
- super('EtherGenericType', loc)
1200
- this.baseName = baseName
1201
- this.typeArguments = typeArguments
1202
- }
1203
- }
1204
-
1205
- module.exports = {
1206
- ASTNode,
1207
- Program,
1208
- Identifier,
1209
- StringLiteral,
1210
- NumericLiteral,
1211
- BooleanLiteral,
1212
- NullLiteral,
1213
- UndefinedLiteral,
1214
- BigIntLiteral,
1215
- TemplateLiteral,
1216
- TemplateElement,
1217
- RegExpLiteral,
1218
- ArrayExpression,
1219
- ObjectExpression,
1220
- Property,
1221
- SpreadElement,
1222
- BinaryExpression,
1223
- UnaryExpression,
1224
- UpdateExpression,
1225
- AssignmentExpression,
1226
- LogicalExpression,
1227
- ConditionalExpression,
1228
- CallExpression,
1229
- NewExpression,
1230
- MemberExpression,
1231
- SequenceExpression,
1232
- ArrowFunctionExpression,
1233
- FunctionExpression,
1234
- FunctionDeclaration,
1235
- VariableDeclaration,
1236
- VariableDeclarator,
1237
- ClassDeclaration,
1238
- ClassExpression,
1239
- ClassBody,
1240
- MethodDefinition,
1241
- PropertyDefinition,
1242
- StaticBlock,
1243
- PrivateIdentifier,
1244
- BlockStatement,
1245
- ExpressionStatement,
1246
- EmptyStatement,
1247
- IfStatement,
1248
- SwitchStatement,
1249
- SwitchCase,
1250
- ForStatement,
1251
- ForInStatement,
1252
- ForOfStatement,
1253
- WhileStatement,
1254
- DoWhileStatement,
1255
- BreakStatement,
1256
- ContinueStatement,
1257
- ReturnStatement,
1258
- ThrowStatement,
1259
- TryStatement,
1260
- CatchClause,
1261
- LabeledStatement,
1262
- WithStatement,
1263
- DebuggerStatement,
1264
- ImportDeclaration,
1265
- ImportSpecifier,
1266
- ImportDefaultSpecifier,
1267
- ImportNamespaceSpecifier,
1268
- ExportNamedDeclaration,
1269
- ExportDefaultDeclaration,
1270
- ExportAllDeclaration,
1271
- ExportSpecifier,
1272
- AwaitExpression,
1273
- YieldExpression,
1274
- ThisExpression,
1275
- Super,
1276
- MetaProperty,
1277
- TaggedTemplateExpression,
1278
- ChainExpression,
1279
- ImportExpression,
1280
- AssignmentPattern,
1281
- ArrayPattern,
1282
- ObjectPattern,
1283
- RestElement,
1284
- TSTypeAnnotation,
1285
- TSTypeParameterDeclaration,
1286
- TSTypeParameter,
1287
- TSTypeParameterInstantiation,
1288
- TSTypeReference,
1289
- TSQualifiedName,
1290
- TSStringKeyword,
1291
- TSNumberKeyword,
1292
- TSBooleanKeyword,
1293
- TSBigIntKeyword,
1294
- TSSymbolKeyword,
1295
- TSObjectKeyword,
1296
- TSAnyKeyword,
1297
- TSUnknownKeyword,
1298
- TSNeverKeyword,
1299
- TSVoidKeyword,
1300
- TSUndefinedKeyword,
1301
- TSNullKeyword,
1302
- TSThisType,
1303
- TSArrayType,
1304
- TSTupleType,
1305
- TSNamedTupleMember,
1306
- TSOptionalType,
1307
- TSRestType,
1308
- TSUnionType,
1309
- TSIntersectionType,
1310
- TSParenthesizedType,
1311
- TSTypeLiteral,
1312
- TSPropertySignature,
1313
- TSMethodSignature,
1314
- TSIndexSignature,
1315
- TSCallSignatureDeclaration,
1316
- TSConstructSignatureDeclaration,
1317
- TSFunctionType,
1318
- TSConstructorType,
1319
- TSConditionalType,
1320
- TSInferType,
1321
- TSMappedType,
1322
- TSIndexedAccessType,
1323
- TSTypeOperator,
1324
- TSTypePredicate,
1325
- TSTypeQuery,
1326
- TSLiteralType,
1327
- TSTemplateLiteralType,
1328
- TSInterfaceDeclaration,
1329
- TSInterfaceBody,
1330
- TSInterfaceHeritage,
1331
- TSTypeAliasDeclaration,
1332
- TSEnumDeclaration,
1333
- TSEnumMember,
1334
- TSModuleDeclaration,
1335
- TSModuleBlock,
1336
- TSDeclareFunction,
1337
- TSDeclareMethod,
1338
- TSAsExpression,
1339
- TSSatisfiesExpression,
1340
- TSTypeAssertion,
1341
- TSNonNullExpression,
1342
- TSInstantiationExpression,
1343
- TSImportType,
1344
- TSImportEqualsDeclaration,
1345
- TSExternalModuleReference,
1346
- TSExportAssignment,
1347
- TSNamespaceExportDeclaration,
1348
- Decorator,
1349
- TSParameterProperty,
1350
- EtherTypeAlias,
1351
- EtherGenericType
1352
- }