Skip to content

Commit b283867

Browse files
committed
glayzzle#51 add variable
1 parent 52f2659 commit b283867

File tree

1 file changed

+43
-28
lines changed

1 file changed

+43
-28
lines changed

docs/AST.md

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,6 @@
22

33
## AST
44

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-
315
## Class hierarchy
326

337
- [Location](#location)
@@ -135,6 +109,32 @@ Prepares an AST node
135109

136110
Returns **[Function](#function)**
137111

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+
138138
## Array
139139

140140
**Extends Expression**
@@ -1189,8 +1189,23 @@ be any expression in general, an expression can also be a pattern.
11891189

11901190
**Properties**
11911191

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+
```
11941209

11951210
## Variadic
11961211

0 commit comments

Comments
 (0)