Skip to content

Commit 3a1daa9

Browse files
committed
fix glayzzle#58 - checked every unput statement
1 parent a79e5ed commit 3a1daa9

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

dist/php-parser.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,14 +3542,14 @@ module.exports = {
35423542
this.consume_LNUM();
35433543
return this.tok.T_DNUMBER;
35443544
} else {
3545-
this.unput(3);
3545+
if (ch) this.unput(3);
35463546
break;
35473547
}
35483548
} else if (this.is_NUM()) {
35493549
this.consume_LNUM();
35503550
return this.tok.T_DNUMBER;
35513551
} else {
3552-
this.unput(2);
3552+
if (ch) this.unput(2);
35533553
break;
35543554
}
35553555
} else {
@@ -3602,7 +3602,7 @@ module.exports = {
36023602
while(this.offset < this.size) {
36033603
ch = this.input();
36043604
if (ch !== '0' && ch !== '1') {
3605-
this.unput(1);
3605+
if (ch) this.unput(1);
36063606
break;
36073607
}
36083608
}
@@ -3626,7 +3626,7 @@ module.exports = {
36263626
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1296
36273627
return this.tok.T_OBJECT_OPERATOR;
36283628
}
3629-
this.unput(1);
3629+
if (ch) this.unput(1);
36303630
} else if (this.is_LABEL_START()) {
36313631
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1300
36323632
this.consume_LABEL();
@@ -3635,7 +3635,7 @@ module.exports = {
36353635
}
36363636
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1306
36373637
this.popState();
3638-
this.unput(1);
3638+
if (ch) this.unput(1);
36393639
return false;
36403640
},
36413641
matchST_LOOKING_FOR_VARNAME: function() {
@@ -3653,7 +3653,7 @@ module.exports = {
36533653
return false;
36543654
}
36553655
} else {
3656-
this.unput(1);
3656+
if (ch) this.unput(1);
36573657
this.popState();
36583658
this.begin('ST_IN_SCRIPTING');
36593659
// console.log(this.yylineno, 'ST_LOOKING_FOR_VARNAME', this._input[this.offset - 1], this.conditionStack);
@@ -3758,11 +3758,11 @@ module.exports = {
37583758
return '}';
37593759
default:
37603760
if (ch === '.') {
3761-
this.input();
3761+
ch = this.input();
37623762
if (this.is_NUM()) {
37633763
return this.consume_NUM();
37643764
} else {
3765-
this.unput(1);
3765+
if (ch) this.unput(1);
37663766
}
37673767
}
37683768
if (this.is_NUM()) {
@@ -4199,7 +4199,7 @@ module.exports = {
41994199
return this.tok.T_CURLY_OPEN;
42004200
}
42014201
}
4202-
this.unput(1);
4202+
if (ch) this.unput(1);
42034203
}
42044204
ch = this.input();
42054205
}

dist/php-parser.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/php-parser.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lexer/numbers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ module.exports = {
5656
this.consume_LNUM();
5757
return this.tok.T_DNUMBER;
5858
} else {
59-
this.unput(3);
59+
if (ch) this.unput(3);
6060
break;
6161
}
6262
} else if (this.is_NUM()) {
6363
this.consume_LNUM();
6464
return this.tok.T_DNUMBER;
6565
} else {
66-
this.unput(2);
66+
if (ch) this.unput(2);
6767
break;
6868
}
6969
} else {
@@ -116,7 +116,7 @@ module.exports = {
116116
while(this.offset < this.size) {
117117
ch = this.input();
118118
if (ch !== '0' && ch !== '1') {
119-
this.unput(1);
119+
if (ch) this.unput(1);
120120
break;
121121
}
122122
}

src/lexer/property.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1296
1313
return this.tok.T_OBJECT_OPERATOR;
1414
}
15-
this.unput(1);
15+
if (ch) this.unput(1);
1616
} else if (this.is_LABEL_START()) {
1717
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1300
1818
this.consume_LABEL();
@@ -21,7 +21,7 @@ module.exports = {
2121
}
2222
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1306
2323
this.popState();
24-
this.unput(1);
24+
if (ch) this.unput(1);
2525
return false;
2626
},
2727
matchST_LOOKING_FOR_VARNAME: function() {
@@ -39,7 +39,7 @@ module.exports = {
3939
return false;
4040
}
4141
} else {
42-
this.unput(1);
42+
if (ch) this.unput(1);
4343
this.popState();
4444
this.begin('ST_IN_SCRIPTING');
4545
// console.log(this.yylineno, 'ST_LOOKING_FOR_VARNAME', this._input[this.offset - 1], this.conditionStack);

src/lexer/scripting.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ module.exports = {
6666
return '}';
6767
default:
6868
if (ch === '.') {
69-
this.input();
69+
ch = this.input();
7070
if (this.is_NUM()) {
7171
return this.consume_NUM();
7272
} else {
73-
this.unput(1);
73+
if (ch) this.unput(1);
7474
}
7575
}
7676
if (this.is_NUM()) {

src/lexer/strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ module.exports = {
405405
return this.tok.T_CURLY_OPEN;
406406
}
407407
}
408-
this.unput(1);
408+
if (ch) this.unput(1);
409409
}
410410
ch = this.input();
411411
}

0 commit comments

Comments
 (0)