oops.parser
Class Alt
java.lang.Object
|
+--oops.parser.Node
|
+--oops.parser.Alt
- public class Alt
- extends Node
represents alternatives: node { "|" node }.
- See Also:
- Serialized Form
Field Summary |
protected java.util.Vector |
nodes
subtrees with alternatives. |
Constructor Summary |
Alt(Node node)
adds first alternative. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
nodes
protected java.util.Vector nodes
- subtrees with alternatives.
Alt
public Alt(Node node)
- adds first alternative.
add
public void add(Node node)
- adds further alternative.
- Overrides:
- add in class Node
node
public Node node()
- Description copied from class: Node
- simplifies tree.
- Overrides:
- node in class Node
- Returns:
- nodes.elementAt(0) if only one.
setLookahead
public Set setLookahead(Parser parser)
- lookahead of each alternative must be
different, but more than one alternative
with empty input is allowed.
- Overrides:
- setLookahead in class Node
- Returns:
- lookahead is union of alternatives.
setFollow
public Set setFollow(Parser parser,
Set succ)
- each alternative gets same succ.
- Overrides:
- setFollow in class Node
- Tags copied from class: Node
- Parameters:
parser
- Parser for token setup.succ
- lookahead of successor.- Returns:
- lookahead, i.e., follow for
predecessor.
checkLL1
public void checkLL1(Parser parser)
- Description copied from class: Node
- check LL(1); must be sent to subtrees.
- Overrides:
- checkLL1 in class Node
checkDeadLoop
public boolean checkDeadLoop()
- Overrides:
- checkDeadLoop in class Node
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
degree
public int degree()
- Overrides:
- degree in class Node
sub
public java.lang.Object sub(int n)
- Overrides:
- sub in class Node
parse
public void parse(Scanner scanner,
Goal goal,
Parser parser,
oops.parser.Activation caller)
throws java.io.IOException,
oops.parser.Activation
- performs recognition.
- Overrides:
- parse in class Node
- Parameters:
scanner
- delivers input tokens.goal
- represents current nonterminal and is informed about shifts/reduces.caller
- Activation frame.