Class Rule

    • Field Detail

      • predefinedRulePropertiesDict

        public static final AttributeDict predefinedRulePropertiesDict
        Rule refs have a predefined set of attributes as well as the return values and args. These must be consistent with ActionTranslator.rulePropToModelMap, ...
      • validLexerCommands

        public static final Set<String> validLexerCommands
      • name

        public final String name
      • g

        public final Grammar g
        In which grammar does this rule live?
      • mode

        public final String mode
        If we're in a lexer grammar, we might be in a mode
      • caseInsensitive

        public final boolean caseInsensitive
        If null then use value from global option that is false by default
      • namedActions

        public Map<String,​ActionAST> namedActions
        Map a name to an action for this rule like @init {...}. The code generator will use this to fill holes in the rule template. I track the AST node for the action in case I need the line number for errors.
      • exceptions

        public List<GrammarAST> exceptions
        Track exception handlers; points at "catch" node of (catch exception action) don't track finally action
      • actions

        public 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 rule; Alternative objs also track per alt.
      • finallyAction

        public ActionAST finallyAction
      • numberOfAlts

        public final int numberOfAlts
      • isStartRule

        public boolean isStartRule
      • index

        public int index
        All rules have unique index 0..n-1
      • actionIndex

        public int actionIndex