public class Interpreter extends Object implements TokenSource
| Modifier and Type | Field and Description |
|---|---|
protected Grammar |
grammar |
protected IntStream |
input |
| Constructor and Description |
|---|
Interpreter(Grammar grammar,
IntStream input) |
| Modifier and Type | Method and Description |
|---|---|
String |
getSourceName()
Where are you getting tokens from? normally the implication will simply
ask lexers input stream.
|
Token |
nextToken()
Return a Token object from your input stream (usually a CharStream).
|
ParseTree |
parse(String startRule) |
void |
parse(String startRule,
DebugEventListener actions,
List visitedStates) |
ParseTree |
parse(String startRule,
List visitedStates) |
protected void |
parseEngine(String startRule,
NFAState start,
NFAState stop,
IntStream input,
Stack ruleInvocationStack,
DebugEventListener actions,
List visitedStates)
Fill a list of all NFA states visited during the parse
|
int |
predict(DFA dfa)
Given an input stream, return the unique alternative predicted by
matching the input.
|
void |
reportScanError(RecognitionException re) |
CommonToken |
scan(String startRule) |
void |
scan(String startRule,
DebugEventListener actions,
List visitedStates)
For a given input char stream, try to match against the NFA
starting at startRule.
|
CommonToken |
scan(String startRule,
List visitedStates) |
public Token nextToken()
TokenSourcenextToken in interface TokenSourcepublic void scan(String startRule, DebugEventListener actions, List visitedStates) throws RecognitionException
RecognitionExceptionpublic CommonToken scan(String startRule) throws RecognitionException
RecognitionExceptionpublic CommonToken scan(String startRule, List visitedStates) throws RecognitionException
RecognitionExceptionpublic void parse(String startRule, DebugEventListener actions, List visitedStates) throws RecognitionException
RecognitionExceptionpublic ParseTree parse(String startRule) throws RecognitionException
RecognitionExceptionpublic ParseTree parse(String startRule, List visitedStates) throws RecognitionException
RecognitionExceptionprotected void parseEngine(String startRule, NFAState start, NFAState stop, IntStream input, Stack ruleInvocationStack, DebugEventListener actions, List visitedStates) throws RecognitionException
RecognitionExceptionpublic int predict(DFA dfa)
public void reportScanError(RecognitionException re)
public String getSourceName()
TokenSourcegetSourceName in interface TokenSourceCopyright © 2015. All Rights Reserved.