Skip to content

Commit

Permalink
fix #58 - checked every unput statement
Browse files Browse the repository at this point in the history
  • Loading branch information
ichiriac committed Mar 4, 2017
1 parent a79e5ed commit 3a1daa9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
18 changes: 9 additions & 9 deletions dist/php-parser.js
Expand Up @@ -3542,14 +3542,14 @@ module.exports = {
this.consume_LNUM();
return this.tok.T_DNUMBER;
} else {
this.unput(3);
if (ch) this.unput(3);
break;
}
} else if (this.is_NUM()) {
this.consume_LNUM();
return this.tok.T_DNUMBER;
} else {
this.unput(2);
if (ch) this.unput(2);
break;
}
} else {
Expand Down Expand Up @@ -3602,7 +3602,7 @@ module.exports = {
while(this.offset < this.size) {
ch = this.input();
if (ch !== '0' && ch !== '1') {
this.unput(1);
if (ch) this.unput(1);
break;
}
}
Expand All @@ -3626,7 +3626,7 @@ module.exports = {
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1296
return this.tok.T_OBJECT_OPERATOR;
}
this.unput(1);
if (ch) this.unput(1);
} else if (this.is_LABEL_START()) {
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1300
this.consume_LABEL();
Expand All @@ -3635,7 +3635,7 @@ module.exports = {
}
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1306
this.popState();
this.unput(1);
if (ch) this.unput(1);
return false;
},
matchST_LOOKING_FOR_VARNAME: function() {
Expand All @@ -3653,7 +3653,7 @@ module.exports = {
return false;
}
} else {
this.unput(1);
if (ch) this.unput(1);
this.popState();
this.begin('ST_IN_SCRIPTING');
// console.log(this.yylineno, 'ST_LOOKING_FOR_VARNAME', this._input[this.offset - 1], this.conditionStack);
Expand Down Expand Up @@ -3758,11 +3758,11 @@ module.exports = {
return '}';
default:
if (ch === '.') {
this.input();
ch = this.input();
if (this.is_NUM()) {
return this.consume_NUM();
} else {
this.unput(1);
if (ch) this.unput(1);
}
}
if (this.is_NUM()) {
Expand Down Expand Up @@ -4199,7 +4199,7 @@ module.exports = {
return this.tok.T_CURLY_OPEN;
}
}
this.unput(1);
if (ch) this.unput(1);
}
ch = this.input();
}
Expand Down
12 changes: 6 additions & 6 deletions dist/php-parser.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/php-parser.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/lexer/numbers.js
Expand Up @@ -56,14 +56,14 @@ module.exports = {
this.consume_LNUM();
return this.tok.T_DNUMBER;
} else {
this.unput(3);
if (ch) this.unput(3);
break;
}
} else if (this.is_NUM()) {
this.consume_LNUM();
return this.tok.T_DNUMBER;
} else {
this.unput(2);
if (ch) this.unput(2);
break;
}
} else {
Expand Down Expand Up @@ -116,7 +116,7 @@ module.exports = {
while(this.offset < this.size) {
ch = this.input();
if (ch !== '0' && ch !== '1') {
this.unput(1);
if (ch) this.unput(1);
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/lexer/property.js
Expand Up @@ -12,7 +12,7 @@ module.exports = {
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1296
return this.tok.T_OBJECT_OPERATOR;
}
this.unput(1);
if (ch) this.unput(1);
} else if (this.is_LABEL_START()) {
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1300
this.consume_LABEL();
Expand All @@ -21,7 +21,7 @@ module.exports = {
}
// https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1306
this.popState();
this.unput(1);
if (ch) this.unput(1);
return false;
},
matchST_LOOKING_FOR_VARNAME: function() {
Expand All @@ -39,7 +39,7 @@ module.exports = {
return false;
}
} else {
this.unput(1);
if (ch) this.unput(1);
this.popState();
this.begin('ST_IN_SCRIPTING');
// console.log(this.yylineno, 'ST_LOOKING_FOR_VARNAME', this._input[this.offset - 1], this.conditionStack);
Expand Down
4 changes: 2 additions & 2 deletions src/lexer/scripting.js
Expand Up @@ -66,11 +66,11 @@ module.exports = {
return '}';
default:
if (ch === '.') {
this.input();
ch = this.input();
if (this.is_NUM()) {
return this.consume_NUM();
} else {
this.unput(1);
if (ch) this.unput(1);
}
}
if (this.is_NUM()) {
Expand Down
2 changes: 1 addition & 1 deletion src/lexer/strings.js
Expand Up @@ -405,7 +405,7 @@ module.exports = {
return this.tok.T_CURLY_OPEN;
}
}
this.unput(1);
if (ch) this.unput(1);
}
ch = this.input();
}
Expand Down

0 comments on commit 3a1daa9

Please sign in to comment.