|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oops.parser.Node | +--oops.parser.Parser
represents start symbol of an oops-generated parser: rule { rule }.
Field Summary | |
protected java.util.Hashtable |
ids
maps Id.name to Token or Rule; kept for scanner. |
protected java.util.Hashtable |
lits
maps Lit.body to Set containing token; kept for scanner. |
protected java.util.Hashtable |
nts
maps Rule.nt to rule. |
protected java.util.Vector |
rules
contains rules in input order; kept to display grammar. |
protected Rule |
start
rules.elementAt(0) is start symbol. |
protected java.util.Vector |
tokens
maps token number to token name; kept to symbolically display tokens in sets. |
Fields inherited from class oops.parser.Node |
follow,
lookahead |
Constructor Summary | |
Parser(Rule start)
adds first rule. |
Method Summary | |
void |
add(Rule rule)
adds each rule. |
boolean |
checkDeadLoop()
|
void |
checkLL1(Parser parser)
checks each rule. |
int |
degree()
|
protected boolean |
error()
|
protected void |
error(java.lang.String s,
Scanner scanner)
|
Set |
getLitSet(java.lang.String body)
|
Node |
getPeer(java.lang.String name)
|
java.lang.String |
getToken(int n)
|
protected int |
numberOfErrors()
|
java.lang.Object |
parse(Scanner scanner)
performs recognition. |
Set |
setFollow(Parser parser,
Set succ)
initializes follow of start rule and computes follow for each rule as long as it has inProgress set. |
void |
setGoalMakerFacory(GoalMakerFactory gmf)
|
Set |
setLookahead(Parser parser)
asks each rule to initialize lookahead and activates inProgress for setFollow. |
void |
setSets(java.util.Enumeration lits,
java.util.Enumeration ids)
assigns token numbers, differentiates Id into Rule or Token, fully initializes and checks lookahead. |
protected void |
shift()
|
java.lang.Object |
sub(int n)
|
java.lang.String |
toString()
if rules is transient, incomplete after serialization. |
Methods inherited from class oops.parser.Node |
add,
getLookahead,
node,
parse |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.util.Hashtable lits
protected java.util.Hashtable ids
protected java.util.Vector tokens
protected transient java.util.Hashtable nts
protected java.util.Vector rules
protected final Rule start
Constructor Detail |
public Parser(Rule start)
Method Detail |
public void add(Rule rule)
public void setSets(java.util.Enumeration lits, java.util.Enumeration ids)
public Set setLookahead(Parser parser)
parser
- unused.public Set setFollow(Parser parser, Set succ)
parser
- unused.succ
- unused.public void checkLL1(Parser parser)
parser
- unused.public boolean checkDeadLoop()
public Set getLitSet(java.lang.String body)
public Node getPeer(java.lang.String name)
public java.lang.String getToken(int n)
public java.lang.String toString()
public int degree()
public java.lang.Object sub(int n)
public java.lang.Object parse(Scanner scanner) throws java.io.IOException
scanner
- delivers input tokens.goal
- represents current nonterminal and is informed about shifts/reduces.caller
- Activation frame.protected final void error(java.lang.String s, Scanner scanner)
protected final void shift()
protected final int numberOfErrors()
protected final boolean error()
public void setGoalMakerFacory(GoalMakerFactory gmf)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |