|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.percederberg.grammatica.parser.Parser
net.percederberg.grammatica.parser.RecursiveDescentParser
public class RecursiveDescentParser
A recursive descent parser. This parser handles LL(n) grammars, selecting the appropriate pattern to parse based on the next few tokens. The parser is more efficient the fewer look-ahead tokens that is has to consider.
| Constructor Summary | |
|---|---|
RecursiveDescentParser(java.io.Reader input)
Creates a new parser. |
|
RecursiveDescentParser(java.io.Reader input,
Analyzer analyzer)
Creates a new parser. |
|
RecursiveDescentParser(Tokenizer tokenizer)
Creates a new parser. |
|
RecursiveDescentParser(Tokenizer tokenizer,
Analyzer analyzer)
Creates a new parser. |
|
| Method Summary | |
|---|---|
void |
addPattern(ProductionPattern pattern)
Adds a new production pattern to the parser. |
protected Node |
parseStart()
Parses the input stream and creates a parse tree. |
void |
prepare()
Initializes the parser. |
| Methods inherited from class net.percederberg.grammatica.parser.Parser |
|---|
getAnalyzer, getTokenizer, newAnalyzer, newProduction, newTokenizer, parse, reset, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RecursiveDescentParser(java.io.Reader input)
throws ParserCreationException
input - the input stream to read from
ParserCreationException - if the tokenizer couldn't be
initialized correctly
public RecursiveDescentParser(java.io.Reader input,
Analyzer analyzer)
throws ParserCreationException
input - the input stream to read fromanalyzer - the analyzer callback to use
ParserCreationException - if the tokenizer couldn't be
initialized correctlypublic RecursiveDescentParser(Tokenizer tokenizer)
tokenizer - the tokenizer to use
public RecursiveDescentParser(Tokenizer tokenizer,
Analyzer analyzer)
tokenizer - the tokenizer to useanalyzer - the analyzer callback to use| Method Detail |
|---|
public void addPattern(ProductionPattern pattern)
throws ParserCreationException
addPattern in class Parserpattern - the pattern to add
ParserCreationException - if the pattern couldn't be
added correctly to the parser
public void prepare()
throws ParserCreationException
prepare in class ParserParserCreationException - if the parser couldn't be
initialized correctly
protected Node parseStart()
throws ParseException
parseStart in class ParserParseException - if the input couldn't be parsed
correctly
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||