|
Language Processing v2.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectUtils
Launcher
BnfParser
public class BnfParser
pj2-based parser for the BNF input language.
| Nested Class Summary | |
|---|---|
static class |
BnfParser.yyException
thrown for irrecoverable syntax errors and stack overflow. |
static interface |
BnfParser.yyInput
must be implemented by a scanner object to supply input to the parser. |
static class |
BnfParser.yyLex
|
| Field Summary | |
|---|---|
static int |
Epilog
|
static int |
Id
|
protected static BnfParser |
parser
parser singleton. |
static int |
Prolog
|
static int |
String
|
boolean |
yyAddNull
if true, null will be stored when a totally empty alternative is reduced. |
protected static short[] |
yyCheck
parser tables. |
protected static short[] |
yyDefRed
parser tables. |
protected static short[] |
yyDgoto
parser tables. |
static int |
yyErrorCode
|
protected static int |
yyFinal
number of final state. |
protected static short[] |
yyGindex
parser tables. |
protected static short[] |
yyLen
parser tables. |
protected static short[] |
yyLhs
parser tables. |
protected int |
yyMax
initial size and increment of the state/value stack [default 256]. |
protected static String[] |
yyNames
maps symbol value to printable name. |
protected static short[] |
yyRindex
parser tables. |
protected static short[] |
yySindex
parser tables. |
protected static short[] |
yyTable
parser tables. |
| Fields inherited from class Launcher |
|---|
map, out |
| Fields inherited from class Utils |
|---|
error |
| Constructor Summary | |
|---|---|
BnfParser()
|
|
| Method Summary | |
|---|---|
Parser |
compile(Reader in)
build a parser tree from a file. |
static void |
main(String... args)
main program. |
protected Object |
yybuild(BnfParser.yyInput yyLex,
Object builder,
String rule,
Object... arg)
executed whenever an alternative of a rule is reduced, called with values corresponding to Id arguments only. |
protected Object |
yybuild0(BnfParser.yyInput yyLex,
Object builder,
String rule)
executed whenever an empty alternative of a rule is reduced. |
protected Object |
yyDefault(Object first)
executed at the beginning of a reduce action. |
void |
yyerror(String message)
simplified error message. |
void |
yyerror(String message,
String[] expected)
(syntax) error message. |
protected String[] |
yyExpecting(int state)
computes list of expected tokens on error by tracing the tables. |
Object |
yyparse(BnfParser.yyInput yyLex,
Object... yyarg)
the generated parser. |
| Methods inherited from class Launcher |
|---|
commands, notNull |
| Methods inherited from class Utils |
|---|
className, error, error, error, fromString, getError, message, toChars, toString, warning, warning, warning |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final BnfParser parser
protected static final String[] yyNames
yyExpecting(int)public static final int Prolog
public static final int Id
public static final int String
public static final int Epilog
public static final int yyErrorCode
protected static final int yyFinal
protected static final short[] yyLhs
protected static final short[] yyLen
protected static final short[] yyDefRed
protected static final short[] yyDgoto
protected static final short[] yySindex
protected static final short[] yyRindex
protected static final short[] yyGindex
protected static final short[] yyTable
protected static final short[] yyCheck
protected int yyMax
yyparse(pj2.BnfParser.yyInput, java.lang.Object...).
public boolean yyAddNull
| Constructor Detail |
|---|
public BnfParser()
| Method Detail |
|---|
public static void main(String... args)
throws ClassNotFoundException,
IOException
ClassNotFoundException
IOException
public Parser compile(Reader in)
throws IOException
compile in class LauncherIOExceptionpublic void yyerror(String message)
yyerror(java.lang.String, java.lang.String[])
public void yyerror(String message,
String[] expected)
message - text to be displayed.expected - list of acceptable tokens, if available.protected String[] yyExpecting(int state)
state - for which to compute the list.
protected Object yyDefault(Object first)
first - value for $1, or null.
public Object yyparse(BnfParser.yyInput yyLex,
Object... yyarg)
throws IOException,
BnfParser.yyException
yyLex - scanner.yyarg - [0] debug message writer implementing yyDebug,
and/or tree builder for yybuild().
BnfParser.yyException - on irrecoverable parse error.
IOException
protected Object yybuild0(BnfParser.yyInput yyLex,
Object builder,
String rule)
yyAddNull is true, sends null to yybuild(pj2.BnfParser.yyInput, java.lang.Object, java.lang.String, java.lang.Object...).
protected Object yybuild(BnfParser.yyInput yyLex,
Object builder,
String rule,
Object... arg)
Id arguments only. ArrayList arguments are
flattened, others are not.Silently filter by invoking builder.rulename(int,List) or builder.rulename(List), if either, with the current scanner position and the flattened argument list.
|
(c) 2008 Axel T. Schreiner |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||