Error messages now do not contain duplicities.

redux
David Majda 15 years ago
parent 714512f232
commit 37521cffa5

@ -93,7 +93,10 @@ PEG.Parser.prototype = {
this._rightmostMatchFailuresPos = this._pos;
this._rightmostMatchFailuresExpected = [];
}
this._rightmostMatchFailuresExpected.push(failure);
if (this._rightmostMatchFailuresExpected.indexOf(failure) === -1) {
this._rightmostMatchFailuresExpected.push(failure);
}
},
/*

@ -456,6 +456,13 @@ test("error messages", function() {
"something",
'Expected end of input but "s" found.'
);
var duplicateErrorParser = PEG.buildParser('start: "a" / "a"');
doesNotParseWithMessage(
duplicateErrorParser,
"",
'Expected "a" but end of input found.'
);
});
test("error positions", function() {

Loading…
Cancel
Save