|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.parser.ProductionPatternRule
A production pattern rule. This class represents a list of production pattern elements. In order to provide alternatives that cannot be represented with the element occurance counters, multiple rules must be created and added to the same production pattern. A production pattern rule is always contained within a production pattern.
Constructor Summary | |
ProductionPatternRule()
Creates a new production pattern rule. |
Method Summary | |
void |
addElement(ProductionPatternElement elem)
Adds a production pattern element to this rule. |
void |
addElement(ProductionPatternElement elem,
int min,
int max)
Adds a production pattern element to this rule. |
void |
addProduction(int id,
int min,
int max)
Adds a production to this rule. |
void |
addToken(int id,
int min,
int max)
Adds a token to this rule. |
ProductionPatternElement |
getElement(int pos)
Returns an element in this rule. |
int |
getElementCount()
Returns the number of elements in this rule. |
int |
getMaxElementCount()
Returns the maximum number of elements needed to satisfy this rule. |
int |
getMinElementCount()
Returns the minimum number of elements needed to satisfy this rule. |
ProductionPattern |
getPattern()
Returns the production pattern containing this rule. |
boolean |
isLeftRecursive()
Checks if this rule is recursive on the left-hand side. |
boolean |
isMatchingEmpty()
Checks if this rule would match an empty stream of tokens. |
boolean |
isRightRecursive()
Checks if this rule is recursive on the right-hand side. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ProductionPatternRule()
Method Detail |
public boolean isLeftRecursive()
public boolean isRightRecursive()
public boolean isMatchingEmpty()
public ProductionPattern getPattern()
public int getElementCount()
public int getMinElementCount()
public int getMaxElementCount()
public ProductionPatternElement getElement(int pos)
pos
- the element position, 0 <= pos < count
public void addToken(int id, int min, int max)
id
- the token (pattern) idmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic void addProduction(int id, int min, int max)
id
- the production (pattern) idmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic void addElement(ProductionPatternElement elem)
elem
- the production pattern elementpublic void addElement(ProductionPatternElement elem, int min, int max)
elem
- the production pattern elementmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |