Class LeftRecursiveRuleAnalyzer



  • public class LeftRecursiveRuleAnalyzer
    extends LeftRecursiveRuleWalker
    Using a tree walker on the rules, determine if a rule is directly left-recursive and if it follows our pattern.
    • Constructor Detail

    • Method Detail

      • loadPrecRuleTemplates

        public void loadPrecRuleTemplates()
      • setReturnValues

        public void setReturnValues(GrammarAST t)
      • setAltAssoc

        public void setAltAssoc(AltAST t,
                                int alt)
      • binaryAlt

        public void binaryAlt(AltAST originalAltTree,
                              int alt)
      • prefixAlt

        public void prefixAlt(AltAST originalAltTree,
                              int alt)
      • suffixAlt

        public void suffixAlt(AltAST originalAltTree,
                              int alt)
      • otherAlt

        public void otherAlt(AltAST originalAltTree,
                             int alt)
      • getArtificialOpPrecRule

        public String getArtificialOpPrecRule()
      • addPrecedenceArgToRules

        public AltAST addPrecedenceArgToRules(AltAST t,
                                              int prec)
      • hasImmediateRecursiveRuleRefs

        public static boolean hasImmediateRecursiveRuleRefs(GrammarAST t,
                                                            String ruleName)
        Match (RULE RULE_REF (BLOCK (ALT .*) (ALT RULE_REF[self] .*) (ALT .*))) Match (RULE RULE_REF (BLOCK (ALT .*) (ALT (ASSIGN ID RULE_REF[self]) .*) (ALT .*)))
      • stripAltLabel

        public void stripAltLabel(GrammarAST altAST)
        Strip last 2 tokens if -> label; alter indexes in altAST
      • precedence

        public int precedence(int alt)
      • nextPrecedence

        public int nextPrecedence(int alt)
      • toString

        public String toString()