Class Alternative

  • All Implemented Interfaces:
    AttributeResolver

    public class Alternative
    extends java.lang.Object
    implements AttributeResolver
    An outermost alternative for a rule. We don't track inner alternatives.
    • Field Detail

      • rule

        public Rule rule
      • altNum

        public int altNum
        What alternative number is this outermost alt? 1..n
      • tokenRefs

        public org.stringtemplate.v4.misc.MultiMap<java.lang.String,​TerminalAST> tokenRefs
      • tokenRefsInActions

        public org.stringtemplate.v4.misc.MultiMap<java.lang.String,​GrammarAST> tokenRefsInActions
      • ruleRefs

        public org.stringtemplate.v4.misc.MultiMap<java.lang.String,​GrammarAST> ruleRefs
      • ruleRefsInActions

        public org.stringtemplate.v4.misc.MultiMap<java.lang.String,​GrammarAST> ruleRefsInActions
      • labelDefs

        public org.stringtemplate.v4.misc.MultiMap<java.lang.String,​LabelElementPair> labelDefs
        A list of all LabelElementPair attached to tokens like id=ID, ids+=ID
      • actions

        public java.util.List<ActionAST> actions
        Track all executable actions other than named actions like @init and catch/finally (not in an alt). Also tracks predicates, rewrite actions. We need to examine these actions before code generation so that we can detect refs to $rule.attr etc... This tracks per alt
    • Constructor Detail

      • Alternative

        public Alternative​(Rule r,
                           int altNum)