PEG.js grammar: Remove reserved word detection

This is mostly done for consistency with the JavaScript example grammar,
from which the |Identifier| rule is taken from. See the previous commit
for details.
redux
David Majda 10 years ago
parent c13cc88262
commit 7e3b4ec4f8

File diff suppressed because one or more lines are too long

@ -388,10 +388,6 @@ describe("PEG.js grammar parser", function() {
/* Canonical Identifier is "a". */
it("parses Identifier", function() {
expect('start = a:"abcd"').toParseAs(oneRuleGrammar(labeledAbcd));
expect('start = return:"abcd"').toFailToParse({
message: "Reserved word \"return\" can't be used as an identifier."
});
});
/* Canonical IdentifierName is "a". */

@ -218,9 +218,6 @@ SingleLineComment
Identifier
= !ReservedWord name:IdentifierName { return name; }
/ name:IdentifierName {
error("Reserved word \"" + name + "\" can't be used as an identifier.");
}
IdentifierName "identifier"
= first:IdentifierStart rest:IdentifierPart* { return first + rest.join(""); }

Loading…
Cancel
Save