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.
redux
David Majda 14 years ago
parent 11c67b0507
commit d1fc16c373

@ -915,6 +915,10 @@ PEG.Compiler = {
" },",
" ",
" _matchFailed: function(failure) {",
" if (this._pos < this._rightmostMatchFailuresPos) {",
" return;",
" }",
" ",
" if (this._pos > this._rightmostMatchFailuresPos) {",
" this._rightmostMatchFailuresPos = this._pos;",
" this._rightmostMatchFailuresExpected = [];",

@ -36,6 +36,10 @@ PEG.grammarParser = (function(){
},
_matchFailed: function(failure) {
if (this._pos < this._rightmostMatchFailuresPos) {
return;
}
if (this._pos > this._rightmostMatchFailuresPos) {
this._rightmostMatchFailuresPos = this._pos;
this._rightmostMatchFailuresExpected = [];

Loading…
Cancel
Save