Fix bug causing incorrect error messages
The bug could cause the list of expected strings in an error message to contain strings that shouldn't be there. Closes #2.
This commit is contained in:
parent
11c67b0507
commit
d1fc16c373
|
@ -915,6 +915,10 @@ PEG.Compiler = {
|
||||||
" },",
|
" },",
|
||||||
" ",
|
" ",
|
||||||
" _matchFailed: function(failure) {",
|
" _matchFailed: function(failure) {",
|
||||||
|
" if (this._pos < this._rightmostMatchFailuresPos) {",
|
||||||
|
" return;",
|
||||||
|
" }",
|
||||||
|
" ",
|
||||||
" if (this._pos > this._rightmostMatchFailuresPos) {",
|
" if (this._pos > this._rightmostMatchFailuresPos) {",
|
||||||
" this._rightmostMatchFailuresPos = this._pos;",
|
" this._rightmostMatchFailuresPos = this._pos;",
|
||||||
" this._rightmostMatchFailuresExpected = [];",
|
" this._rightmostMatchFailuresExpected = [];",
|
||||||
|
|
|
@ -36,6 +36,10 @@ PEG.grammarParser = (function(){
|
||||||
},
|
},
|
||||||
|
|
||||||
_matchFailed: function(failure) {
|
_matchFailed: function(failure) {
|
||||||
|
if (this._pos < this._rightmostMatchFailuresPos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this._pos > this._rightmostMatchFailuresPos) {
|
if (this._pos > this._rightmostMatchFailuresPos) {
|
||||||
this._rightmostMatchFailuresPos = this._pos;
|
this._rightmostMatchFailuresPos = this._pos;
|
||||||
this._rightmostMatchFailuresExpected = [];
|
this._rightmostMatchFailuresExpected = [];
|
||||||
|
|
Loading…
Reference in a new issue