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<? super Symbol> listener) |
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<? super Symbol> |
getErrorListenerDispatch() |
List<? extends ANTLRErrorListener<? super Symbol>> |
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.
|
ParseInfo |
getParseInfo()
If profiling during the parse/lex, this will return DecisionInfo records
for each decision in recognizer in a ParseInfo object.
|
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 String[] |
getTokenNames()
Deprecated.
Use
getVocabulary() instead. |
int |
getTokenType(String tokenName) |
Map<String,Integer> |
getTokenTypeMap()
Get a map from token names to token types.
|
Vocabulary |
getVocabulary()
Get the vocabulary used by the recognizer.
|
boolean |
precpred(RuleContext localctx,
int precedence) |
void |
removeErrorListener(ANTLRErrorListener<? super Symbol> listener) |
void |
removeErrorListeners() |
boolean |
sempred(RuleContext _localctx,
int ruleIndex,
int actionIndex) |
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.
|
public static final int EOF
protected ATNInterpreter extends ATNSimulator _interp
@Deprecated public abstract String[] getTokenNames()
getVocabulary() instead.public abstract String[] getRuleNames()
@NotNull public Vocabulary getVocabulary()
Vocabulary instance providing information about the
vocabulary used by the grammar.@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 ATN getATN()
ATN used by the recognizer for prediction.ATN used by the recognizer for prediction.@NotNull public ATNInterpreter getInterpreter()
public ParseInfo getParseInfo()
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<? super Symbol> listener)
NullPointerException - if listener is null.public void removeErrorListener(@NotNull
ANTLRErrorListener<? super Symbol> listener)
public void removeErrorListeners()
@NotNull public List<? extends ANTLRErrorListener<? super Symbol>> getErrorListeners()
public ANTLRErrorListener<? super Symbol> 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()
Copyright © 1992–2024 Daniel Sun. All rights reserved.