php-parser
Advanced tools
Comparing version 3.1.0-beta.8 to 3.1.0-beta.9
@@ -5,3 +5,3 @@ /*! | ||
* Parse PHP code from JS and returns its AST | ||
* Build: ad4444bf143d4b60fac4 - 5/25/2022 | ||
* Build: c9dd0a56ea3dc3b1f750 - 5/30/2022 | ||
* Copyright (C) 2021 Glayzzle (BSD-3-Clause) | ||
@@ -8,0 +8,0 @@ * @authors https://github.com/glayzzle/php-parser/graphs/contributors |
{ | ||
"name": "php-parser", | ||
"version": "3.1.0-beta.8", | ||
"version": "3.1.0-beta.9", | ||
"description": "Parse PHP code from JS and returns its AST", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -35,2 +35,25 @@ /** | ||
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1546 | ||
if (id === this.tok.T_ENUM) { | ||
if (this.version < 801) { | ||
return this.tok.T_STRING; | ||
} | ||
const initial = this.offset; | ||
let ch = this.input(); | ||
while (ch == " ") { | ||
ch = this.input(); | ||
} | ||
let isEnum = false; | ||
if (this.is_LABEL_START()) { | ||
while (this.is_LABEL()) { | ||
ch += this.input(); | ||
} | ||
const label = ch.slice(0, -1).toLowerCase(); | ||
isEnum = label !== "extends" && label !== "implements"; | ||
} | ||
this.unput(this.offset - initial); | ||
return isEnum ? this.tok.T_ENUM : this.tok.T_STRING; | ||
} | ||
if (this.offset < this.size && id !== this.tok.T_YIELD_FROM) { | ||
@@ -37,0 +60,0 @@ // If immediately followed by a backslash, this is a T_NAME_RELATIVE or T_NAME_QUALIFIED. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
804417
22345