openjava.syntax
Class SelectionRule
java.lang.Object
|
+--openjava.syntax.AbstractSyntaxRule
|
+--openjava.syntax.SelectionRule
- public class SelectionRule
- extends AbstractSyntaxRule
The class SelectionRule
represents selective syntax
rule.
Suppose there're several syntax rules; A, B, C. This class
can represents the syntax ( A | B | C ).
If both A and B are adaptable to token source, A is choosed since
A is specified at lefter part than B's part.
- Since:
- %SOFTWARE% 1.0
- See Also:
Object
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
elementRules
protected SyntaxRule[] elementRules
SelectionRule
public SelectionRule(SyntaxRule[] elementRules)
- Allocates a new rule representing a selection of given rules.
- Parameters:
elementRules
- an array of rules
SelectionRule
public SelectionRule(SyntaxRule e1,
SyntaxRule e2)
SelectionRule
public SelectionRule(SyntaxRule e1,
SyntaxRule e2,
SyntaxRule e3)
consume
public ParseTree consume(TokenSource token_src)
throws SyntaxException
- Description copied from class: AbstractSyntaxRule
- Consumes tokens from the given token source following
the rule. To be overridden.
- Overrides:
- consume in class AbstractSyntaxRule
- Tags copied from class: AbstractSyntaxRule
- Parameters:
token_src
- token source to consume.- Returns:
- a parse tree object consumed by following this rule.