public abstract class Parser
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
addPattern(ProductionPattern pattern)
Adds a new production pattern to the parser.
|
Analyzer |
getAnalyzer()
Returns the analyzer in use by this parser.
|
Tokenizer |
getTokenizer()
Returns the tokenizer in use by this parser.
|
protected Analyzer |
newAnalyzer()
Creates a new analyzer for this parser.
|
protected Production |
newProduction(ProductionPattern pattern)
Factory method to create a new production node.
|
protected Tokenizer |
newTokenizer(java.io.Reader input)
Creates a new tokenizer for this parser.
|
Node |
parse()
Parses the token stream and returns a parse tree.
|
protected abstract Node |
parseStart()
Parses the token stream and returns a parse tree.
|
void |
prepare()
Initializes the parser.
|
void |
reset(java.io.Reader input)
Resets this parser for usage with another input stream.
|
void |
reset(java.io.Reader input,
Analyzer analyzer)
Resets this parser for usage with another input stream.
|
java.lang.String |
toString()
Returns a string representation of this parser.
|
protected Tokenizer newTokenizer(java.io.Reader input) throws ParserCreationException
input - the input stream to read fromParserCreationException - if the tokenizer couldn't be
initialized correctlyprotected Analyzer newAnalyzer()
public Tokenizer getTokenizer()
public Analyzer getAnalyzer()
public void addPattern(ProductionPattern pattern) throws ParserCreationException
pattern - the pattern to addParserCreationException - if the pattern couldn't be
added correctly to the parserpublic void prepare()
throws ParserCreationException
ParserCreationException - if the parser couldn't be
initialized correctlypublic void reset(java.io.Reader input)
input - the new input stream to readTokenizer.reset(java.io.Reader),
Analyzer.reset()public void reset(java.io.Reader input,
Analyzer analyzer)
input - the new input stream to readanalyzer - the new analyzer call-back to useTokenizer.reset(java.io.Reader)public Node parse() throws ParserCreationException, ParserLogException
ParserCreationException - if the parser couldn't be
initialized correctlyParserLogException - if the input couldn't be parsed
correctlyprepare(),
reset(java.io.Reader),
Tokenizer.reset(java.io.Reader)protected abstract Node parseStart() throws ParseException
ParseException - if the input couldn't be parsed
correctlyprotected Production newProduction(ProductionPattern pattern)
pattern - the production patternpublic java.lang.String toString()
toString in class java.lang.Object