|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.brics.grammar.parser.Parser
public class Parser
Parser.
Based on a variant of Earley's algorithm.
Constructor Summary | |
---|---|
Parser(Grammar g,
PrintWriter out)
Constructs a new parser. |
Method Summary | |
---|---|
boolean |
check(String x,
Production start)
Checks whether the given string can be parsed without syntax errors. |
long |
getMaxMemory()
Returns maximal memory usage during last parsing. |
long |
getMaxStates()
Returns maximal number of parse states during last parsing. |
long |
getTotalStates()
Returns total number of parse states during last parsing. |
AST |
parse(String x)
Parses the given string. |
AST |
parse(String x,
String file)
Parses the given string. |
AST |
parse(String x,
String file,
Production start)
Parses the given string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Parser(Grammar g, PrintWriter out)
g
- grammarout
- print writer for verbose messages (null if none)Method Detail |
---|
public boolean check(String x, Production start)
x
- string to parsestart
- start production (if null, all productions of the start nonterminal are used)
public long getMaxMemory()
public long getMaxStates()
public long getTotalStates()
public AST parse(String x) throws ParseException
parse(x, null, null)
.
x
- string to parse
ParseException
- in case of parse errorpublic AST parse(String x, String file) throws ParseException
parse(x, file, null)
.
x
- string to parsefile
- path or URL of string to parse (null if unknown)
ParseException
- in case of parse errorpublic AST parse(String x, String file, Production start) throws ParseException
x
- string to parsefile
- path or URL of string to parse (null if unknown)start
- start production (if null, all productions of the start nonterminal are used)
ParseException
- in case of parse error
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |