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()
TokenSource
nextToken
in interface TokenSource
public void scan(String startRule, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionException
public CommonToken scan(String startRule) throws RecognitionException
RecognitionException
public CommonToken scan(String startRule, List<NFAState> visitedStates) throws RecognitionException
RecognitionException
public void parse(String startRule, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionException
public ParseTree parse(String startRule) throws RecognitionException
RecognitionException
public ParseTree parse(String startRule, List<NFAState> visitedStates) throws RecognitionException
RecognitionException
protected void parseEngine(String startRule, NFAState start, NFAState stop, IntStream input, Stack<NFAState> ruleInvocationStack, DebugEventListener actions, List<NFAState> visitedStates) throws RecognitionException
RecognitionException
public int predict(DFA dfa)
public void reportScanError(RecognitionException re)
public String getSourceName()
TokenSource
getSourceName
in interface TokenSource
Copyright © 1992–2015 ANTLR. All rights reserved.