Skip to content

Commit 5798739

Browse files
committed
update dist with PR glayzzle#142
1 parent 1534eca commit 5798739

File tree

3 files changed

+56
-54
lines changed

3 files changed

+56
-54
lines changed

dist/php-parser.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! php-parser - BSD3 License - 2018-03-25 */
1+
/*! php-parser - BSD3 License - 2018-03-26 */
22

33
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
44
/*!
@@ -5515,7 +5515,7 @@ module.exports = {
55155515
read_comment: function read_comment() {
55165516
var text = this.text();
55175517
var result = this.ast.prepare(text.substring(0, 2) === "/*" ? "commentblock" : "commentline", null, this);
5518-
this.token = this.lexer.lex() || this.EOF;
5518+
this.lex();
55195519
return result(text);
55205520
},
55215521
/**
@@ -5524,7 +5524,7 @@ module.exports = {
55245524
read_doc_comment: function read_doc_comment() {
55255525
var result = this.ast.prepare("commentblock", null, this);
55265526
var text = this.text();
5527-
this.token = this.lexer.lex() || this.EOF;
5527+
this.lex();
55285528
return result(text);
55295529
}
55305530
};
@@ -5620,18 +5620,7 @@ module.exports = {
56205620
var node = this.node("parenthesis");
56215621
expr = this.next().read_expr();
56225622
this.expect(")") && this.next();
5623-
expr = node(expr);
5624-
// handle dereferencable
5625-
if (this.token === this.tok.T_OBJECT_OPERATOR) {
5626-
return this.recursive_variable_chain_scan(expr, false);
5627-
} else if (this.token === this.tok.T_CURLY_OPEN || this.token === "[") {
5628-
return this.read_dereferencable(expr);
5629-
} else if (this.token === "(") {
5630-
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
5631-
return this.node("call")(expr, this.read_function_argument_list());
5632-
} else {
5633-
return expr;
5634-
}
5623+
return this.handleDereferencable(node(expr));
56355624
}
56365625

56375626
if (this.token === "`") {
@@ -5681,6 +5670,15 @@ module.exports = {
56815670
}
56825671
}
56835672

5673+
if (this.token === "[") {
5674+
expr = this.read_array();
5675+
if (this.token === "=") {
5676+
return this.node("assign")(expr, this.next().read_expr(), "=");
5677+
} else {
5678+
return this.handleDereferencable(expr);
5679+
}
5680+
}
5681+
56845682
if (this.token === this.tok.T_CLONE) return this.node("clone")(this.next().read_expr());
56855683

56865684
switch (this.token) {
@@ -5910,19 +5908,7 @@ module.exports = {
59105908
}
59115909
} else if (this.is("SCALAR")) {
59125910
expr = this.read_scalar();
5913-
// handle dereferencable
5914-
while (this.token !== this.EOF) {
5915-
if (this.token === this.tok.T_OBJECT_OPERATOR) {
5916-
expr = this.recursive_variable_chain_scan(expr, false);
5917-
} else if (this.token === this.tok.T_CURLY_OPEN || this.token === "[") {
5918-
expr = this.read_dereferencable(expr);
5919-
} else if (this.token === "(") {
5920-
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
5921-
expr = this.node("call")(expr, this.read_function_argument_list());
5922-
} else {
5923-
return expr;
5924-
}
5925-
}
5911+
return this.handleDereferencable(expr);
59265912
} else {
59275913
this.error("EXPR");
59285914
this.next();
@@ -6007,6 +5993,22 @@ module.exports = {
60075993
result = ["key", result, this.next().read_expr_item()];
60085994
}
60095995
return result;
5996+
},
5997+
5998+
handleDereferencable: function handleDereferencable(expr) {
5999+
while (this.token !== this.EOF) {
6000+
if (this.token === this.tok.T_OBJECT_OPERATOR) {
6001+
expr = this.recursive_variable_chain_scan(expr, false);
6002+
} else if (this.token === this.tok.T_CURLY_OPEN || this.token === "[") {
6003+
expr = this.read_dereferencable(expr);
6004+
} else if (this.token === "(") {
6005+
// https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
6006+
expr = this.node("call")(expr, this.read_function_argument_list());
6007+
} else {
6008+
return expr;
6009+
}
6010+
}
6011+
return expr;
60106012
}
60116013
};
60126014

0 commit comments

Comments
 (0)