Skip to content

Commit 09c943c

Browse files
committed
#345 - keep in sync php versions with lexer
1 parent e0cdfbc commit 09c943c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,16 @@ const engine = function(options) {
7676
this.parser = new parser(this.lexer, this.ast);
7777
if (options && typeof options === "object") {
7878
// disable php7 from lexer if already disabled from parser
79-
if (options.parser && options.parser.php7 === false) {
79+
if (options.parser) {
8080
if (!options.lexer) {
8181
options.lexer = {};
8282
}
83-
options.lexer.php7 = false;
83+
if (options.parser.php7 === false) {
84+
options.parser.php73 = false;
85+
options.parser.php74 = false;
86+
}
87+
options.lexer.php7 = options.parser.php7;
88+
options.lexer.php73 = options.parser.php73;
8489
}
8590
combine(options, this);
8691
}

src/lexer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const lexer = function(engine) {
3030
this.asp_tags = false;
3131
this.short_tags = false;
3232
this.php7 = true;
33+
this.php73 = true;
3334
this.yyprevcol = 0;
3435
this.keywords = {
3536
__class__: this.tok.T_CLASS_C,

src/parser.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,6 @@ parser.prototype.parse = function(code, filename) {
264264
} else {
265265
this._tokens = null;
266266
}
267-
if (!this.php7) {
268-
this.php73 = false;
269-
this.php74 = false;
270-
}
271267
this._docIndex = 0;
272268
this._lastNode = null;
273269
this.lexer.setInput(code);

0 commit comments

Comments
 (0)