/** Before generating code, we examine all actions that can have * $x.y and $y stuff in them because some code generation depends on * Rule.referencedPredefinedRuleAttributes. I need to remove unused * rule labels for example. */ protected void examineAllExecutableActions() { Collection rules = getRules(); for (Iterator it = rules.iterator(); it.hasNext();) { Rule r = (Rule) it.next(); // walk all actions within the rule elements, args, and exceptions List<GrammarAST> actions = r.getInlineActions(); for (int i = 0; i < actions.size(); i++) { GrammarAST actionAST = (GrammarAST) actions.get(i); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } // walk any named actions like @init, @after Collection<GrammarAST> namedActions = r.getActions().values(); for (Iterator it2 = namedActions.iterator(); it2.hasNext();) { GrammarAST actionAST = (GrammarAST) it2.next(); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } } }
/** Before generating code, we examine all actions that can have * $x.y and $y stuff in them because some code generation depends on * Rule.referencedPredefinedRuleAttributes. I need to remove unused * rule labels for example. */ protected void examineAllExecutableActions() { Collection rules = getRules(); for (Iterator it = rules.iterator(); it.hasNext();) { Rule r = (Rule) it.next(); // walk all actions within the rule elements, args, and exceptions List<GrammarAST> actions = r.getInlineActions(); for (int i = 0; i < actions.size(); i++) { GrammarAST actionAST = (GrammarAST) actions.get(i); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } // walk any named actions like @init, @after Collection<GrammarAST> namedActions = r.getActions().values(); for (Iterator it2 = namedActions.iterator(); it2.hasNext();) { GrammarAST actionAST = (GrammarAST) it2.next(); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } } }
/** Before generating code, we examine all actions that can have * $x.y and $y stuff in them because some code generation depends on * Rule.referencedPredefinedRuleAttributes. I need to remove unused * rule labels for example. */ protected void examineAllExecutableActions() { Collection<Rule> rules = getRules(); for (Rule r : rules) { // walk all actions within the rule elements, args, and exceptions List<GrammarAST> actions = r.getInlineActions(); for (int i = 0; i < actions.size(); i++) { GrammarAST actionAST = actions.get(i); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } // walk any named actions like @init, @after Collection<? extends Object> namedActions = r.getActions().values(); for (Object namedAction : namedActions) { GrammarAST actionAST = (GrammarAST)namedAction; ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } } }
/** Before generating code, we examine all actions that can have * $x.y and $y stuff in them because some code generation depends on * Rule.referencedPredefinedRuleAttributes. I need to remove unused * rule labels for example. */ protected void examineAllExecutableActions() { Collection<Rule> rules = getRules(); for (Rule r : rules) { // walk all actions within the rule elements, args, and exceptions List<GrammarAST> actions = r.getInlineActions(); for (int i = 0; i < actions.size(); i++) { GrammarAST actionAST = actions.get(i); ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } // walk any named actions like @init, @after Collection<? extends Object> namedActions = r.getActions().values(); for (Object namedAction : namedActions) { GrammarAST actionAST = (GrammarAST)namedAction; ActionAnalysis sniffer = new ActionAnalysis(this, r.name, actionAST); sniffer.analyze(); } } }
generator.translateActionAttributeReferencesForSingleScope( theRule, theRule.getActions() ); code.setAttribute("ruleName", r);
generator.translateActionAttributeReferencesForSingleScope( theRule, theRule.getActions() ); retval.code.add("ruleName", currentRuleName);
generator.translateActionAttributeReferencesForSingleScope( theRule, theRule.getActions() ); retval.code.add("ruleName", currentRuleName);