oops.parser
Class Node
java.lang.Object
|
+--oops.parser.Node
- Direct Known Subclasses:
- Alt, Id, Lit, Many, Parser, Rule, Seq, Token
- public abstract class Node
- extends java.lang.Object
- implements java.io.Serializable, jag.Node
describes what each node in an oops-generated parser can do.
- See Also:
- Serialized Form
Constructor Summary |
Node()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
lookahead
protected Set lookahead
- lookahead symbols.
follow
protected transient Set follow
Node
public Node()
add
public void add(Node node)
- extends tree.
node
public Node node()
- simplifies tree.
- Returns:
- this, subtree, or suitable node.
getLookahead
public final Set getLookahead()
- returns lookahead during parse.
setLookahead
public abstract Set setLookahead(Parser parser)
- initializes lookahead for rules.
Does not completely traverse sequences
to avoid recursion.
- Returns:
- lookahead.
setFollow
public abstract Set setFollow(Parser parser,
Set succ)
- fully initializes lookahead and follow
by traversing sequences completely.
- Parameters:
parser
- Parser for token setup.succ
- lookahead of successor.- Returns:
- lookahead, i.e., follow for
predecessor.
checkLL1
public void checkLL1(Parser parser)
- check LL(1); must be sent to subtrees.
checkDeadLoop
public boolean checkDeadLoop()
degree
public int degree()
- Specified by:
- degree in interface jag.Node
sub
public java.lang.Object sub(int n)
- Specified by:
- sub in interface jag.Node
parse
public void parse(Scanner scanner,
Goal goal,
Parser parser,
oops.parser.Activation caller)
throws java.io.IOException,
oops.parser.Activation
- performs recognition.
- Parameters:
scanner
- delivers input tokens.goal
- represents current nonterminal and is informed about shifts/reduces.caller
- Activation frame.