Error messages now do not contain duplicities.
This commit is contained in:
parent
714512f232
commit
37521cffa5
|
@ -93,7 +93,10 @@ PEG.Parser.prototype = {
|
||||||
this._rightmostMatchFailuresPos = this._pos;
|
this._rightmostMatchFailuresPos = this._pos;
|
||||||
this._rightmostMatchFailuresExpected = [];
|
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",
|
"something",
|
||||||
'Expected end of input but "s" found.'
|
'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() {
|
test("error positions", function() {
|
||||||
|
|
Loading…
Reference in a new issue