|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.percederberg.grammatica.parser.Parser
public abstract class Parser
A base parser class. This class provides the standard parser interface, as well as token handling.
| Method Summary | |
|---|---|
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. |
java.lang.String |
toString()
Returns a string representation of this parser. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
protected Tokenizer newTokenizer(java.io.Reader input)
throws ParserCreationException
input - the input stream to read from
ParserCreationException - 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 add
ParserCreationException - if the pattern couldn't be
added correctly to the parser
public 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 Node parse()
throws ParserCreationException,
ParserLogException
ParserCreationException - if the parser couldn't be
initialized correctly
ParserLogException - 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 pattern
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||