Renamed an iterator variable: "key" -> "rule".

redux
David Majda 15 years ago
parent 3f5cb8850c
commit 8f59e21c8d

@ -25,14 +25,14 @@ PEG.buildParser = function(grammar, startRule) {
var ast = PEG.grammarParser.parse(grammar);
for (var key in ast) {
ast[key].checkReferencedRulesExist(ast);
for (var rule in ast) {
ast[rule].checkReferencedRulesExist(ast);
}
if (ast[startRule] === undefined) {
throw new PEG.Grammar.GrammarError("Missing \"" + startRule + "\" rule.");
}
for (var key in ast) {
ast[key].checkNoLeftRecursion(ast, []);
for (var rule in ast) {
ast[rule].checkNoLeftRecursion(ast, []);
}
return PEG.Compiler.compileParser(ast, startRule);
@ -422,8 +422,8 @@ PEG.Compiler = {
this._resetUniqueIdentifierCounters();
var parseFunctionDefinitions = [];
for (var key in grammar) {
parseFunctionDefinitions.push(grammar[key].compile());
for (var rule in grammar) {
parseFunctionDefinitions.push(grammar[rule].compile());
}
var source = this.formatCode(

Loading…
Cancel
Save