Skip to content

Commit 641ab89

Browse files
committed
release dist
1 parent 20af5c0 commit 641ab89

File tree

3 files changed

+55
-44
lines changed

3 files changed

+55
-44
lines changed

dist/php-parser.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4673,6 +4673,7 @@ var parser = function(lexer, ast) {
46734673
this.token = null;
46744674
this.prev = null;
46754675
this.debug = false;
4676+
this.php7 = true;
46764677
this.extractDoc = false;
46774678
this.suppressErrors = false;
46784679
var mapIt = function(item) {
@@ -5388,7 +5389,7 @@ module.exports = {
53885389
var result = this.node('classconstant'),
53895390
name = null,
53905391
value = null;
5391-
if (this.token === this.tok.T_STRING || this.is('IDENTIFIER')) {
5392+
if (this.token === this.tok.T_STRING || (this.php7 && this.is('IDENTIFIER'))) {
53925393
name = this.text();
53935394
this.next();
53945395
} else {
@@ -5615,7 +5616,7 @@ module.exports = {
56155616
if (this.token === this.tok.T_DOUBLE_COLON) {
56165617
this.next();
56175618

5618-
if (this.token === this.tok.T_STRING || this.is('IDENTIFIER')) {
5619+
if (this.token === this.tok.T_STRING || (this.php7 && this.is('IDENTIFIER'))) {
56195620
trait = method;
56205621
method = this.text();
56215622
this.next();
@@ -5645,7 +5646,7 @@ module.exports = {
56455646
flags = this.read_member_flags();
56465647
}
56475648

5648-
if (this.token === this.tok.T_STRING || this.is('IDENTIFIER')) {
5649+
if (this.token === this.tok.T_STRING || (this.php7 && this.is('IDENTIFIER'))) {
56495650
alias = this.text();
56505651
this.next();
56515652
} else if (flags === false) {
@@ -6347,7 +6348,7 @@ module.exports = {
63476348
var name = false, use = [], returnType = null, nullable = false;
63486349
if (type !== 1) {
63496350
if (type === 2) {
6350-
if (this.token === this.tok.T_STRING || this.is('IDENTIFIER')) {
6351+
if (this.token === this.tok.T_STRING || (this.php7 && this.is('IDENTIFIER'))) {
63516352
name = this.text();
63526353
this.next();
63536354
} else {
@@ -7959,7 +7960,7 @@ module.exports = {
79597960
} else if (
79607961
this.token === this.tok.T_STRING
79617962
|| this.token === this.tok.T_CLASS
7962-
|| this.is('IDENTIFIER')
7963+
|| (this.php7 && this.is('IDENTIFIER'))
79637964
) {
79647965
offset = this.node('constref');
79657966
var name = this.text();
@@ -8009,20 +8010,28 @@ module.exports = {
80098010
result = node(result, offset);
80108011
break;
80118012
case this.tok.T_DOUBLE_COLON:
8012-
if((this.next().token === this.tok.T_STRING || this.is('IDENTIFIER'))) {
8013-
var node = this.node('staticlookup');
8013+
8014+
// @see https://github.com/glayzzle/php-parser/issues/107#issuecomment-354104574
8015+
if(result.kind === 'staticlookup') {
8016+
this.error();
8017+
}
8018+
8019+
var node = this.node('staticlookup');
8020+
if(this.next().token === this.tok.T_STRING || (this.php7 && this.is('IDENTIFIER'))) {
80148021
var offset = this.node('constref');
80158022
var name = this.text();
8016-
80178023
this.next();
80188024
offset = offset(name);
8019-
8020-
if(this.token === this.tok.T_OBJECT_OPERATOR || this.token === this.tok.T_DOUBLE_COLON) {
8025+
if(this.token === this.tok.T_OBJECT_OPERATOR) {
80218026
this.error();
80228027
}
8023-
8024-
result = node(result, offset);
8028+
} else {
8029+
this.error(this.tok.T_STRING);
8030+
// fallback on a constref node
8031+
var offset = this.node('constref')(this.text());
8032+
this.next();
80258033
}
8034+
result = node(result, offset);
80268035
break;
80278036
case this.tok.T_OBJECT_OPERATOR:
80288037
var node = this.node('propertylookup');
@@ -8529,7 +8538,8 @@ function combine(src, to) {
85298538
* var instance = new parser({
85308539
* parser: {
85318540
* extractDoc: true,
8532-
* suppressErrors: true
8541+
* suppressErrors: true,
8542+
* php7: true
85338543
* },
85348544
* ast: {
85358545
* withPositions: true

0 commit comments

Comments
 (0)