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<NFAState> visitedStates) |
ParseTree |
parse(String startRule,
List<NFAState> visitedStates) |
protected void |
parseEngine(String startRule,
NFAState start,
NFAState stop,
IntStream input,
Stack<NFAState> ruleInvocationStack,
DebugEventListener actions,
List<NFAState> 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<NFAState> visitedStates)
For a given input char stream, try to match against the NFA
starting at startRule.
|
CommonToken |
scan(String startRule,
List<NFAState> visitedStates) |
public Token nextToken()
TokenSourcenextToken in interface TokenSourcepublic void scan(String startRule, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionExceptionpublic CommonToken scan(String startRule) throws RecognitionException
RecognitionExceptionpublic CommonToken scan(String startRule, List<NFAState> visitedStates) throws RecognitionException
RecognitionExceptionpublic void parse(String startRule, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionExceptionpublic ParseTree parse(String startRule) throws RecognitionException
RecognitionExceptionpublic ParseTree parse(String startRule, List<NFAState> visitedStates) throws RecognitionException
RecognitionExceptionprotected void parseEngine(String startRule, NFAState start, NFAState stop, IntStream input, Stack<NFAState> ruleInvocationStack, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionExceptionpublic int predict(DFA dfa)
public void reportScanError(RecognitionException re)
public String getSourceName()
TokenSourcegetSourceName in interface TokenSourceCopyright © 1992–2014 ANTLR. All rights reserved.