|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.syntax.AbstractSyntaxRule | +--openjava.syntax.SeparatedListRule
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 )*.
Object
Field Summary | |
private boolean |
allowsEmpty
|
private SyntaxRule |
elementRule
|
private int |
separator
|
Fields inherited from class openjava.syntax.AbstractSyntaxRule |
|
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. |
Method Summary | |
protected abstract void |
addListElement(Object elem)
|
ParseTree |
consume(TokenSource token_src)
Consumes token source. |
private ParseTree |
consumeSepAndElem(TokenSource token_src)
|
protected abstract ParseTree |
getList()
|
protected abstract void |
initList()
|
Methods inherited from class openjava.syntax.AbstractSyntaxRule |
getSyntaxException, lookahead |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private SyntaxRule elementRule
private int separator
private boolean allowsEmpty
Constructor Detail |
public SeparatedListRule(SyntaxRule elementRule, int separator_token, boolean allowsEmpty)
elementRule
- a rule of each element of the listseparator_token
- the id of a token to be separatorTokenID
public SeparatedListRule(SyntaxRule elementRule, int separator_token)
elementRule
- a rule of each element of the listseparator_token
- the id of a token to be separatorTokenID
Method Detail |
protected abstract void initList()
protected abstract void addListElement(Object elem)
protected abstract ParseTree getList()
public final ParseTree consume(TokenSource token_src) throws SyntaxException
consume
in interface SyntaxRule
consume
in class AbstractSyntaxRule
token_src
- token source.
ObjectList
object.
SyntaxException
private ParseTree consumeSepAndElem(TokenSource token_src) throws SyntaxException
SyntaxException
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |