|
2 | 2 |
|
3 | 3 | ## AST
|
4 | 4 |
|
5 |
| -The AST builder class |
6 |
| - |
7 |
| -**Parameters** |
8 |
| - |
9 |
| -- `withPositions` |
10 |
| -- `withSource` |
11 |
| - |
12 |
| -**Properties** |
13 |
| - |
14 |
| -- `withPositions` **[Boolean](#boolean)** Should locate any node (by default false) |
15 |
| -- `withSource` **[Boolean](#boolean)** Should extract the node original code (by default false) |
16 |
| - |
17 |
| -### prepare |
18 |
| - |
19 |
| -Prepares an AST node |
20 |
| - |
21 |
| -**Parameters** |
22 |
| - |
23 |
| -- `kind` **([String](#string) | null)** Defines the node type |
24 |
| - (if null, the kind must be passed at the function call) |
25 |
| -- `parser` **Parser** The parser instance (use for extracting locations) |
26 |
| - |
27 |
| -Returns **[Function](#function)** |
28 |
| - |
29 |
| -## AST |
30 |
| - |
31 | 5 | ## Class hierarchy
|
32 | 6 |
|
33 | 7 | - [Location](#location)
|
@@ -135,6 +109,32 @@ Prepares an AST node
|
135 | 109 |
|
136 | 110 | Returns **[Function](#function)**
|
137 | 111 |
|
| 112 | +## AST |
| 113 | + |
| 114 | +The AST builder class |
| 115 | + |
| 116 | +**Parameters** |
| 117 | + |
| 118 | +- `withPositions` |
| 119 | +- `withSource` |
| 120 | + |
| 121 | +**Properties** |
| 122 | + |
| 123 | +- `withPositions` **[Boolean](#boolean)** Should locate any node (by default false) |
| 124 | +- `withSource` **[Boolean](#boolean)** Should extract the node original code (by default false) |
| 125 | + |
| 126 | +### prepare |
| 127 | + |
| 128 | +Prepares an AST node |
| 129 | + |
| 130 | +**Parameters** |
| 131 | + |
| 132 | +- `kind` **([String](#string) | null)** Defines the node type |
| 133 | + (if null, the kind must be passed at the function call) |
| 134 | +- `parser` **Parser** The parser instance (use for extracting locations) |
| 135 | + |
| 136 | +Returns **[Function](#function)** |
| 137 | + |
138 | 138 | ## Array
|
139 | 139 |
|
140 | 140 | **Extends Expression**
|
@@ -1189,8 +1189,23 @@ be any expression in general, an expression can also be a pattern.
|
1189 | 1189 |
|
1190 | 1190 | **Properties**
|
1191 | 1191 |
|
1192 |
| -- `name` **([String](#string) \| [Node](#node))** |
1193 |
| -- `byref` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** |
| 1192 | +- `name` **([String](#string) \| [Node](#node))** The variable name (can be a complex expression when the name is resolved dynamically) |
| 1193 | +- `byref` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Indicate if the variable reference is used, ex `&$foo` |
| 1194 | +- `curly` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Indicate if the name is defined between curlies, ex `${foo}` |
| 1195 | + |
| 1196 | +**Examples** |
| 1197 | + |
| 1198 | +```javascript |
| 1199 | +// PHP code : |
| 1200 | +&$foo |
| 1201 | +// AST output |
| 1202 | +{ |
| 1203 | + "kind": "variable", |
| 1204 | + "name": "foo", |
| 1205 | + "byref": true, |
| 1206 | + "curly": false |
| 1207 | +} |
| 1208 | +``` |
1194 | 1209 |
|
1195 | 1210 | ## Variadic
|
1196 | 1211 |
|
|
0 commit comments