Skip to content

Commit 9fab4f0

Browse files
author
Filippo Conti
committed
Use upstream master
2 parents 6bd1327 + c18b945 commit 9fab4f0

File tree

7 files changed

+28
-31
lines changed

7 files changed

+28
-31
lines changed

src/ast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ AST.prototype.prepare = function(kind, docs, parser) {
279279
};
280280
/**
281281
* Helper to change a node kind
282-
* @param {String} newKind
282+
* @param {String} newKind
283283
*/
284284
result.setKind = function(newKind) {
285-
kind = newKind;
285+
kind = newKind;
286286
};
287287
return result;
288288
};

src/ast/array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const KIND = "array";
2525
* "kind": "entry",
2626
* "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
2727
* "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
28-
* },
28+
* },
2929
* {"kind": "number", "value": "3"}
3030
* ]
3131
* }

src/ast/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Node = function Node(kind, docs, location) {
2525

2626
/**
2727
* Includes current token position of the parser
28-
* @param {*} parser
28+
* @param {*} parser
2929
*/
3030
Node.prototype.includeToken = function(parser) {
3131
if (this.loc) {

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ parser.prototype.expectEndOfStatement = function(node) {
361361
if (this.token === ";") {
362362
// include only real ';' statements
363363
// https://github.com/glayzzle/php-parser/issues/164
364-
if (node && this.lexer.yytext === ";") {
364+
if (node && this.lexer.yytext === ';') {
365365
node.includeToken(this);
366366
}
367367
} else if (this.token !== this.tok.T_INLINE_HTML && this.token !== this.EOF) {

src/parser/array.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ module.exports = {
3333
items = this.read_array_pair_list(shortForm);
3434
}
3535
// check non empty entries
36-
items.forEach(
37-
function(item) {
38-
if (item === null) {
39-
this.raiseError("Cannot use empty array elements in arrays");
40-
}
41-
}.bind(this)
42-
);
36+
items.forEach(function(item) {
37+
if (item === null) {
38+
this.raiseError(
39+
"Cannot use empty array elements in arrays"
40+
);
41+
}
42+
}.bind(this));
4343
this.expect(expect);
4444
this.next();
4545
return result(shortForm, items);
@@ -54,7 +54,7 @@ module.exports = {
5454
const self = this;
5555
return this.read_list(
5656
function() {
57-
return self.read_array_pair(shortForm);
57+
return self.read_array_pair(shortForm)
5858
},
5959
",",
6060
true
@@ -85,7 +85,10 @@ module.exports = {
8585
const expr = this.read_expr();
8686
if (this.token === this.tok.T_DOUBLE_ARROW) {
8787
if (this.next().token === "&") {
88-
return entry(expr, this.next().read_variable(true, false, true));
88+
return entry(
89+
expr,
90+
this.next().read_variable(true, false, true)
91+
);
8992
} else {
9093
return entry(expr, this.read_expr());
9194
}

src/parser/expr.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ module.exports = {
138138
this.innerListForm = isShort;
139139
assign = this.node("assign");
140140
} else if (this.innerListForm !== isShort) {
141-
// Both due to implementation issues,
141+
// Both due to implementation issues,
142142
// and for consistency's sake, list()
143143
// cannot be nested inside [], nor vice-versa
144144
this.expect(isShort ? "list" : "[");
@@ -177,24 +177,16 @@ module.exports = {
177177
if (!isInner) {
178178
this.innerList = false;
179179
if (isShort) {
180-
if (this.token === "=") {
181-
return assign(
182-
result(assignList, isShort),
183-
this.next().read_expr(),
184-
"="
185-
);
180+
if (this.token === '=') {
181+
return assign(result(assignList, isShort), this.next().read_expr(), "=");
186182
} else {
187183
// handles as an array declaration
188-
result.setKind("array");
184+
result.setKind('array');
189185
return this.handleDereferencable(result(isShort, assignList));
190186
}
191187
} else {
192188
if (this.expect("=")) {
193-
return assign(
194-
result(assignList, isShort),
195-
this.next().read_expr(),
196-
"="
197-
);
189+
return assign(result(assignList, isShort), this.next().read_expr(), "=");
198190
} else {
199191
// error fallback : list($a, $b);
200192
return result(assignList, isShort);

src/parser/loops.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ module.exports = {
122122
}
123123

124124
// grammatically correct but not supported by PHP
125-
if (key && key.kind === "list") {
126-
this.raiseError("Fatal Error : Cannot use list as key element");
125+
if (key && key.kind === 'list') {
126+
this.raiseError(
127+
"Fatal Error : Cannot use list as key element"
128+
);
127129
}
128130

129131
if (this.expect(")")) this.next();
@@ -139,7 +141,7 @@ module.exports = {
139141
/**
140142
* Reads a foreach variable statement
141143
* ```ebnf
142-
* foreach_variable =
144+
* foreach_variable =
143145
* variable |
144146
* '&' variable |
145147
* T_LIST '(' assignment_list ')' |
@@ -155,7 +157,7 @@ module.exports = {
155157
this.next();
156158
if (!isShort && this.expect("(")) this.next();
157159
const assignList = this.read_array_pair_list(isShort);
158-
if (this.expect(isShort ? "]" : ")")) this.next();
160+
if (this.expect(isShort ? "]": ")")) this.next();
159161
return result(assignList, isShort);
160162
} else {
161163
return this.read_variable(false, false, false);

0 commit comments

Comments
 (0)