@ -124,6 +124,7 @@ PEG.Parser.prototype = {
case 1:
return failuresExpected[0];
default:
failuresExpected.sort();
return failuresExpected.slice(0, failuresExpected.length - 1).join(", ")
+ " or "
+ failuresExpected[failuresExpected.length - 1];
@ -463,6 +463,13 @@ test("error messages", function() {
"",
'Expected "a" but end of input found.'
);
var unsortedErrorsParser = PEG.buildParser('start: "b" / "a"');
doesNotParseWithMessage(
unsortedErrorsParser,
'Expected "a" or "b" but end of input found.'
});
test("error positions", function() {