@ant-yasa/uast-parser-php 0.2.9 → 0.2.10
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/dist/package.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +26 -0
- package/src/parser.ts +1234 -0
- package/tests/benchmark/base/advanced.php +20 -0
- package/tests/benchmark/base/advanced.php.json +1269 -0
- package/tests/benchmark/base/basic.php +3 -0
- package/tests/benchmark/base/basic.php.json +292 -0
- package/tests/benchmark/base/closure-class.php +24 -0
- package/tests/benchmark/base/closure-class.php.json +1623 -0
- package/tests/benchmark/base/control-flow.php +37 -0
- package/tests/benchmark/base/control-flow.php.json +2010 -0
- package/tests/benchmark/base/enum-trait-adapt.php +31 -0
- package/tests/benchmark/base/enum-trait-adapt.php.json +965 -0
- package/tests/benchmark/base/exprs.php +4 -0
- package/tests/benchmark/base/exprs.php.json +811 -0
- package/tests/benchmark/base/flow-extras.php +12 -0
- package/tests/benchmark/base/flow-extras.php.json +897 -0
- package/tests/benchmark/base/function.php +7 -0
- package/tests/benchmark/base/function.php.json +536 -0
- package/tests/benchmark/base/modern-php.php +13 -0
- package/tests/benchmark/base/modern-php.php.json +508 -0
- package/tests/benchmark/base/namespace.php +5 -0
- package/tests/benchmark/base/namespace.php.json +307 -0
- package/tests/benchmark/base/new-static.php +3 -0
- package/tests/benchmark/base/new-static.php.json +399 -0
- package/tests/benchmark/base/runtime.php +13 -0
- package/tests/benchmark/base/runtime.php.json +1095 -0
- package/tests/benchmark/base/strings-casts.php +17 -0
- package/tests/benchmark/base/strings-casts.php.json +1357 -0
- package/tests/benchmark/base/structures.php +26 -0
- package/tests/benchmark/base/structures.php.json +1582 -0
- package/tests/index.ts +87 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "CompileUnit",
|
|
3
|
+
"body": [
|
|
4
|
+
{
|
|
5
|
+
"type": "ClassDefinition",
|
|
6
|
+
"id": {
|
|
7
|
+
"type": "Identifier",
|
|
8
|
+
"name": "Service",
|
|
9
|
+
"_meta": {
|
|
10
|
+
"loc": {
|
|
11
|
+
"start": {
|
|
12
|
+
"line": 4,
|
|
13
|
+
"column": 7
|
|
14
|
+
},
|
|
15
|
+
"end": {
|
|
16
|
+
"line": 4,
|
|
17
|
+
"column": 14
|
|
18
|
+
},
|
|
19
|
+
"sourcefile": "modern-php.php"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"loc": {
|
|
23
|
+
"start": {
|
|
24
|
+
"line": 4,
|
|
25
|
+
"column": 7
|
|
26
|
+
},
|
|
27
|
+
"end": {
|
|
28
|
+
"line": 4,
|
|
29
|
+
"column": 14
|
|
30
|
+
},
|
|
31
|
+
"sourcefile": "modern-php.php"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"body": [
|
|
35
|
+
{
|
|
36
|
+
"type": "ExpressionStatement",
|
|
37
|
+
"expression": {
|
|
38
|
+
"type": "CallExpression",
|
|
39
|
+
"callee": {
|
|
40
|
+
"type": "Identifier",
|
|
41
|
+
"name": "trait_use",
|
|
42
|
+
"_meta": {}
|
|
43
|
+
},
|
|
44
|
+
"arguments": [
|
|
45
|
+
{
|
|
46
|
+
"type": "Identifier",
|
|
47
|
+
"name": "LoggerTrait",
|
|
48
|
+
"_meta": {
|
|
49
|
+
"loc": {
|
|
50
|
+
"start": {
|
|
51
|
+
"line": 6,
|
|
52
|
+
"column": 9
|
|
53
|
+
},
|
|
54
|
+
"end": {
|
|
55
|
+
"line": 6,
|
|
56
|
+
"column": 20
|
|
57
|
+
},
|
|
58
|
+
"sourcefile": "modern-php.php"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"loc": {
|
|
62
|
+
"start": {
|
|
63
|
+
"line": 6,
|
|
64
|
+
"column": 9
|
|
65
|
+
},
|
|
66
|
+
"end": {
|
|
67
|
+
"line": 6,
|
|
68
|
+
"column": 20
|
|
69
|
+
},
|
|
70
|
+
"sourcefile": "modern-php.php"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "Identifier",
|
|
75
|
+
"name": "CacheTrait",
|
|
76
|
+
"_meta": {
|
|
77
|
+
"loc": {
|
|
78
|
+
"start": {
|
|
79
|
+
"line": 6,
|
|
80
|
+
"column": 22
|
|
81
|
+
},
|
|
82
|
+
"end": {
|
|
83
|
+
"line": 6,
|
|
84
|
+
"column": 32
|
|
85
|
+
},
|
|
86
|
+
"sourcefile": "modern-php.php"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"loc": {
|
|
90
|
+
"start": {
|
|
91
|
+
"line": 6,
|
|
92
|
+
"column": 22
|
|
93
|
+
},
|
|
94
|
+
"end": {
|
|
95
|
+
"line": 6,
|
|
96
|
+
"column": 32
|
|
97
|
+
},
|
|
98
|
+
"sourcefile": "modern-php.php"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"_meta": {
|
|
103
|
+
"synthetic": true,
|
|
104
|
+
"loc": {
|
|
105
|
+
"start": {
|
|
106
|
+
"line": 6,
|
|
107
|
+
"column": 5
|
|
108
|
+
},
|
|
109
|
+
"end": {
|
|
110
|
+
"line": 6,
|
|
111
|
+
"column": 33
|
|
112
|
+
},
|
|
113
|
+
"sourcefile": "modern-php.php"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"loc": {
|
|
117
|
+
"start": {
|
|
118
|
+
"line": 6,
|
|
119
|
+
"column": 5
|
|
120
|
+
},
|
|
121
|
+
"end": {
|
|
122
|
+
"line": 6,
|
|
123
|
+
"column": 33
|
|
124
|
+
},
|
|
125
|
+
"sourcefile": "modern-php.php"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"_meta": {
|
|
129
|
+
"loc": {
|
|
130
|
+
"start": {
|
|
131
|
+
"line": 6,
|
|
132
|
+
"column": 5
|
|
133
|
+
},
|
|
134
|
+
"end": {
|
|
135
|
+
"line": 6,
|
|
136
|
+
"column": 33
|
|
137
|
+
},
|
|
138
|
+
"sourcefile": "modern-php.php"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"loc": {
|
|
142
|
+
"start": {
|
|
143
|
+
"line": 6,
|
|
144
|
+
"column": 5
|
|
145
|
+
},
|
|
146
|
+
"end": {
|
|
147
|
+
"line": 6,
|
|
148
|
+
"column": 33
|
|
149
|
+
},
|
|
150
|
+
"sourcefile": "modern-php.php"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "FunctionDefinition",
|
|
155
|
+
"id": {
|
|
156
|
+
"type": "Identifier",
|
|
157
|
+
"name": "run",
|
|
158
|
+
"_meta": {
|
|
159
|
+
"loc": {
|
|
160
|
+
"start": {
|
|
161
|
+
"line": 9,
|
|
162
|
+
"column": 21
|
|
163
|
+
},
|
|
164
|
+
"end": {
|
|
165
|
+
"line": 9,
|
|
166
|
+
"column": 24
|
|
167
|
+
},
|
|
168
|
+
"sourcefile": "modern-php.php"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"loc": {
|
|
172
|
+
"start": {
|
|
173
|
+
"line": 9,
|
|
174
|
+
"column": 21
|
|
175
|
+
},
|
|
176
|
+
"end": {
|
|
177
|
+
"line": 9,
|
|
178
|
+
"column": 24
|
|
179
|
+
},
|
|
180
|
+
"sourcefile": "modern-php.php"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"parameters": [
|
|
184
|
+
{
|
|
185
|
+
"type": "VariableDeclaration",
|
|
186
|
+
"id": {
|
|
187
|
+
"type": "Identifier",
|
|
188
|
+
"name": "x",
|
|
189
|
+
"_meta": {
|
|
190
|
+
"loc": {
|
|
191
|
+
"start": {
|
|
192
|
+
"line": 9,
|
|
193
|
+
"column": 37
|
|
194
|
+
},
|
|
195
|
+
"end": {
|
|
196
|
+
"line": 9,
|
|
197
|
+
"column": 39
|
|
198
|
+
},
|
|
199
|
+
"sourcefile": "modern-php.php"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"loc": {
|
|
203
|
+
"start": {
|
|
204
|
+
"line": 9,
|
|
205
|
+
"column": 37
|
|
206
|
+
},
|
|
207
|
+
"end": {
|
|
208
|
+
"line": 9,
|
|
209
|
+
"column": 39
|
|
210
|
+
},
|
|
211
|
+
"sourcefile": "modern-php.php"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"init": null,
|
|
215
|
+
"cloned": false,
|
|
216
|
+
"varType": {
|
|
217
|
+
"type": "DynamicType",
|
|
218
|
+
"id": null,
|
|
219
|
+
"_meta": {}
|
|
220
|
+
},
|
|
221
|
+
"_meta": {
|
|
222
|
+
"variadic": false,
|
|
223
|
+
"loc": {
|
|
224
|
+
"start": {
|
|
225
|
+
"line": 9,
|
|
226
|
+
"column": 25
|
|
227
|
+
},
|
|
228
|
+
"end": {
|
|
229
|
+
"line": 9,
|
|
230
|
+
"column": 39
|
|
231
|
+
},
|
|
232
|
+
"sourcefile": "modern-php.php"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"loc": {
|
|
236
|
+
"start": {
|
|
237
|
+
"line": 9,
|
|
238
|
+
"column": 25
|
|
239
|
+
},
|
|
240
|
+
"end": {
|
|
241
|
+
"line": 9,
|
|
242
|
+
"column": 39
|
|
243
|
+
},
|
|
244
|
+
"sourcefile": "modern-php.php"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"returnType": {
|
|
249
|
+
"type": "DynamicType",
|
|
250
|
+
"id": null,
|
|
251
|
+
"_meta": {}
|
|
252
|
+
},
|
|
253
|
+
"body": {
|
|
254
|
+
"type": "ScopedStatement",
|
|
255
|
+
"body": [
|
|
256
|
+
{
|
|
257
|
+
"type": "ReturnStatement",
|
|
258
|
+
"argument": {
|
|
259
|
+
"type": "CallExpression",
|
|
260
|
+
"callee": {
|
|
261
|
+
"type": "Identifier",
|
|
262
|
+
"name": "foo",
|
|
263
|
+
"_meta": {
|
|
264
|
+
"loc": {
|
|
265
|
+
"start": {
|
|
266
|
+
"line": 11,
|
|
267
|
+
"column": 16
|
|
268
|
+
},
|
|
269
|
+
"end": {
|
|
270
|
+
"line": 11,
|
|
271
|
+
"column": 19
|
|
272
|
+
},
|
|
273
|
+
"sourcefile": "modern-php.php"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"loc": {
|
|
277
|
+
"start": {
|
|
278
|
+
"line": 11,
|
|
279
|
+
"column": 16
|
|
280
|
+
},
|
|
281
|
+
"end": {
|
|
282
|
+
"line": 11,
|
|
283
|
+
"column": 19
|
|
284
|
+
},
|
|
285
|
+
"sourcefile": "modern-php.php"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"arguments": [
|
|
289
|
+
{
|
|
290
|
+
"type": "Identifier",
|
|
291
|
+
"name": "name",
|
|
292
|
+
"_meta": {
|
|
293
|
+
"loc": {
|
|
294
|
+
"start": {
|
|
295
|
+
"line": 11,
|
|
296
|
+
"column": 20
|
|
297
|
+
},
|
|
298
|
+
"end": {
|
|
299
|
+
"line": 11,
|
|
300
|
+
"column": 24
|
|
301
|
+
},
|
|
302
|
+
"sourcefile": "modern-php.php"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"loc": {
|
|
306
|
+
"start": {
|
|
307
|
+
"line": 11,
|
|
308
|
+
"column": 20
|
|
309
|
+
},
|
|
310
|
+
"end": {
|
|
311
|
+
"line": 11,
|
|
312
|
+
"column": 24
|
|
313
|
+
},
|
|
314
|
+
"sourcefile": "modern-php.php"
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"type": "Identifier",
|
|
319
|
+
"name": "count",
|
|
320
|
+
"_meta": {
|
|
321
|
+
"loc": {
|
|
322
|
+
"start": {
|
|
323
|
+
"line": 11,
|
|
324
|
+
"column": 30
|
|
325
|
+
},
|
|
326
|
+
"end": {
|
|
327
|
+
"line": 11,
|
|
328
|
+
"column": 35
|
|
329
|
+
},
|
|
330
|
+
"sourcefile": "modern-php.php"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"loc": {
|
|
334
|
+
"start": {
|
|
335
|
+
"line": 11,
|
|
336
|
+
"column": 30
|
|
337
|
+
},
|
|
338
|
+
"end": {
|
|
339
|
+
"line": 11,
|
|
340
|
+
"column": 35
|
|
341
|
+
},
|
|
342
|
+
"sourcefile": "modern-php.php"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
"_meta": {
|
|
347
|
+
"loc": {
|
|
348
|
+
"start": {
|
|
349
|
+
"line": 11,
|
|
350
|
+
"column": 16
|
|
351
|
+
},
|
|
352
|
+
"end": {
|
|
353
|
+
"line": 11,
|
|
354
|
+
"column": 39
|
|
355
|
+
},
|
|
356
|
+
"sourcefile": "modern-php.php"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"loc": {
|
|
360
|
+
"start": {
|
|
361
|
+
"line": 11,
|
|
362
|
+
"column": 16
|
|
363
|
+
},
|
|
364
|
+
"end": {
|
|
365
|
+
"line": 11,
|
|
366
|
+
"column": 39
|
|
367
|
+
},
|
|
368
|
+
"sourcefile": "modern-php.php"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"isYield": false,
|
|
372
|
+
"_meta": {
|
|
373
|
+
"loc": {
|
|
374
|
+
"start": {
|
|
375
|
+
"line": 11,
|
|
376
|
+
"column": 9
|
|
377
|
+
},
|
|
378
|
+
"end": {
|
|
379
|
+
"line": 11,
|
|
380
|
+
"column": 40
|
|
381
|
+
},
|
|
382
|
+
"sourcefile": "modern-php.php"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"loc": {
|
|
386
|
+
"start": {
|
|
387
|
+
"line": 11,
|
|
388
|
+
"column": 9
|
|
389
|
+
},
|
|
390
|
+
"end": {
|
|
391
|
+
"line": 11,
|
|
392
|
+
"column": 40
|
|
393
|
+
},
|
|
394
|
+
"sourcefile": "modern-php.php"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
"id": null,
|
|
399
|
+
"_meta": {
|
|
400
|
+
"loc": {
|
|
401
|
+
"start": {
|
|
402
|
+
"line": 10,
|
|
403
|
+
"column": 5
|
|
404
|
+
},
|
|
405
|
+
"end": {
|
|
406
|
+
"line": 12,
|
|
407
|
+
"column": 6
|
|
408
|
+
},
|
|
409
|
+
"sourcefile": "modern-php.php"
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"loc": {
|
|
413
|
+
"start": {
|
|
414
|
+
"line": 10,
|
|
415
|
+
"column": 5
|
|
416
|
+
},
|
|
417
|
+
"end": {
|
|
418
|
+
"line": 12,
|
|
419
|
+
"column": 6
|
|
420
|
+
},
|
|
421
|
+
"sourcefile": "modern-php.php"
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"modifiers": [
|
|
425
|
+
"public"
|
|
426
|
+
],
|
|
427
|
+
"_meta": {
|
|
428
|
+
"loc": {
|
|
429
|
+
"start": {
|
|
430
|
+
"line": 8,
|
|
431
|
+
"column": 5
|
|
432
|
+
},
|
|
433
|
+
"end": {
|
|
434
|
+
"line": 12,
|
|
435
|
+
"column": 6
|
|
436
|
+
},
|
|
437
|
+
"sourcefile": "modern-php.php"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"loc": {
|
|
441
|
+
"start": {
|
|
442
|
+
"line": 8,
|
|
443
|
+
"column": 5
|
|
444
|
+
},
|
|
445
|
+
"end": {
|
|
446
|
+
"line": 12,
|
|
447
|
+
"column": 6
|
|
448
|
+
},
|
|
449
|
+
"sourcefile": "modern-php.php"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
"supers": [],
|
|
454
|
+
"_meta": {
|
|
455
|
+
"loc": {
|
|
456
|
+
"start": {
|
|
457
|
+
"line": 3,
|
|
458
|
+
"column": 1
|
|
459
|
+
},
|
|
460
|
+
"end": {
|
|
461
|
+
"line": 13,
|
|
462
|
+
"column": 2
|
|
463
|
+
},
|
|
464
|
+
"sourcefile": "modern-php.php"
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
"loc": {
|
|
468
|
+
"start": {
|
|
469
|
+
"line": 3,
|
|
470
|
+
"column": 1
|
|
471
|
+
},
|
|
472
|
+
"end": {
|
|
473
|
+
"line": 13,
|
|
474
|
+
"column": 2
|
|
475
|
+
},
|
|
476
|
+
"sourcefile": "modern-php.php"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"language": "php",
|
|
481
|
+
"languageVersion": null,
|
|
482
|
+
"uri": "modern-php.php",
|
|
483
|
+
"version": "0.0.0",
|
|
484
|
+
"_meta": {
|
|
485
|
+
"loc": {
|
|
486
|
+
"start": {
|
|
487
|
+
"line": 1,
|
|
488
|
+
"column": 1
|
|
489
|
+
},
|
|
490
|
+
"end": {
|
|
491
|
+
"line": 14,
|
|
492
|
+
"column": 1
|
|
493
|
+
},
|
|
494
|
+
"sourcefile": "modern-php.php"
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
"loc": {
|
|
498
|
+
"start": {
|
|
499
|
+
"line": 1,
|
|
500
|
+
"column": 1
|
|
501
|
+
},
|
|
502
|
+
"end": {
|
|
503
|
+
"line": 14,
|
|
504
|
+
"column": 1
|
|
505
|
+
},
|
|
506
|
+
"sourcefile": "modern-php.php"
|
|
507
|
+
}
|
|
508
|
+
}
|