openjava.syntax
Class SeparatedListRule
java.lang.Object
|
+--openjava.syntax.AbstractSyntaxRule
|
+--openjava.syntax.SeparatedListRule
- Direct Known Subclasses:
- DefaultListRule, ExpressionListRule
- public abstract class SeparatedListRule
- extends AbstractSyntaxRule
The class SeparatedListRule
represents the syntax
rule of a list separated by an separator.
Suppose there's a syntax rule A and token t. This class can
represents the syntax A ( t A )*.
- Since:
- %SOFTWARE% 1.0
- See Also:
Object
Constructor Summary |
SeparatedListRule(SyntaxRule elementRule,
int separator_token)
Allocates a new rule representing a list of a give rule
separeted by a given separator. |
SeparatedListRule(SyntaxRule elementRule,
int separator_token,
boolean allowsEmpty)
Allocates a new rule representing a list of a give rule
separeted by a given separator. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SeparatedListRule
public SeparatedListRule(SyntaxRule elementRule,
int separator_token,
boolean allowsEmpty)
- Allocates a new rule representing a list of a give rule
separeted by a given separator.
- Parameters:
elementRule
- a rule of each element of the listseparator_token
- the id of a token to be separatorallowEmpty
- a flag to allow 0 iteration if it is true.- See Also:
TokenID
SeparatedListRule
public SeparatedListRule(SyntaxRule elementRule,
int separator_token)
- Allocates a new rule representing a list of a give rule
separeted by a given separator.
- Parameters:
elementRule
- a rule of each element of the listseparator_token
- the id of a token to be separator- See Also:
TokenID
initList
protected abstract void initList()
addListElement
protected abstract void addListElement(java.lang.Object elem)
getList
protected abstract ParseTree getList()
consume
public final ParseTree consume(TokenSource token_src)
throws SyntaxException
- Consumes token source.
- Overrides:
- consume in class AbstractSyntaxRule
- Parameters:
token_src
- token source.- Returns:
- null if this fails to consume a syntax tree represented
by this object. Otherwise it returns
ObjectList
object.