diff --git a/lib/parser.js b/lib/parser.js index f5497fd..8e211f6 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -121,11 +121,18 @@ descriptions.length = j; } - return descriptions.length > 1 - ? descriptions.slice(0, -1).join(", ") - + " or " - + descriptions[descriptions.length - 1] - : descriptions[0]; + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } } function describeFound(found) { @@ -138,9 +145,7 @@ function peg$parse(input, options) { options = options !== void 0 ? options : {}; - var parser = this, - - peg$FAILED = {}, + var peg$FAILED = {}, peg$startRuleFunctions = { Grammar: peg$parseGrammar }, peg$startRuleFunction = peg$parseGrammar,