@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.
Files changed (33) hide show
  1. package/dist/package.json +1 -1
  2. package/package.json +1 -1
  3. package/src/index.ts +26 -0
  4. package/src/parser.ts +1234 -0
  5. package/tests/benchmark/base/advanced.php +20 -0
  6. package/tests/benchmark/base/advanced.php.json +1269 -0
  7. package/tests/benchmark/base/basic.php +3 -0
  8. package/tests/benchmark/base/basic.php.json +292 -0
  9. package/tests/benchmark/base/closure-class.php +24 -0
  10. package/tests/benchmark/base/closure-class.php.json +1623 -0
  11. package/tests/benchmark/base/control-flow.php +37 -0
  12. package/tests/benchmark/base/control-flow.php.json +2010 -0
  13. package/tests/benchmark/base/enum-trait-adapt.php +31 -0
  14. package/tests/benchmark/base/enum-trait-adapt.php.json +965 -0
  15. package/tests/benchmark/base/exprs.php +4 -0
  16. package/tests/benchmark/base/exprs.php.json +811 -0
  17. package/tests/benchmark/base/flow-extras.php +12 -0
  18. package/tests/benchmark/base/flow-extras.php.json +897 -0
  19. package/tests/benchmark/base/function.php +7 -0
  20. package/tests/benchmark/base/function.php.json +536 -0
  21. package/tests/benchmark/base/modern-php.php +13 -0
  22. package/tests/benchmark/base/modern-php.php.json +508 -0
  23. package/tests/benchmark/base/namespace.php +5 -0
  24. package/tests/benchmark/base/namespace.php.json +307 -0
  25. package/tests/benchmark/base/new-static.php +3 -0
  26. package/tests/benchmark/base/new-static.php.json +399 -0
  27. package/tests/benchmark/base/runtime.php +13 -0
  28. package/tests/benchmark/base/runtime.php.json +1095 -0
  29. package/tests/benchmark/base/strings-casts.php +17 -0
  30. package/tests/benchmark/base/strings-casts.php.json +1357 -0
  31. package/tests/benchmark/base/structures.php +26 -0
  32. package/tests/benchmark/base/structures.php.json +1582 -0
  33. package/tests/index.ts +87 -0
@@ -0,0 +1,3 @@
1
+ <?php
2
+ $a = $_GET["id"];
3
+ echo $a;
@@ -0,0 +1,292 @@
1
+ {
2
+ "type": "CompileUnit",
3
+ "body": [
4
+ {
5
+ "type": "ExpressionStatement",
6
+ "expression": {
7
+ "type": "AssignmentExpression",
8
+ "left": {
9
+ "type": "Identifier",
10
+ "name": "a",
11
+ "_meta": {
12
+ "loc": {
13
+ "start": {
14
+ "line": 2,
15
+ "column": 1
16
+ },
17
+ "end": {
18
+ "line": 2,
19
+ "column": 3
20
+ },
21
+ "sourcefile": "basic.php"
22
+ }
23
+ },
24
+ "loc": {
25
+ "start": {
26
+ "line": 2,
27
+ "column": 1
28
+ },
29
+ "end": {
30
+ "line": 2,
31
+ "column": 3
32
+ },
33
+ "sourcefile": "basic.php"
34
+ }
35
+ },
36
+ "right": {
37
+ "type": "MemberAccess",
38
+ "object": {
39
+ "type": "Identifier",
40
+ "name": "_GET",
41
+ "_meta": {
42
+ "loc": {
43
+ "start": {
44
+ "line": 2,
45
+ "column": 6
46
+ },
47
+ "end": {
48
+ "line": 2,
49
+ "column": 11
50
+ },
51
+ "sourcefile": "basic.php"
52
+ }
53
+ },
54
+ "loc": {
55
+ "start": {
56
+ "line": 2,
57
+ "column": 6
58
+ },
59
+ "end": {
60
+ "line": 2,
61
+ "column": 11
62
+ },
63
+ "sourcefile": "basic.php"
64
+ }
65
+ },
66
+ "property": {
67
+ "type": "Literal",
68
+ "value": "id",
69
+ "literalType": "string",
70
+ "_meta": {
71
+ "loc": {
72
+ "start": {
73
+ "line": 2,
74
+ "column": 12
75
+ },
76
+ "end": {
77
+ "line": 2,
78
+ "column": 16
79
+ },
80
+ "sourcefile": "basic.php"
81
+ },
82
+ "encapsed": true
83
+ },
84
+ "loc": {
85
+ "start": {
86
+ "line": 2,
87
+ "column": 12
88
+ },
89
+ "end": {
90
+ "line": 2,
91
+ "column": 16
92
+ },
93
+ "sourcefile": "basic.php"
94
+ }
95
+ },
96
+ "computed": true,
97
+ "_meta": {
98
+ "loc": {
99
+ "start": {
100
+ "line": 2,
101
+ "column": 6
102
+ },
103
+ "end": {
104
+ "line": 2,
105
+ "column": 17
106
+ },
107
+ "sourcefile": "basic.php"
108
+ }
109
+ },
110
+ "loc": {
111
+ "start": {
112
+ "line": 2,
113
+ "column": 6
114
+ },
115
+ "end": {
116
+ "line": 2,
117
+ "column": 17
118
+ },
119
+ "sourcefile": "basic.php"
120
+ }
121
+ },
122
+ "operator": "=",
123
+ "cloned": false,
124
+ "_meta": {
125
+ "loc": {
126
+ "start": {
127
+ "line": 2,
128
+ "column": 1
129
+ },
130
+ "end": {
131
+ "line": 2,
132
+ "column": 17
133
+ },
134
+ "sourcefile": "basic.php"
135
+ }
136
+ },
137
+ "loc": {
138
+ "start": {
139
+ "line": 2,
140
+ "column": 1
141
+ },
142
+ "end": {
143
+ "line": 2,
144
+ "column": 17
145
+ },
146
+ "sourcefile": "basic.php"
147
+ }
148
+ },
149
+ "_meta": {
150
+ "loc": {
151
+ "start": {
152
+ "line": 2,
153
+ "column": 1
154
+ },
155
+ "end": {
156
+ "line": 2,
157
+ "column": 18
158
+ },
159
+ "sourcefile": "basic.php"
160
+ }
161
+ },
162
+ "loc": {
163
+ "start": {
164
+ "line": 2,
165
+ "column": 1
166
+ },
167
+ "end": {
168
+ "line": 2,
169
+ "column": 18
170
+ },
171
+ "sourcefile": "basic.php"
172
+ }
173
+ },
174
+ {
175
+ "type": "ExpressionStatement",
176
+ "expression": {
177
+ "type": "CallExpression",
178
+ "callee": {
179
+ "type": "Identifier",
180
+ "name": "echo",
181
+ "_meta": {}
182
+ },
183
+ "arguments": [
184
+ {
185
+ "type": "Identifier",
186
+ "name": "a",
187
+ "_meta": {
188
+ "loc": {
189
+ "start": {
190
+ "line": 3,
191
+ "column": 6
192
+ },
193
+ "end": {
194
+ "line": 3,
195
+ "column": 8
196
+ },
197
+ "sourcefile": "basic.php"
198
+ }
199
+ },
200
+ "loc": {
201
+ "start": {
202
+ "line": 3,
203
+ "column": 6
204
+ },
205
+ "end": {
206
+ "line": 3,
207
+ "column": 8
208
+ },
209
+ "sourcefile": "basic.php"
210
+ }
211
+ }
212
+ ],
213
+ "_meta": {
214
+ "loc": {
215
+ "start": {
216
+ "line": 3,
217
+ "column": 1
218
+ },
219
+ "end": {
220
+ "line": 3,
221
+ "column": 9
222
+ },
223
+ "sourcefile": "basic.php"
224
+ }
225
+ },
226
+ "loc": {
227
+ "start": {
228
+ "line": 3,
229
+ "column": 1
230
+ },
231
+ "end": {
232
+ "line": 3,
233
+ "column": 9
234
+ },
235
+ "sourcefile": "basic.php"
236
+ }
237
+ },
238
+ "_meta": {
239
+ "loc": {
240
+ "start": {
241
+ "line": 3,
242
+ "column": 1
243
+ },
244
+ "end": {
245
+ "line": 3,
246
+ "column": 9
247
+ },
248
+ "sourcefile": "basic.php"
249
+ }
250
+ },
251
+ "loc": {
252
+ "start": {
253
+ "line": 3,
254
+ "column": 1
255
+ },
256
+ "end": {
257
+ "line": 3,
258
+ "column": 9
259
+ },
260
+ "sourcefile": "basic.php"
261
+ }
262
+ }
263
+ ],
264
+ "language": "php",
265
+ "languageVersion": null,
266
+ "uri": "basic.php",
267
+ "version": "0.0.0",
268
+ "_meta": {
269
+ "loc": {
270
+ "start": {
271
+ "line": 1,
272
+ "column": 1
273
+ },
274
+ "end": {
275
+ "line": 4,
276
+ "column": 1
277
+ },
278
+ "sourcefile": "basic.php"
279
+ }
280
+ },
281
+ "loc": {
282
+ "start": {
283
+ "line": 1,
284
+ "column": 1
285
+ },
286
+ "end": {
287
+ "line": 4,
288
+ "column": 1
289
+ },
290
+ "sourcefile": "basic.php"
291
+ }
292
+ }
@@ -0,0 +1,24 @@
1
+ <?php
2
+
3
+ class Demo extends BaseClass
4
+ {
5
+ public $name = 'x';
6
+ private static $count = 1;
7
+ const DEFAULT_COUNT = 2;
8
+
9
+ public function build($input)
10
+ {
11
+ $handler = function ($x) use ($input) {
12
+ return $x + $input;
13
+ };
14
+
15
+ $alias =& $input;
16
+ $copy = clone $this;
17
+
18
+ if (isset($alias, $copy) && !empty($input)) {
19
+ return $handler($alias);
20
+ }
21
+
22
+ return null;
23
+ }
24
+ }