public abstract class Recognizer<Symbol,ATNInterpreter extends ATNSimulator> extends Object
Modifier and Type | Field and Description |
---|---|
protected ATNInterpreter |
_interp |
static int |
EOF |
Constructor and Description |
---|
Recognizer() |
Modifier and Type | Method and Description |
---|---|
void |
action(RuleContext _localctx,
int ruleIndex,
int actionIndex) |
void |
addErrorListener(ANTLRErrorListener listener) |
abstract ATN |
getATN()
Get the
ATN used by the recognizer for prediction. |
String |
getErrorHeader(RecognitionException e)
What is the error header, normally line/character position information?
|
ANTLRErrorListener |
getErrorListenerDispatch() |
List<? extends ANTLRErrorListener> |
getErrorListeners() |
abstract String |
getGrammarFileName()
For debugging and other purposes, might want the grammar name.
|
abstract IntStream |
getInputStream() |
ATNInterpreter |
getInterpreter()
Get the ATN interpreter used by the recognizer for prediction.
|
Map<String,Integer> |
getRuleIndexMap()
Get a map from rule names to rule indexes.
|
abstract String[] |
getRuleNames() |
String |
getSerializedATN()
If this recognizer was generated, it will have a serialized ATN
representation of the grammar.
|
int |
getState() |
String |
getTokenErrorDisplay(Token t)
Deprecated.
This method is not called by the ANTLR 4 Runtime. Specific
implementations of
ANTLRErrorStrategy may provide a similar
feature when necessary. For example, see
DefaultErrorStrategy.getTokenErrorDisplay(org.antlr.v4.runtime.Token) . |
abstract TokenFactory<?> |
getTokenFactory() |
abstract String[] |
getTokenNames()
Used to print out token names like ID during debugging and
error reporting.
|
int |
getTokenType(String tokenName) |
Map<String,Integer> |
getTokenTypeMap()
Get a map from token names to token types.
|
boolean |
precpred(RuleContext localctx,
int precedence) |
void |
removeErrorListener(ANTLRErrorListener listener) |
void |
removeErrorListeners() |
boolean |
sempred(RuleContext _localctx,
int ruleIndex,
int actionIndex) |
abstract void |
setInputStream(IntStream input) |
void |
setInterpreter(ATNInterpreter interpreter)
Set the ATN interpreter used by the recognizer for prediction.
|
void |
setState(int atnState)
Indicate that the recognizer has changed internal state that is
consistent with the ATN state passed in.
|
abstract void |
setTokenFactory(TokenFactory<?> input) |
public static final int EOF
protected ATNInterpreter extends ATNSimulator _interp
public abstract String[] getTokenNames()
public abstract String[] getRuleNames()
@NotNull public Map<String,Integer> getTokenTypeMap()
Used for XPath and tree pattern compilation.
@NotNull public Map<String,Integer> getRuleIndexMap()
Used for XPath and tree pattern compilation.
public int getTokenType(String tokenName)
@NotNull public String getSerializedATN()
For interpreters, we don't know their serialized ATN despite having created the interpreter from it.
public abstract String getGrammarFileName()
@NotNull public abstract ATN getATN()
ATN
used by the recognizer for prediction.ATN
used by the recognizer for prediction.@NotNull public ATNInterpreter getInterpreter()
public void setInterpreter(@NotNull ATNInterpreter interpreter)
interpreter
- The ATN interpreter used by the recognizer for
prediction.@NotNull public String getErrorHeader(@NotNull RecognitionException e)
@Deprecated public String getTokenErrorDisplay(Token t)
ANTLRErrorStrategy
may provide a similar
feature when necessary. For example, see
DefaultErrorStrategy.getTokenErrorDisplay(org.antlr.v4.runtime.Token)
.public void addErrorListener(@NotNull ANTLRErrorListener listener)
NullPointerException
- if listener
is null
.public void removeErrorListener(@NotNull ANTLRErrorListener listener)
public void removeErrorListeners()
@NotNull public List<? extends ANTLRErrorListener> getErrorListeners()
public ANTLRErrorListener getErrorListenerDispatch()
public boolean sempred(@Nullable RuleContext _localctx, int ruleIndex, int actionIndex)
public boolean precpred(@Nullable RuleContext localctx, int precedence)
public void action(@Nullable RuleContext _localctx, int ruleIndex, int actionIndex)
public final int getState()
public final void setState(int atnState)
public abstract IntStream getInputStream()
public abstract void setInputStream(IntStream input)
@NotNull public abstract TokenFactory<?> getTokenFactory()
public abstract void setTokenFactory(@NotNull TokenFactory<?> input)
Copyright © 1992–2014 ANTLR. All rights reserved.