Class ActionAnalysis

  • All Implemented Interfaces:
    org.antlr.runtime.TokenSource

    public class ActionAnalysis
    extends org.antlr.runtime.Lexer
    We need to set Rule.referencedPredefinedRuleAttributes before code generation. This filter looks at an action in context of its rule and outer alternative number and figures out which rules have predefined prefs referenced. I need this so I can remove unusued labels. This also tracks, for labeled rules, which are referenced by actions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EOF  
      static int ID  
      static int X  
      static int X_Y  
      static int Y  
      • Fields inherited from class org.antlr.runtime.Lexer

        input
      • Fields inherited from class org.antlr.runtime.BaseRecognizer

        DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean alreadyParsedRule​(org.antlr.runtime.IntStream input, int ruleIndex)  
      void analyze()  
      org.antlr.runtime.Lexer[] getDelegates()  
      java.lang.String getGrammarFileName()  
      void memoize​(org.antlr.runtime.IntStream input, int ruleIndex, int ruleStartIndex)  
      void mID()  
      void mTokens()  
      void mX()  
      void mX_Y()  
      void mY()  
      org.antlr.runtime.Token nextToken()  
      boolean synpred1_ActionAnalysis()  
      void synpred1_ActionAnalysis_fragment()  
      boolean synpred2_ActionAnalysis()  
      void synpred2_ActionAnalysis_fragment()  
      • Methods inherited from class org.antlr.runtime.Lexer

        emit, emit, getCharErrorDisplay, getCharIndex, getCharPositionInLine, getCharStream, getEOFToken, getErrorMessage, getLine, getSourceName, getText, match, match, matchAny, matchRange, recover, reportError, reset, setCharStream, setText, skip, traceIn, traceOut
      • Methods inherited from class org.antlr.runtime.BaseRecognizer

        beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getCurrentInputSymbol, getErrorHeader, getMissingSymbol, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, matchAny, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, recoverFromMismatchedToken, setBacktrackingLevel, toStrings, traceIn, traceOut
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ActionAnalysis

        public ActionAnalysis​(Grammar grammar,
                              java.lang.String ruleName,
                              GrammarAST actionAST)
      • ActionAnalysis

        public ActionAnalysis()
      • ActionAnalysis

        public ActionAnalysis​(org.antlr.runtime.CharStream input)
      • ActionAnalysis

        public ActionAnalysis​(org.antlr.runtime.CharStream input,
                              org.antlr.runtime.RecognizerSharedState state)
    • Method Detail

      • analyze

        public void analyze()
      • getDelegates

        public org.antlr.runtime.Lexer[] getDelegates()
      • getGrammarFileName

        public java.lang.String getGrammarFileName()
        Overrides:
        getGrammarFileName in class org.antlr.runtime.BaseRecognizer
      • nextToken

        public org.antlr.runtime.Token nextToken()
        Specified by:
        nextToken in interface org.antlr.runtime.TokenSource
        Overrides:
        nextToken in class org.antlr.runtime.Lexer
      • memoize

        public void memoize​(org.antlr.runtime.IntStream input,
                            int ruleIndex,
                            int ruleStartIndex)
        Overrides:
        memoize in class org.antlr.runtime.BaseRecognizer
      • alreadyParsedRule

        public boolean alreadyParsedRule​(org.antlr.runtime.IntStream input,
                                         int ruleIndex)
        Overrides:
        alreadyParsedRule in class org.antlr.runtime.BaseRecognizer
      • mX_Y

        public final void mX_Y()
                        throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • mX

        public final void mX()
                      throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • mY

        public final void mY()
                      throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • mID

        public final void mID()
                       throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • mTokens

        public void mTokens()
                     throws org.antlr.runtime.RecognitionException
        Specified by:
        mTokens in class org.antlr.runtime.Lexer
        Throws:
        org.antlr.runtime.RecognitionException
      • synpred1_ActionAnalysis_fragment

        public final void synpred1_ActionAnalysis_fragment()
                                                    throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • synpred2_ActionAnalysis_fragment

        public final void synpred2_ActionAnalysis_fragment()
                                                    throws org.antlr.runtime.RecognitionException
        Throws:
        org.antlr.runtime.RecognitionException
      • synpred2_ActionAnalysis

        public final boolean synpred2_ActionAnalysis()
      • synpred1_ActionAnalysis

        public final boolean synpred1_ActionAnalysis()