php-parser
Advanced tools
Comparing version 3.0.0-alpha1 to 3.0.0-alpha2
{ | ||
"name": "php-parser", | ||
"version": "3.0.0-alpha1", | ||
"version": "3.0.0-alpha2", | ||
"description": "Parse PHP code and returns its AST", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
# Releases | ||
## 3.0.0-alpha2 : (2018-04-14) | ||
- fix #137 : Bug with parsing `list` | ||
- fix #149 : Binary cast: isDoubleQuote incorrect | ||
- fix #150 : strange ast with list | ||
- fix #151 : Declare inside if | ||
## 3.0.0-alpha1 : (2018-04-11) | ||
@@ -4,0 +10,0 @@ - https://github.com/glayzzle/php-parser/milestone/10 |
@@ -495,3 +495,3 @@ /*! | ||
read_assignment_list: function() { | ||
return this.read_list(this.read_assignment_list_element, ","); | ||
return this.read_list(this.read_assignment_list_element, ",", true); | ||
}, | ||
@@ -506,5 +506,6 @@ | ||
if (this.token === "," || this.token === ")") return null; | ||
let result = this.read_expr_item(); | ||
const entry = this.node("entry"); | ||
const result = this.read_expr_item(); | ||
if (this.token === this.tok.T_DOUBLE_ARROW) { | ||
result = ["key", result, this.next().read_expr_item()]; | ||
return entry(result, this.next().read_expr_item()); | ||
} | ||
@@ -511,0 +512,0 @@ return result; |
@@ -55,3 +55,7 @@ /*! | ||
const text = this.text(); | ||
const isDoubleQuote = text[0] === '"'; | ||
let offset = 0; | ||
if (text[0] === "b" || text[0] === "B") { | ||
offset = 1; | ||
} | ||
const isDoubleQuote = text[offset] === '"'; | ||
this.next(); | ||
@@ -61,3 +65,3 @@ value = value( | ||
this.resolve_special_chars( | ||
text.substring(1, text.length - 1), | ||
text.substring(offset + 1, text.length - 1), | ||
isDoubleQuote | ||
@@ -116,5 +120,5 @@ ), | ||
case 'B"': { | ||
node = this.node("cast"); | ||
const what = this.next().read_encapsed_string('"'); | ||
return node("binary", what); | ||
this.next(); | ||
this.lexer.yylloc.prev_offset -= 1; | ||
return this.read_encapsed_string('"'); | ||
} | ||
@@ -121,0 +125,0 @@ |
@@ -337,6 +337,2 @@ /*! | ||
this.expect(";") && this.next(); | ||
while (this.token != this.EOF && this.token !== this.tok.T_DECLARE) { | ||
// @todo : check declare_statement from php / not valid | ||
body.push(this.read_top_statement()); | ||
} | ||
mode = this.ast.declare.MODE_NONE; | ||
@@ -343,0 +339,0 @@ } |
@@ -37,3 +37,3 @@ /*! | ||
if (this.token == separator) { | ||
if (preserveFirstSeparator) result.push(""); | ||
if (preserveFirstSeparator) result.push(null); | ||
this.next(); | ||
@@ -40,0 +40,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1023612
24454