org.antlr.grammar.v3
Class ActionAnalysis

java.lang.Object
  extended by org.antlr.runtime.BaseRecognizer
      extended by org.antlr.runtime.Lexer
          extended by org.antlr.grammar.v3.ActionAnalysis
All Implemented Interfaces:
TokenSource

public class ActionAnalysis
extends 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
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
 
Constructor Summary
ActionAnalysis()
           
ActionAnalysis(CharStream input)
           
ActionAnalysis(CharStream input, RecognizerSharedState state)
           
ActionAnalysis(Grammar grammar, java.lang.String ruleName, GrammarAST actionAST)
           
 
Method Summary
 boolean alreadyParsedRule(IntStream input, int ruleIndex)
          Has this rule already parsed input at the current index in the input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
 void analyze()
           
 java.lang.String getGrammarFileName()
          For debugging and other purposes, might want the grammar name.
 void memoize(IntStream input, int ruleIndex, int ruleStartIndex)
          Record whether or not this rule parsed the input at this position successfully.
 void mID()
           
 void mTokens()
          This is the lexer entry point that sets instance var 'token'
 void mX_Y()
           
 void mX()
           
 void mY()
           
 Token nextToken()
          Return a token from this source; i.e., match a token on the char stream.
 void synpred1_ActionAnalysis_fragment()
           
 boolean synpred1_ActionAnalysis()
           
 void synpred2_ActionAnalysis_fragment()
           
 boolean synpred2_ActionAnalysis()
           
 
Methods inherited from class org.antlr.runtime.Lexer
emit, emit, getCharErrorDisplay, getCharIndex, getCharPositionInLine, getCharStream, 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
 

Field Detail

X_Y

public static final int X_Y
See Also:
Constant Field Values

ID

public static final int ID
See Also:
Constant Field Values

EOF

public static final int EOF
See Also:
Constant Field Values

Y

public static final int Y
See Also:
Constant Field Values

X

public static final int X
See Also:
Constant Field Values
Constructor Detail

ActionAnalysis

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

ActionAnalysis

public ActionAnalysis()

ActionAnalysis

public ActionAnalysis(CharStream input)

ActionAnalysis

public ActionAnalysis(CharStream input,
                      RecognizerSharedState state)
Method Detail

analyze

public void analyze()

getGrammarFileName

public java.lang.String getGrammarFileName()
Description copied from class: BaseRecognizer
For debugging and other purposes, might want the grammar name. Have ANTLR generate an implementation for this method.

Overrides:
getGrammarFileName in class BaseRecognizer

nextToken

public Token nextToken()
Description copied from class: Lexer
Return a token from this source; i.e., match a token on the char stream.

Specified by:
nextToken in interface TokenSource
Overrides:
nextToken in class Lexer

memoize

public void memoize(IntStream input,
                    int ruleIndex,
                    int ruleStartIndex)
Description copied from class: BaseRecognizer
Record whether or not this rule parsed the input at this position successfully. Use a standard java hashtable for now.

Overrides:
memoize in class BaseRecognizer

alreadyParsedRule

public boolean alreadyParsedRule(IntStream input,
                                 int ruleIndex)
Description copied from class: BaseRecognizer
Has this rule already parsed input at the current index in the input stream? Return the stop token index or MEMO_RULE_UNKNOWN. If we attempted but failed to parse properly before, return MEMO_RULE_FAILED. This method has a side-effect: if we have seen this input for this rule and successfully parsed before, then seek ahead to 1 past the stop token matched for this rule last time.

Overrides:
alreadyParsedRule in class BaseRecognizer

mX_Y

public final void mX_Y()
                throws RecognitionException
Throws:
RecognitionException

mX

public final void mX()
              throws RecognitionException
Throws:
RecognitionException

mY

public final void mY()
              throws RecognitionException
Throws:
RecognitionException

mID

public final void mID()
               throws RecognitionException
Throws:
RecognitionException

mTokens

public void mTokens()
             throws RecognitionException
Description copied from class: Lexer
This is the lexer entry point that sets instance var 'token'

Specified by:
mTokens in class Lexer
Throws:
RecognitionException

synpred1_ActionAnalysis_fragment

public final void synpred1_ActionAnalysis_fragment()
                                            throws RecognitionException
Throws:
RecognitionException

synpred2_ActionAnalysis_fragment

public final void synpred2_ActionAnalysis_fragment()
                                            throws RecognitionException
Throws:
RecognitionException

synpred2_ActionAnalysis

public final boolean synpred2_ActionAnalysis()

synpred1_ActionAnalysis

public final boolean synpred1_ActionAnalysis()


Copyright © 2013. All Rights Reserved.