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