forked from glayzzle/php-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
45 lines (42 loc) · 1.13 KB
/
array.js
File metadata and controls
45 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*!
* Copyright (C) 2017 Glayzzle (BSD3 License)
* @authors https://github.com/glayzzle/php-parser/graphs/contributors
* @url http://glayzzle.com
*/
var Expr = require('./expression');
var KIND = 'array';
/**
* Defines an array structure
* @constructor Array
* @example
* // PHP code :
* [1, 'foo' => 'bar', 3]
*
* // AST structure :
* {
* "kind": "array",
* "shortForm": true
* "items": [{
* "kind": "entry",
* "key": null,
* "value": {"kind": "number", "value": "1"}
* }, {
* "kind": "entry",
* "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
* "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
* }, {
* "kind": "entry",
* "key": null,
* "value": {"kind": "number", "value": "3"}
* }]
* }
* @extends {Expression}
* @property {Entry[]} items List of array items
* @property {boolean} shortForm Indicate if the short array syntax is used, ex `[]` instead `array()`
*/
var Array = Expr.extends(function Array(shortForm, items, location) {
Expr.apply(this, [KIND, location]);
this.items = items;
this.shortForm = shortForm;
});
module.exports = Array;