@jorgsowa/php-parser 3.2.5-1

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 (153) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +108 -0
  3. package/dist/@jorgsowa/php-parser.js +11239 -0
  4. package/dist/@jorgsowa/php-parser.min.js +2 -0
  5. package/dist/@jorgsowa/php-parser.min.js.LICENSE.txt +10 -0
  6. package/package.json +86 -0
  7. package/src/ast/array.js +44 -0
  8. package/src/ast/arrowfunc.js +43 -0
  9. package/src/ast/assign.js +28 -0
  10. package/src/ast/assignref.js +27 -0
  11. package/src/ast/attrgroup.js +21 -0
  12. package/src/ast/attribute.js +26 -0
  13. package/src/ast/bin.js +27 -0
  14. package/src/ast/block.js +24 -0
  15. package/src/ast/boolean.js +23 -0
  16. package/src/ast/break.js +21 -0
  17. package/src/ast/byref.js +21 -0
  18. package/src/ast/call.js +26 -0
  19. package/src/ast/case.js +26 -0
  20. package/src/ast/cast.js +28 -0
  21. package/src/ast/catch.js +29 -0
  22. package/src/ast/class.js +36 -0
  23. package/src/ast/classconstant.js +71 -0
  24. package/src/ast/clone.js +21 -0
  25. package/src/ast/closure.js +47 -0
  26. package/src/ast/comment.js +23 -0
  27. package/src/ast/commentblock.js +22 -0
  28. package/src/ast/commentline.js +22 -0
  29. package/src/ast/constant.js +26 -0
  30. package/src/ast/constantstatement.js +24 -0
  31. package/src/ast/continue.js +24 -0
  32. package/src/ast/declaration.js +60 -0
  33. package/src/ast/declare.js +71 -0
  34. package/src/ast/declaredirective.js +26 -0
  35. package/src/ast/do.js +26 -0
  36. package/src/ast/echo.js +26 -0
  37. package/src/ast/empty.js +23 -0
  38. package/src/ast/encapsed.js +75 -0
  39. package/src/ast/encapsedpart.js +28 -0
  40. package/src/ast/entry.js +30 -0
  41. package/src/ast/enum.js +30 -0
  42. package/src/ast/enumcase.js +26 -0
  43. package/src/ast/error.js +30 -0
  44. package/src/ast/eval.js +24 -0
  45. package/src/ast/exit.js +26 -0
  46. package/src/ast/expression.js +20 -0
  47. package/src/ast/expressionstatement.js +24 -0
  48. package/src/ast/for.js +33 -0
  49. package/src/ast/foreach.js +33 -0
  50. package/src/ast/function.js +34 -0
  51. package/src/ast/global.js +24 -0
  52. package/src/ast/goto.js +22 -0
  53. package/src/ast/halt.js +22 -0
  54. package/src/ast/identifier.js +26 -0
  55. package/src/ast/if.js +30 -0
  56. package/src/ast/include.js +28 -0
  57. package/src/ast/inline.js +23 -0
  58. package/src/ast/interface.js +28 -0
  59. package/src/ast/intersectiontype.js +24 -0
  60. package/src/ast/isset.js +23 -0
  61. package/src/ast/label.js +21 -0
  62. package/src/ast/list.js +26 -0
  63. package/src/ast/literal.js +28 -0
  64. package/src/ast/location.js +22 -0
  65. package/src/ast/lookup.js +26 -0
  66. package/src/ast/magic.js +22 -0
  67. package/src/ast/match.js +26 -0
  68. package/src/ast/matcharm.js +26 -0
  69. package/src/ast/method.js +24 -0
  70. package/src/ast/name.js +55 -0
  71. package/src/ast/namedargument.js +27 -0
  72. package/src/ast/namespace.js +26 -0
  73. package/src/ast/new.js +26 -0
  74. package/src/ast/node.js +111 -0
  75. package/src/ast/noop.js +20 -0
  76. package/src/ast/nowdoc.js +26 -0
  77. package/src/ast/nullkeyword.js +20 -0
  78. package/src/ast/nullsafepropertylookup.js +22 -0
  79. package/src/ast/number.js +23 -0
  80. package/src/ast/offsetlookup.js +22 -0
  81. package/src/ast/operation.js +19 -0
  82. package/src/ast/parameter.js +61 -0
  83. package/src/ast/parentreference.js +24 -0
  84. package/src/ast/position.js +22 -0
  85. package/src/ast/post.js +26 -0
  86. package/src/ast/pre.js +26 -0
  87. package/src/ast/print.js +23 -0
  88. package/src/ast/program.js +32 -0
  89. package/src/ast/property.js +46 -0
  90. package/src/ast/propertyhook.js +33 -0
  91. package/src/ast/propertylookup.js +22 -0
  92. package/src/ast/propertystatement.js +59 -0
  93. package/src/ast/reference.js +21 -0
  94. package/src/ast/retif.js +28 -0
  95. package/src/ast/return.js +21 -0
  96. package/src/ast/selfreference.js +24 -0
  97. package/src/ast/silent.js +24 -0
  98. package/src/ast/statement.js +19 -0
  99. package/src/ast/static.js +24 -0
  100. package/src/ast/staticlookup.js +22 -0
  101. package/src/ast/staticreference.js +24 -0
  102. package/src/ast/staticvariable.js +26 -0
  103. package/src/ast/string.js +28 -0
  104. package/src/ast/switch.js +28 -0
  105. package/src/ast/throw.js +21 -0
  106. package/src/ast/trait.js +24 -0
  107. package/src/ast/traitalias.js +44 -0
  108. package/src/ast/traitprecedence.js +28 -0
  109. package/src/ast/traituse.js +26 -0
  110. package/src/ast/try.js +28 -0
  111. package/src/ast/typereference.js +40 -0
  112. package/src/ast/unary.js +26 -0
  113. package/src/ast/uniontype.js +24 -0
  114. package/src/ast/unset.js +23 -0
  115. package/src/ast/usegroup.js +30 -0
  116. package/src/ast/useitem.js +45 -0
  117. package/src/ast/variable.js +36 -0
  118. package/src/ast/variadic.js +25 -0
  119. package/src/ast/variadicplaceholder.js +24 -0
  120. package/src/ast/while.js +28 -0
  121. package/src/ast/yield.js +27 -0
  122. package/src/ast/yieldfrom.js +25 -0
  123. package/src/ast.js +593 -0
  124. package/src/index.js +239 -0
  125. package/src/lexer/attribute.js +85 -0
  126. package/src/lexer/comments.js +63 -0
  127. package/src/lexer/initial.js +64 -0
  128. package/src/lexer/numbers.js +171 -0
  129. package/src/lexer/property.js +96 -0
  130. package/src/lexer/scripting.js +114 -0
  131. package/src/lexer/strings.js +524 -0
  132. package/src/lexer/tokens.js +356 -0
  133. package/src/lexer/utils.js +112 -0
  134. package/src/lexer.js +561 -0
  135. package/src/parser/array.js +113 -0
  136. package/src/parser/class.js +718 -0
  137. package/src/parser/comment.js +52 -0
  138. package/src/parser/enum.js +56 -0
  139. package/src/parser/expr.js +848 -0
  140. package/src/parser/function.js +507 -0
  141. package/src/parser/if.js +94 -0
  142. package/src/parser/loops.js +168 -0
  143. package/src/parser/main.js +21 -0
  144. package/src/parser/namespace.js +231 -0
  145. package/src/parser/scalar.js +492 -0
  146. package/src/parser/statement.js +444 -0
  147. package/src/parser/switch.js +99 -0
  148. package/src/parser/try.js +43 -0
  149. package/src/parser/utils.js +203 -0
  150. package/src/parser/variable.js +363 -0
  151. package/src/parser.js +748 -0
  152. package/src/tokens.js +177 -0
  153. package/types.d.ts +1457 -0
package/types.d.ts ADDED
@@ -0,0 +1,1457 @@
1
+ declare module "php-parser" {
2
+ /**
3
+ * Defines an array structure
4
+ * @example
5
+ * // PHP code :
6
+ * [1, 'foo' => 'bar', 3]
7
+ *
8
+ * // AST structure :
9
+ * {
10
+ * "kind": "array",
11
+ * "shortForm": true
12
+ * "items": [
13
+ * {"kind": "number", "value": "1"},
14
+ * {
15
+ * "kind": "entry",
16
+ * "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
17
+ * "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
18
+ * },
19
+ * {"kind": "number", "value": "3"}
20
+ * ]
21
+ * }
22
+ * @property items - List of array items
23
+ * @property shortForm - Indicate if the short array syntax is used, ex `[]` instead `array()`
24
+ */
25
+ class Array extends Expression {
26
+ /**
27
+ * List of array items
28
+ */
29
+ items: (Entry | Expression | Variable)[];
30
+ /**
31
+ * Indicate if the short array syntax is used, ex `[]` instead `array()`
32
+ */
33
+ shortForm: boolean;
34
+ }
35
+ /**
36
+ * Defines an arrow function (it's like a closure)
37
+ */
38
+ class ArrowFunc extends Expression {
39
+ arguments: Parameter[];
40
+ type: Identifier;
41
+ body: Expression;
42
+ byref: boolean;
43
+ nullable: boolean;
44
+ isStatic: boolean;
45
+ }
46
+ /**
47
+ * Assigns a value to the specified target
48
+ */
49
+ class Assign extends Expression {
50
+ left: Expression;
51
+ right: Expression;
52
+ operator: string;
53
+ }
54
+ /**
55
+ * Assigns a value to the specified target
56
+ */
57
+ class AssignRef extends Expression {
58
+ left: Expression;
59
+ right: Expression;
60
+ operator: string;
61
+ }
62
+ /**
63
+ * Attribute group
64
+ */
65
+ class AttrGroup extends Node {
66
+ attrs: Attribute[];
67
+ }
68
+ /**
69
+ * Attribute Value
70
+ */
71
+ class Attribute extends Node {
72
+ name: string;
73
+ args: Parameter[];
74
+ }
75
+ /**
76
+ * Binary operations
77
+ */
78
+ class Bin extends Operation {
79
+ type: string;
80
+ left: Expression;
81
+ right: Expression;
82
+ }
83
+ /**
84
+ * A block statement, i.e., a sequence of statements surrounded by braces.
85
+ */
86
+ class Block extends Statement {
87
+ children: Node[];
88
+ }
89
+ /**
90
+ * Defines a boolean value (true/false)
91
+ */
92
+ class Boolean extends Literal {
93
+ value: boolean;
94
+ }
95
+ /**
96
+ * A break statement
97
+ */
98
+ class Break extends Statement {
99
+ level: number | null;
100
+ }
101
+ /**
102
+ * Passing by Reference - so the function can modify the variable
103
+ */
104
+ class ByRef extends Expression {
105
+ what: ExpressionStatement;
106
+ }
107
+ /**
108
+ * Executes a call statement
109
+ */
110
+ class Call extends Expression {
111
+ what: Identifier | Variable;
112
+ arguments: Expression[];
113
+ }
114
+ /**
115
+ * A switch case statement
116
+ * @property test - if null, means that the default case
117
+ */
118
+ class Case extends Statement {
119
+ /**
120
+ * if null, means that the default case
121
+ */
122
+ test: Expression | null;
123
+ body: Block | null;
124
+ }
125
+ /**
126
+ * Binary operations
127
+ */
128
+ class Cast extends Operation {
129
+ type: string;
130
+ raw: string;
131
+ expr: Expression;
132
+ }
133
+ /**
134
+ * Defines a catch statement
135
+ */
136
+ class Catch extends Statement {
137
+ what: Name[];
138
+ variable: Variable;
139
+ body: Block;
140
+ }
141
+ /**
142
+ * A class definition
143
+ */
144
+ class Class extends Declaration {
145
+ extends: Identifier | null;
146
+ implements: Identifier[] | null;
147
+ body: Declaration[];
148
+ isAnonymous: boolean;
149
+ isAbstract: boolean;
150
+ isFinal: boolean;
151
+ isReadonly: boolean;
152
+ attrGroups: AttrGroup[];
153
+ }
154
+ /**
155
+ * Defines a class/interface/trait constant
156
+ */
157
+ class ClassConstant extends ConstantStatement {
158
+ /**
159
+ * Generic flags parser
160
+ */
161
+ parseFlags(flags: (number | null)[]): void;
162
+ visibility: string;
163
+ final: boolean;
164
+ nullable: boolean;
165
+ type: TypeReference | IntersectionType | UnionType | null;
166
+ attrGroups: AttrGroup[];
167
+ }
168
+ /**
169
+ * Defines a clone call
170
+ */
171
+ class Clone extends Expression {
172
+ what: Expression;
173
+ }
174
+ /**
175
+ * Defines a closure
176
+ */
177
+ class Closure extends Expression {
178
+ arguments: Parameter[];
179
+ uses: Variable[];
180
+ type: Identifier;
181
+ byref: boolean;
182
+ nullable: boolean;
183
+ body: Block | null;
184
+ isStatic: boolean;
185
+ attrGroups: AttrGroup[];
186
+ }
187
+ /**
188
+ * Abstract documentation node (ComentLine or CommentBlock)
189
+ */
190
+ class Comment extends Node {
191
+ value: string;
192
+ }
193
+ /**
194
+ * A comment block (multiline)
195
+ */
196
+ class CommentBlock extends Comment {}
197
+ /**
198
+ * A single line comment
199
+ */
200
+ class CommentLine extends Comment {}
201
+ /**
202
+ * Defines a constant
203
+ */
204
+ class Constant extends Node {
205
+ name: string;
206
+ value: Node | string | number | boolean | null;
207
+ }
208
+ /**
209
+ * Declares a constants into the current scope
210
+ */
211
+ class ConstantStatement extends Statement {
212
+ constants: Constant[];
213
+ }
214
+ /**
215
+ * A continue statement
216
+ */
217
+ class Continue extends Statement {
218
+ level: number | null;
219
+ }
220
+ /**
221
+ * A declaration statement (function, class, interface...)
222
+ */
223
+ class Declaration extends Statement {
224
+ /**
225
+ * Generic flags parser
226
+ */
227
+ parseFlags(flags: (number | null)[]): void;
228
+ name: Identifier | string;
229
+ }
230
+ /**
231
+ * The declare construct is used to set execution directives for a block of code
232
+ */
233
+ class Declare extends Block {
234
+ /**
235
+ * The node is declared as a short tag syntax :
236
+ * ```php
237
+ * <?php
238
+ * declare(ticks=1):
239
+ * // some statements
240
+ * enddeclare;
241
+ * ```
242
+ */
243
+ readonly MODE_SHORT: string;
244
+ /**
245
+ * The node is declared bracket enclosed code :
246
+ * ```php
247
+ * <?php
248
+ * declare(ticks=1) {
249
+ * // some statements
250
+ * }
251
+ * ```
252
+ */
253
+ readonly MODE_BLOCK: string;
254
+ /**
255
+ * The node is declared as a simple statement. In order to make things simpler
256
+ * children of the node are automatically collected until the next
257
+ * declare statement.
258
+ * ```php
259
+ * <?php
260
+ * declare(ticks=1);
261
+ * // some statements
262
+ * declare(ticks=2);
263
+ * // some statements
264
+ * ```
265
+ */
266
+ readonly MODE_NONE: string;
267
+ directives: DeclareDirective[];
268
+ mode: string;
269
+ }
270
+ /**
271
+ * Defines a constant
272
+ */
273
+ class DeclareDirective extends Node {
274
+ key: Identifier;
275
+ value: Node | string | number | boolean | null;
276
+ }
277
+ /**
278
+ * Defines a do/while statement
279
+ */
280
+ class Do extends Statement {
281
+ test: Expression;
282
+ body: Block | null;
283
+ }
284
+ /**
285
+ * Defines system based call
286
+ */
287
+ class Echo extends Statement {
288
+ shortForm: boolean;
289
+ expressions: Expression[];
290
+ }
291
+ /**
292
+ * Defines an empty check call
293
+ */
294
+ class Empty extends Expression {}
295
+ /**
296
+ * Defines an encapsed string (contains expressions)
297
+ * @property type - Defines the type of encapsed string (shell, heredoc, string)
298
+ * @property label - The heredoc label, defined only when the type is heredoc
299
+ */
300
+ class Encapsed extends Literal {
301
+ /**
302
+ * The node is a double quote string :
303
+ * ```php
304
+ * <?php
305
+ * echo "hello $world";
306
+ * ```
307
+ */
308
+ readonly TYPE_STRING: string;
309
+ /**
310
+ * The node is a shell execute string :
311
+ * ```php
312
+ * <?php
313
+ * echo `ls -larth $path`;
314
+ * ```
315
+ */
316
+ readonly TYPE_SHELL: string;
317
+ /**
318
+ * The node is a shell execute string :
319
+ * ```php
320
+ * <?php
321
+ * echo <<<STR
322
+ * Hello $world
323
+ * STR
324
+ * ;
325
+ * ```
326
+ */
327
+ readonly TYPE_HEREDOC: string;
328
+ /**
329
+ * The node contains a list of constref / variables / expr :
330
+ * ```php
331
+ * <?php
332
+ * echo $foo->bar_$baz;
333
+ * ```
334
+ */
335
+ readonly TYPE_OFFSET: string;
336
+ /**
337
+ * Defines the type of encapsed string (shell, heredoc, string)
338
+ */
339
+ type: string;
340
+ /**
341
+ * The heredoc label, defined only when the type is heredoc
342
+ */
343
+ label: string | null;
344
+ value: EncapsedPart[];
345
+ }
346
+ /**
347
+ * Part of `Encapsed` node
348
+ */
349
+ class EncapsedPart extends Expression {
350
+ expression: Expression;
351
+ syntax: string;
352
+ curly: boolean;
353
+ }
354
+ /**
355
+ * An array entry - see [Array](#array)
356
+ * @property key - The entry key/offset
357
+ * @property value - The entry value
358
+ * @property byRef - By reference
359
+ * @property unpack - Argument unpacking
360
+ */
361
+ class Entry extends Expression {
362
+ /**
363
+ * The entry key/offset
364
+ */
365
+ key: Node | null;
366
+ /**
367
+ * The entry value
368
+ */
369
+ value: Node;
370
+ /**
371
+ * By reference
372
+ */
373
+ byRef: boolean;
374
+ /**
375
+ * Argument unpacking
376
+ */
377
+ unpack: boolean;
378
+ }
379
+ /**
380
+ * A enum definition
381
+ */
382
+ class Enum extends Declaration {
383
+ valueType: Identifier | null;
384
+ implements: Identifier[];
385
+ body: Declaration[];
386
+ attrGroups: AttrGroup[];
387
+ }
388
+ /**
389
+ * Declares a cases into the current scope
390
+ */
391
+ class EnumCase extends Node {
392
+ name: string;
393
+ value: string | number | null;
394
+ }
395
+ /**
396
+ * Defines an error node (used only on silentMode)
397
+ */
398
+ class Error extends Node {
399
+ message: string;
400
+ line: number;
401
+ token: number | string;
402
+ expected: string | any[];
403
+ }
404
+ /**
405
+ * Defines an eval statement
406
+ */
407
+ class Eval extends Expression {
408
+ source: Node;
409
+ }
410
+ /**
411
+ * Defines an exit / die call
412
+ */
413
+ class Exit extends Expression {
414
+ expression: Node | null;
415
+ useDie: boolean;
416
+ }
417
+ /**
418
+ * Any expression node. Since the left-hand side of an assignment may
419
+ * be any expression in general, an expression can also be a pattern.
420
+ */
421
+ class Expression extends Node {}
422
+ /**
423
+ * Defines an expression based statement
424
+ */
425
+ class ExpressionStatement extends Statement {
426
+ expression: Expression;
427
+ }
428
+ /**
429
+ * Defines a for iterator
430
+ */
431
+ class For extends Statement {
432
+ init: Expression[];
433
+ test: Expression[];
434
+ increment: Expression[];
435
+ body: Block | null;
436
+ shortForm: boolean;
437
+ }
438
+ /**
439
+ * Defines a foreach iterator
440
+ */
441
+ class Foreach extends Statement {
442
+ source: Expression;
443
+ key: Expression | null;
444
+ value: Expression;
445
+ body: Block | null;
446
+ shortForm: boolean;
447
+ }
448
+ /**
449
+ * Defines a classic function
450
+ */
451
+ class Function extends Declaration {
452
+ arguments: Parameter[];
453
+ type: Identifier;
454
+ byref: boolean;
455
+ nullable: boolean;
456
+ body: Block | null;
457
+ attrGroups: AttrGroup[];
458
+ }
459
+ /**
460
+ * Imports a variable from the global scope
461
+ */
462
+ class Global extends Statement {
463
+ items: Variable[];
464
+ }
465
+ /**
466
+ * Defines goto statement
467
+ */
468
+ class Goto extends Statement {
469
+ label: string;
470
+ }
471
+ /**
472
+ * Halts the compiler execution
473
+ * @property after - String after the halt statement
474
+ */
475
+ class Halt extends Statement {
476
+ /**
477
+ * String after the halt statement
478
+ */
479
+ after: string;
480
+ }
481
+ /**
482
+ * Defines an identifier node
483
+ */
484
+ class Identifier extends Node {
485
+ name: string;
486
+ }
487
+ /**
488
+ * Defines a if statement
489
+ */
490
+ class If extends Statement {
491
+ test: Expression;
492
+ body: Block;
493
+ alternate: Block | If | null;
494
+ shortForm: boolean;
495
+ }
496
+ /**
497
+ * Defines system include call
498
+ */
499
+ class Include extends Expression {
500
+ target: Node;
501
+ once: boolean;
502
+ require: boolean;
503
+ }
504
+ /**
505
+ * Defines inline html output (treated as echo output)
506
+ */
507
+ class Inline extends Literal {
508
+ value: string;
509
+ }
510
+ /**
511
+ * An interface definition
512
+ */
513
+ class Interface extends Declaration {
514
+ extends: Identifier[];
515
+ body: Declaration[];
516
+ attrGroups: AttrGroup[];
517
+ }
518
+ /**
519
+ * A union of types
520
+ */
521
+ class IntersectionType extends Declaration {
522
+ types: TypeReference[];
523
+ }
524
+ /**
525
+ * Defines an isset call
526
+ */
527
+ class Isset extends Expression {}
528
+ /**
529
+ * A label statement (referenced by goto)
530
+ */
531
+ class Label extends Statement {
532
+ name: string;
533
+ }
534
+ /**
535
+ * Defines list assignment
536
+ */
537
+ class List extends Expression {
538
+ shortForm: boolean;
539
+ items: Entry[];
540
+ }
541
+ /**
542
+ * Defines an array structure
543
+ */
544
+ class Literal extends Expression {
545
+ raw: string;
546
+ value: EncapsedPart[] | Node | string | number | boolean | null;
547
+ }
548
+ /**
549
+ * Defines the location of the node (with it's source contents as string)
550
+ */
551
+ class Location {
552
+ source: string | null;
553
+ start: Position;
554
+ end: Position;
555
+ }
556
+ /**
557
+ * Lookup on an offset in the specified object
558
+ */
559
+ class Lookup extends Expression {
560
+ what: Expression;
561
+ offset: Expression;
562
+ }
563
+ /**
564
+ * Defines magic constant
565
+ */
566
+ class Magic extends Literal {}
567
+ /**
568
+ * Defines a match expression
569
+ * @property cond - Condition expression to match against
570
+ * @property arms - Arms for comparison
571
+ */
572
+ class Match extends Expression {
573
+ /**
574
+ * Condition expression to match against
575
+ */
576
+ cond: Expression;
577
+ /**
578
+ * Arms for comparison
579
+ */
580
+ arms: MatchArm[];
581
+ }
582
+ /**
583
+ * An array entry - see [Array](#array)
584
+ * @property conds - The match condition expression list - null indicates default arm
585
+ * @property body - The return value expression
586
+ */
587
+ class MatchArm extends Expression {
588
+ /**
589
+ * The match condition expression list - null indicates default arm
590
+ */
591
+ conds: Expression[] | null;
592
+ /**
593
+ * The return value expression
594
+ */
595
+ body: Expression;
596
+ }
597
+ /**
598
+ * Defines a class/interface/trait method
599
+ */
600
+ class Method extends Function {
601
+ isAbstract: boolean;
602
+ isFinal: boolean;
603
+ isStatic: boolean;
604
+ visibility: string;
605
+ }
606
+ /**
607
+ * Defines a class reference node
608
+ */
609
+ class Name extends Reference {
610
+ /**
611
+ * This is an identifier without a namespace separator, such as Foo
612
+ */
613
+ readonly UNQUALIFIED_NAME: string;
614
+ /**
615
+ * This is an identifier with a namespace separator, such as Foo\Bar
616
+ */
617
+ readonly QUALIFIED_NAME: string;
618
+ /**
619
+ * This is an identifier with a namespace separator that begins with
620
+ * a namespace separator, such as \Foo\Bar. The namespace \Foo is also
621
+ * a fully qualified name.
622
+ */
623
+ readonly FULL_QUALIFIED_NAME: string;
624
+ /**
625
+ * This is an identifier starting with namespace, such as namespace\Foo\Bar.
626
+ */
627
+ readonly RELATIVE_NAME: string;
628
+ name: string;
629
+ resolution: string;
630
+ }
631
+ /**
632
+ * Named arguments.
633
+ */
634
+ class namedargument extends Expression {
635
+ name: string;
636
+ value: Expression;
637
+ }
638
+ /**
639
+ * The main program node
640
+ */
641
+ class Namespace extends Block {
642
+ name: string;
643
+ withBrackets: boolean;
644
+ }
645
+ /**
646
+ * Creates a new instance of the specified class
647
+ */
648
+ class New extends Expression {
649
+ what: Identifier | Variable | Class;
650
+ arguments: Variable[];
651
+ }
652
+ /**
653
+ * A generic AST node
654
+ */
655
+ class Node {
656
+ /**
657
+ * Attach comments to current node
658
+ */
659
+ setTrailingComments(docs: any): void;
660
+ /**
661
+ * Destroying an unused node
662
+ */
663
+ destroy(): void;
664
+ /**
665
+ * Includes current token position of the parser
666
+ */
667
+ includeToken(parser: any): void;
668
+ /**
669
+ * Helper for extending the Node class
670
+ */
671
+ static extends(
672
+ type: string,
673
+ constructor: (...params: any[]) => any,
674
+ ): (...params: any[]) => any;
675
+ loc: Location | null;
676
+ leadingComments: CommentBlock[] | Comment[] | null;
677
+ trailingComments: CommentBlock[] | Comment[] | null;
678
+ kind: string;
679
+ }
680
+ /**
681
+ * Ignore this node, it implies a no operation block, for example :
682
+ * [$foo, $bar, /* here a noop node * /]
683
+ */
684
+ class Noop extends Node {}
685
+ /**
686
+ * Defines a nowdoc string
687
+ */
688
+ class NowDoc extends Literal {
689
+ label: string;
690
+ raw: string;
691
+ value: string;
692
+ }
693
+ /**
694
+ * Represents the null keyword
695
+ */
696
+ class NullKeyword extends Node {}
697
+ /**
698
+ * Lookup to an object property
699
+ */
700
+ class NullSafePropertyLookup extends Lookup {}
701
+ /**
702
+ * Defines a numeric value
703
+ */
704
+ class Number extends Literal {
705
+ value: number;
706
+ }
707
+ /**
708
+ * Lookup on an offset in an array
709
+ */
710
+ class OffsetLookup extends Lookup {}
711
+ /**
712
+ * Defines binary operations
713
+ */
714
+ class Operation extends Expression {}
715
+ type MODIFIER_PUBLIC = 1;
716
+ type MODIFIER_PROTECTED = 2;
717
+ type MODIFIER_PRIVATE = 4;
718
+ /**
719
+ * Defines a function parameter
720
+ */
721
+ class Parameter extends Declaration {
722
+ type: Identifier | null;
723
+ value: Node | null;
724
+ byref: boolean;
725
+ variadic: boolean;
726
+ readonly: boolean;
727
+ nullable: boolean;
728
+ attrGroups: AttrGroup[];
729
+ flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED | MODIFIER_PRIVATE;
730
+ }
731
+ /**
732
+ * Defines a class reference node
733
+ */
734
+ class ParentReference extends Reference {}
735
+ /**
736
+ * Each Position object consists of a line number (1-indexed) and a column number (0-indexed):
737
+ */
738
+ class Position {
739
+ line: number;
740
+ column: number;
741
+ offset: number;
742
+ }
743
+ /**
744
+ * Defines a post operation `$i++` or `$i--`
745
+ */
746
+ class Post extends Operation {
747
+ type: string;
748
+ what: Variable;
749
+ }
750
+ /**
751
+ * Defines a pre operation `++$i` or `--$i`
752
+ */
753
+ class Pre extends Operation {
754
+ type: string;
755
+ what: Variable;
756
+ }
757
+ /**
758
+ * Outputs
759
+ */
760
+ class Print extends Expression {}
761
+ /**
762
+ * The main program node
763
+ */
764
+ class Program extends Block {
765
+ errors: Error[];
766
+ comments: Comment[] | null;
767
+ tokens: String[] | null;
768
+ }
769
+ /**
770
+ * Defines a class property
771
+ */
772
+ class Property extends Statement {
773
+ name: string;
774
+ value: Node | null;
775
+ readonly: boolean;
776
+ nullable: boolean;
777
+ type: Identifier | Identifier[] | null;
778
+ attrGroups: AttrGroup[];
779
+ }
780
+ /**
781
+ * Defines a class property hook getter & setter
782
+ */
783
+ class PropertyHook extends Node {
784
+ name: string;
785
+ isFinal: boolean;
786
+ byref: boolean;
787
+ parameter: Parameter | null;
788
+ body: Block | Statement;
789
+ }
790
+ /**
791
+ * Lookup to an object property
792
+ */
793
+ class PropertyLookup extends Lookup {}
794
+ /**
795
+ * Declares a properties into the current scope
796
+ */
797
+ class PropertyStatement extends Statement {
798
+ /**
799
+ * Generic flags parser
800
+ */
801
+ parseFlags(flags: (number | null)[]): void;
802
+ properties: Property[];
803
+ visibility: string | null;
804
+ isStatic: boolean;
805
+ }
806
+ /**
807
+ * Defines a reference node
808
+ */
809
+ class Reference extends Node {}
810
+ /**
811
+ * Defines a short if statement that returns a value
812
+ */
813
+ class RetIf extends Expression {
814
+ test: Expression;
815
+ trueExpr: Expression;
816
+ falseExpr: Expression;
817
+ }
818
+ /**
819
+ * A continue statement
820
+ */
821
+ class Return extends Statement {
822
+ expr: Expression | null;
823
+ }
824
+ /**
825
+ * Defines a class reference node
826
+ */
827
+ class SelfReference extends Reference {}
828
+ /**
829
+ * Avoids to show/log warnings & notices from the inner expression
830
+ */
831
+ class Silent extends Expression {
832
+ expr: Expression;
833
+ }
834
+ /**
835
+ * Any statement.
836
+ */
837
+ class Statement extends Node {}
838
+ /**
839
+ * Declares a static variable into the current scope
840
+ */
841
+ class Static extends Statement {
842
+ variables: StaticVariable[];
843
+ }
844
+ /**
845
+ * Lookup to a static property
846
+ */
847
+ class StaticLookup extends Lookup {}
848
+ /**
849
+ * Defines a class reference node
850
+ */
851
+ class StaticReference extends Reference {}
852
+ /**
853
+ * Defines a constant
854
+ */
855
+ class StaticVariable extends Node {
856
+ variable: Variable;
857
+ defaultValue: Node | string | number | boolean | null;
858
+ }
859
+ /**
860
+ * Defines a string (simple or double quoted) - chars are already escaped
861
+ */
862
+ class String extends Literal {
863
+ unicode: boolean;
864
+ isDoubleQuote: boolean;
865
+ value: string;
866
+ }
867
+ /**
868
+ * Defines a switch statement
869
+ */
870
+ class Switch extends Statement {
871
+ test: Expression;
872
+ body: Block;
873
+ shortForm: boolean;
874
+ }
875
+ /**
876
+ * Defines a throw statement
877
+ */
878
+ class Throw extends Statement {
879
+ what: Expression;
880
+ }
881
+ /**
882
+ * A trait definition
883
+ */
884
+ class Trait extends Declaration {
885
+ body: Declaration[];
886
+ }
887
+ /**
888
+ * Defines a trait alias
889
+ */
890
+ class TraitAlias extends Node {
891
+ trait: Identifier | null;
892
+ method: Identifier;
893
+ as: Identifier | null;
894
+ visibility: string | null;
895
+ }
896
+ /**
897
+ * Defines a trait alias
898
+ */
899
+ class TraitPrecedence extends Node {
900
+ trait: Identifier | null;
901
+ method: Identifier;
902
+ instead: Identifier[];
903
+ }
904
+ /**
905
+ * Defines a trait usage
906
+ */
907
+ class TraitUse extends Node {
908
+ traits: Identifier[];
909
+ adaptations: Node[] | null;
910
+ }
911
+ /**
912
+ * Defines a try statement
913
+ */
914
+ class Try extends Statement {
915
+ body: Block;
916
+ catches: Catch[];
917
+ always: Block;
918
+ }
919
+ /**
920
+ * Defines a class reference node
921
+ */
922
+ class TypeReference extends Reference {
923
+ name: string;
924
+ }
925
+ /**
926
+ * Unary operations
927
+ */
928
+ class Unary extends Operation {
929
+ type: string;
930
+ what: Expression;
931
+ }
932
+ /**
933
+ * A union of types
934
+ */
935
+ class UnionType extends Declaration {
936
+ types: TypeReference[];
937
+ }
938
+ /**
939
+ * Deletes references to a list of variables
940
+ */
941
+ class Unset extends Statement {}
942
+ /**
943
+ * Defines a use statement (with a list of use items)
944
+ * @property type - Possible value : function, const
945
+ */
946
+ class UseGroup extends Statement {
947
+ name: string | null;
948
+ /**
949
+ * Possible value : function, const
950
+ */
951
+ type: string | null;
952
+ item: UseItem[];
953
+ }
954
+ /**
955
+ * Defines a use statement (from namespace)
956
+ * @property type - Possible value : function, const
957
+ */
958
+ class UseItem extends Statement {
959
+ /**
960
+ * Importing a constant
961
+ */
962
+ readonly TYPE_CONST: string;
963
+ /**
964
+ * Importing a function
965
+ */
966
+ readonly TYPE_FUNC: string;
967
+ name: string;
968
+ /**
969
+ * Possible value : function, const
970
+ */
971
+ type: string | null;
972
+ alias: Identifier | null;
973
+ }
974
+ /**
975
+ * Any expression node. Since the left-hand side of an assignment may
976
+ * be any expression in general, an expression can also be a pattern.
977
+ * @example
978
+ * // PHP code :
979
+ * $foo
980
+ * // AST output
981
+ * {
982
+ * "kind": "variable",
983
+ * "name": "foo",
984
+ * "curly": false
985
+ * }
986
+ * @property name - The variable name (can be a complex expression when the name is resolved dynamically)
987
+ * @property curly - Indicate if the name is defined between curlies, ex `${foo}`
988
+ */
989
+ class Variable extends Expression {
990
+ /**
991
+ * The variable name (can be a complex expression when the name is resolved dynamically)
992
+ */
993
+ name: string | Node;
994
+ /**
995
+ * Indicate if the name is defined between curlies, ex `${foo}`
996
+ */
997
+ curly: boolean;
998
+ }
999
+ /**
1000
+ * Introduce a list of items into the arguments of the call
1001
+ */
1002
+ class Variadic extends Expression {
1003
+ what: any[] | Expression;
1004
+ }
1005
+ /**
1006
+ * Defines a variadic placeholder (the ellipsis in PHP 8.1+'s first-class callable syntax)
1007
+ */
1008
+ class VariadicPlaceholder extends Node {}
1009
+ /**
1010
+ * Defines a while statement
1011
+ */
1012
+ class While extends Statement {
1013
+ test: Expression;
1014
+ body: Block | null;
1015
+ shortForm: boolean;
1016
+ }
1017
+ /**
1018
+ * Defines a yield generator statement
1019
+ */
1020
+ class Yield extends Expression {
1021
+ value: Expression | null;
1022
+ key: Expression | null;
1023
+ }
1024
+ /**
1025
+ * Defines a yield from generator statement
1026
+ */
1027
+ class YieldFrom extends Expression {
1028
+ value: Expression;
1029
+ }
1030
+ /**
1031
+ * The AST builder class
1032
+ * @property withPositions - Should locate any node (by default false)
1033
+ * @property withSource - Should extract the node original code (by default false)
1034
+ */
1035
+ class AST {
1036
+ /**
1037
+ * Should locate any node (by default false)
1038
+ */
1039
+ withPositions: boolean;
1040
+ /**
1041
+ * Should extract the node original code (by default false)
1042
+ */
1043
+ withSource: boolean;
1044
+ }
1045
+ /**
1046
+ * Initialise a new parser instance with the specified options
1047
+ * @example
1048
+ * var parser = require('php-parser');
1049
+ * var instance = new parser({
1050
+ * parser: {
1051
+ * extractDoc: true,
1052
+ * suppressErrors: true,
1053
+ * version: 704 // or '7.4'
1054
+ * },
1055
+ * ast: {
1056
+ * withPositions: true
1057
+ * },
1058
+ * lexer: {
1059
+ * short_tags: true,
1060
+ * asp_tags: true
1061
+ * }
1062
+ * });
1063
+ *
1064
+ * var evalAST = instance.parseEval('some php code');
1065
+ * var codeAST = instance.parseCode('<?php some php code', 'foo.php');
1066
+ * var tokens = instance.tokenGetAll('<?php some php code');
1067
+ * @param options - List of options
1068
+ */
1069
+ class Engine {
1070
+ constructor(options: any);
1071
+ /**
1072
+ * Parse an evaluating mode string (no need to open php tags)
1073
+ */
1074
+ parseEval(buffer: string): Program;
1075
+ /**
1076
+ * Function that parse a php code with open/close tags
1077
+ *
1078
+ * Sample code :
1079
+ * ```php
1080
+ * <?php $x = 1;
1081
+ * ```
1082
+ *
1083
+ * Usage :
1084
+ * ```js
1085
+ * var parser = require('php-parser');
1086
+ * var phpParser = new parser({
1087
+ * // some options
1088
+ * });
1089
+ * var ast = phpParser.parseCode('...php code...', 'foo.php');
1090
+ * ```
1091
+ * @param buffer - The code to be parsed
1092
+ * @param filename - Filename
1093
+ */
1094
+ parseCode(buffer: string, filename: string): Program;
1095
+ /**
1096
+ * Extract tokens from the specified buffer.
1097
+ * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all`
1098
+ * @returns - Each item can be a string or an array with following informations [token_name, text, line_number]
1099
+ */
1100
+ tokenGetAll(buffer: string): (string | string[])[];
1101
+ lexer: Lexer;
1102
+ parser: Parser;
1103
+ ast: AST;
1104
+ tokens: any;
1105
+ }
1106
+ /**
1107
+ * This is the php lexer. It will tokenize the string for helping the
1108
+ * parser to build the AST from its grammar.
1109
+ * @property all_tokens - defines if all tokens must be retrieved (used by token_get_all only)
1110
+ * @property comment_tokens - extracts comments tokens
1111
+ * @property mode_eval - enables the evald mode (ignore opening tags)
1112
+ * @property asp_tags - disables by default asp tags mode
1113
+ * @property short_tags - enables by default short tags mode
1114
+ * @property keywords - List of php keyword
1115
+ * @property castKeywords - List of php keywords for type casting
1116
+ */
1117
+ class Lexer {
1118
+ /**
1119
+ * Initialize the lexer with the specified input
1120
+ */
1121
+ setInput(): void;
1122
+ /**
1123
+ * consumes and returns one char from the input
1124
+ */
1125
+ input(): void;
1126
+ /**
1127
+ * revert eating specified size
1128
+ */
1129
+ unput(): void;
1130
+ /**
1131
+ * check if the text matches
1132
+ */
1133
+ tryMatch(text: string): boolean;
1134
+ /**
1135
+ * check if the text matches
1136
+ */
1137
+ tryMatchCaseless(text: string): boolean;
1138
+ /**
1139
+ * look ahead
1140
+ */
1141
+ ahead(size: number): string;
1142
+ /**
1143
+ * consume the specified size
1144
+ */
1145
+ consume(size: number): Lexer;
1146
+ /**
1147
+ * Gets the current state
1148
+ */
1149
+ getState(): void;
1150
+ /**
1151
+ * Sets the current lexer state
1152
+ */
1153
+ setState(): void;
1154
+ /**
1155
+ * prepend next token
1156
+ */
1157
+ appendToken(value: any, ahead: any): Lexer;
1158
+ /**
1159
+ * return next match that has a token
1160
+ */
1161
+ lex(): number | string;
1162
+ /**
1163
+ * activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1164
+ */
1165
+ begin(condition: any): Lexer;
1166
+ /**
1167
+ * pop the previously active lexer condition state off the condition stack
1168
+ */
1169
+ popState(): string | any;
1170
+ /**
1171
+ * return next match in input
1172
+ */
1173
+ next(): number | any;
1174
+ EOF: number;
1175
+ /**
1176
+ * defines if all tokens must be retrieved (used by token_get_all only)
1177
+ */
1178
+ all_tokens: boolean;
1179
+ /**
1180
+ * extracts comments tokens
1181
+ */
1182
+ comment_tokens: boolean;
1183
+ /**
1184
+ * enables the evald mode (ignore opening tags)
1185
+ */
1186
+ mode_eval: boolean;
1187
+ /**
1188
+ * disables by default asp tags mode
1189
+ */
1190
+ asp_tags: boolean;
1191
+ /**
1192
+ * enables by default short tags mode
1193
+ */
1194
+ short_tags: boolean;
1195
+ /**
1196
+ * List of php keyword
1197
+ */
1198
+ keywords: any;
1199
+ /**
1200
+ * List of php keywords for type casting
1201
+ */
1202
+ castKeywords: any;
1203
+ }
1204
+ /**
1205
+ * The PHP Parser class that build the AST tree from the lexer
1206
+ * @property lexer - current lexer instance
1207
+ * @property ast - the AST factory instance
1208
+ * @property token - current token
1209
+ * @property extractDoc - should extract documentation as AST node
1210
+ * @property extractTokens - should extract each token
1211
+ * @property suppressErrors - should ignore parsing errors and continue
1212
+ * @property debug - should output debug informations
1213
+ */
1214
+ class Parser {
1215
+ /**
1216
+ * helper : gets a token name
1217
+ */
1218
+ getTokenName(): void;
1219
+ /**
1220
+ * main entry point : converts a source code to AST
1221
+ */
1222
+ parse(): void;
1223
+ /**
1224
+ * Raise an error
1225
+ */
1226
+ raiseError(): void;
1227
+ /**
1228
+ * handling errors
1229
+ */
1230
+ error(): void;
1231
+ /**
1232
+ * Create a position node from the lexers position
1233
+ */
1234
+ position(): Position;
1235
+ /**
1236
+ * Creates a new AST node
1237
+ */
1238
+ node(): void;
1239
+ /**
1240
+ * expects an end of statement or end of file
1241
+ */
1242
+ expectEndOfStatement(): boolean;
1243
+ /**
1244
+ * Force the parser to check the current token.
1245
+ *
1246
+ * If the current token does not match to expected token,
1247
+ * the an error will be raised.
1248
+ *
1249
+ * If the suppressError mode is activated, then the error will
1250
+ * be added to the program error stack and this function will return `false`.
1251
+ */
1252
+ expect(token: string | number): boolean;
1253
+ /**
1254
+ * Returns the current token contents
1255
+ */
1256
+ text(): string;
1257
+ /**
1258
+ * consume the next token
1259
+ */
1260
+ next(): void;
1261
+ /**
1262
+ * Peek at the next token.
1263
+ * @returns Next Token
1264
+ */
1265
+ peek(): string | number;
1266
+ /**
1267
+ * Eating a token
1268
+ */
1269
+ lex(): void;
1270
+ /**
1271
+ * Check if token is of specified type
1272
+ */
1273
+ is(): void;
1274
+ /**
1275
+ * current lexer instance
1276
+ */
1277
+ lexer: Lexer;
1278
+ /**
1279
+ * the AST factory instance
1280
+ */
1281
+ ast: AST;
1282
+ /**
1283
+ * current token
1284
+ */
1285
+ token: number | string;
1286
+ /**
1287
+ * should extract documentation as AST node
1288
+ */
1289
+ extractDoc: boolean;
1290
+ /**
1291
+ * should extract each token
1292
+ */
1293
+ extractTokens: boolean;
1294
+ /**
1295
+ * should ignore parsing errors and continue
1296
+ */
1297
+ suppressErrors: boolean;
1298
+ /**
1299
+ * should output debug informations
1300
+ */
1301
+ debug: boolean;
1302
+ }
1303
+ const enum TokenNames {
1304
+ T_HALT_COMPILER = 101,
1305
+ T_USE = 102,
1306
+ T_ENCAPSED_AND_WHITESPACE = 103,
1307
+ T_OBJECT_OPERATOR = 104,
1308
+ T_STRING = 105,
1309
+ T_DOLLAR_OPEN_CURLY_BRACES = 106,
1310
+ T_STRING_VARNAME = 107,
1311
+ T_CURLY_OPEN = 108,
1312
+ T_NUM_STRING = 109,
1313
+ T_ISSET = 110,
1314
+ T_EMPTY = 111,
1315
+ T_INCLUDE = 112,
1316
+ T_INCLUDE_ONCE = 113,
1317
+ T_EVAL = 114,
1318
+ T_REQUIRE = 115,
1319
+ T_REQUIRE_ONCE = 116,
1320
+ T_NAMESPACE = 117,
1321
+ T_NS_SEPARATOR = 118,
1322
+ T_AS = 119,
1323
+ T_IF = 120,
1324
+ T_ENDIF = 121,
1325
+ T_WHILE = 122,
1326
+ T_DO = 123,
1327
+ T_FOR = 124,
1328
+ T_SWITCH = 125,
1329
+ T_BREAK = 126,
1330
+ T_CONTINUE = 127,
1331
+ T_RETURN = 128,
1332
+ T_GLOBAL = 129,
1333
+ T_STATIC = 130,
1334
+ T_ECHO = 131,
1335
+ T_INLINE_HTML = 132,
1336
+ T_UNSET = 133,
1337
+ T_FOREACH = 134,
1338
+ T_DECLARE = 135,
1339
+ T_TRY = 136,
1340
+ T_THROW = 137,
1341
+ T_GOTO = 138,
1342
+ T_FINALLY = 139,
1343
+ T_CATCH = 140,
1344
+ T_ENDDECLARE = 141,
1345
+ T_LIST = 142,
1346
+ T_CLONE = 143,
1347
+ T_PLUS_EQUAL = 144,
1348
+ T_MINUS_EQUAL = 145,
1349
+ T_MUL_EQUAL = 146,
1350
+ T_DIV_EQUAL = 147,
1351
+ T_CONCAT_EQUAL = 148,
1352
+ T_MOD_EQUAL = 149,
1353
+ T_AND_EQUAL = 150,
1354
+ T_OR_EQUAL = 151,
1355
+ T_XOR_EQUAL = 152,
1356
+ T_SL_EQUAL = 153,
1357
+ T_SR_EQUAL = 154,
1358
+ T_INC = 155,
1359
+ T_DEC = 156,
1360
+ T_BOOLEAN_OR = 157,
1361
+ T_BOOLEAN_AND = 158,
1362
+ T_LOGICAL_OR = 159,
1363
+ T_LOGICAL_AND = 160,
1364
+ T_LOGICAL_XOR = 161,
1365
+ T_SL = 162,
1366
+ T_SR = 163,
1367
+ T_IS_IDENTICAL = 164,
1368
+ T_IS_NOT_IDENTICAL = 165,
1369
+ T_IS_EQUAL = 166,
1370
+ T_IS_NOT_EQUAL = 167,
1371
+ T_IS_SMALLER_OR_EQUAL = 168,
1372
+ T_IS_GREATER_OR_EQUAL = 169,
1373
+ T_INSTANCEOF = 170,
1374
+ T_INT_CAST = 171,
1375
+ T_DOUBLE_CAST = 172,
1376
+ T_STRING_CAST = 173,
1377
+ T_ARRAY_CAST = 174,
1378
+ T_OBJECT_CAST = 175,
1379
+ T_BOOL_CAST = 176,
1380
+ T_UNSET_CAST = 177,
1381
+ T_EXIT = 178,
1382
+ T_PRINT = 179,
1383
+ T_YIELD = 180,
1384
+ T_YIELD_FROM = 181,
1385
+ T_FUNCTION = 182,
1386
+ T_DOUBLE_ARROW = 183,
1387
+ T_DOUBLE_COLON = 184,
1388
+ T_ARRAY = 185,
1389
+ T_CALLABLE = 186,
1390
+ T_CLASS = 187,
1391
+ T_ABSTRACT = 188,
1392
+ T_TRAIT = 189,
1393
+ T_FINAL = 190,
1394
+ T_EXTENDS = 191,
1395
+ T_INTERFACE = 192,
1396
+ T_IMPLEMENTS = 193,
1397
+ T_VAR = 194,
1398
+ T_PUBLIC = 195,
1399
+ T_PROTECTED = 196,
1400
+ T_PRIVATE = 197,
1401
+ T_CONST = 198,
1402
+ T_NEW = 199,
1403
+ T_INSTEADOF = 200,
1404
+ T_ELSEIF = 201,
1405
+ T_ELSE = 202,
1406
+ T_ENDSWITCH = 203,
1407
+ T_CASE = 204,
1408
+ T_DEFAULT = 205,
1409
+ T_ENDFOR = 206,
1410
+ T_ENDFOREACH = 207,
1411
+ T_ENDWHILE = 208,
1412
+ T_CONSTANT_ENCAPSED_STRING = 209,
1413
+ T_LNUMBER = 210,
1414
+ T_DNUMBER = 211,
1415
+ T_LINE = 212,
1416
+ T_FILE = 213,
1417
+ T_DIR = 214,
1418
+ T_TRAIT_C = 215,
1419
+ T_METHOD_C = 216,
1420
+ T_FUNC_C = 217,
1421
+ T_NS_C = 218,
1422
+ T_START_HEREDOC = 219,
1423
+ T_END_HEREDOC = 220,
1424
+ T_CLASS_C = 221,
1425
+ T_VARIABLE = 222,
1426
+ T_OPEN_TAG = 223,
1427
+ T_OPEN_TAG_WITH_ECHO = 224,
1428
+ T_CLOSE_TAG = 225,
1429
+ T_WHITESPACE = 226,
1430
+ T_COMMENT = 227,
1431
+ T_DOC_COMMENT = 228,
1432
+ T_ELLIPSIS = 229,
1433
+ T_COALESCE = 230,
1434
+ T_POW = 231,
1435
+ T_POW_EQUAL = 232,
1436
+ T_SPACESHIP = 233,
1437
+ T_COALESCE_EQUAL = 234,
1438
+ T_FN = 235,
1439
+ T_NULLSAFE_OBJECT_OPERATOR = 236,
1440
+ T_MATCH = 237,
1441
+ T_ATTRIBUTE = 238,
1442
+ T_ENUM = 239,
1443
+ T_READ_ONLY = 240,
1444
+ T_NAME_RELATIVE = 241,
1445
+ T_NAME_QUALIFIED = 242,
1446
+ T_NAME_FULLY_QUALIFIED = 243,
1447
+ }
1448
+ /**
1449
+ * PHP AST Tokens
1450
+ */
1451
+ const tokens: {
1452
+ values: {
1453
+ [key: number]: string;
1454
+ };
1455
+ names: TokenNames;
1456
+ };
1457
+ }