Package org.antlr.grammar.v3
Class ActionAnalysis
java.lang.Object
org.antlr.runtime.BaseRecognizer
org.antlr.runtime.Lexer
org.antlr.grammar.v3.ActionAnalysis
- All Implemented Interfaces:
TokenSource
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
FieldsModifier and TypeFieldDescription(package private) Token
(package private) Rule
static final int
(package private) Grammar
static final int
(package private) int
static final int
static final int
static final int
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
ConstructorsConstructorDescriptionActionAnalysis
(CharStream input) ActionAnalysis
(CharStream input, RecognizerSharedState state) ActionAnalysis
(Grammar grammar, String ruleName, GrammarAST actionAST) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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()
Lexer[]
For debugging and other purposes, might want the grammar name.void
Record whether or not this rule parsed the input at this position successfully.final void
mID()
void
mTokens()
This is the lexer entry point that sets instance var 'token'final void
mX()
final void
mX_Y()
final void
mY()
Return a token from this source; i.e., match a token on the char stream.final boolean
final void
final boolean
final void
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
-
Field Details
-
EOF
public static final int EOF- See Also:
-
ID
public static final int ID- See Also:
-
X
public static final int X- See Also:
-
X_Y
public static final int X_Y- See Also:
-
Y
public static final int Y- See Also:
-
enclosingRule
Rule enclosingRule -
grammar
Grammar grammar -
actionToken
Token actionToken -
outerAltNum
int outerAltNum
-
-
Constructor Details
-
ActionAnalysis
-
ActionAnalysis
public ActionAnalysis() -
ActionAnalysis
-
-
Method Details
-
analyze
public void analyze() -
getDelegates
-
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 classBaseRecognizer
-
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 interfaceTokenSource
- Overrides:
nextToken
in classLexer
-
memoize
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 classBaseRecognizer
-
alreadyParsedRule
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 classBaseRecognizer
-
mX_Y
- Throws:
RecognitionException
-
mX
- Throws:
RecognitionException
-
mY
- Throws:
RecognitionException
-
mID
- Throws:
RecognitionException
-
mTokens
Description copied from class:Lexer
This is the lexer entry point that sets instance var 'token'- Specified by:
mTokens
in classLexer
- Throws:
RecognitionException
-
synpred1_ActionAnalysis_fragment
- Throws:
RecognitionException
-
synpred2_ActionAnalysis_fragment
- Throws:
RecognitionException
-
synpred2_ActionAnalysis
public final boolean synpred2_ActionAnalysis() -
synpred1_ActionAnalysis
public final boolean synpred1_ActionAnalysis()
-