From 03a391e87452909110798423a861c747513b3746 Mon Sep 17 00:00:00 2001 From: David Majda Date: Wed, 1 Apr 2015 10:08:45 +0200 Subject: [PATCH] s/appliedRules/visitedRules/ The rules are not really *applied* by the |reportLeftRecursion| pass, they are just *visited*. --- lib/compiler/passes/report-left-recursion.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/compiler/passes/report-left-recursion.js b/lib/compiler/passes/report-left-recursion.js index 207fdf3..ead952a 100644 --- a/lib/compiler/passes/report-left-recursion.js +++ b/lib/compiler/passes/report-left-recursion.js @@ -59,28 +59,28 @@ function reportLeftRecursion(ast) { }); var check = visitor.build({ - rule: function(node, appliedRules) { - check(node.expression, appliedRules.concat(node.name)); + rule: function(node, visitedRules) { + check(node.expression, visitedRules.concat(node.name)); }, - sequence: function(node, appliedRules) { + sequence: function(node, visitedRules) { arrays.every(node.elements, function(element) { if (element.type === "rule_ref") { - check(element, appliedRules); + check(element, visitedRules); } return matchesEmpty(element); }); }, - rule_ref: function(node, appliedRules) { - if (arrays.contains(appliedRules, node.name)) { + rule_ref: function(node, visitedRules) { + if (arrays.contains(visitedRules, node.name)) { throw new GrammarError( "Left recursion detected for rule \"" + node.name + "\"." ); } - check(asts.findRule(ast, node.name), appliedRules); + check(asts.findRule(ast, node.name), visitedRules); } });