|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.parser.ProductionPattern
A production pattern. This class represents a set of production alternatives that together forms a single production. A production pattern is identified by an integer id and a name, both provided upon creation. The pattern id is used for referencing the production pattern from production pattern elements.
Constructor Summary | |
ProductionPattern(int id,
java.lang.String name)
Creates a new production pattern. |
Method Summary | |
void |
addAlternative(ProductionPatternAlternative alt)
Adds a production pattern alternative. |
ProductionPatternAlternative |
getAlternative(int pos)
Returns an alternative in this pattern. |
int |
getAlternativeCount()
Returns the number of alternatives in this pattern. |
int |
getId()
Returns the unique production pattern identity value. |
java.lang.String |
getName()
Returns the production pattern name. |
boolean |
isLeftRecursive()
Checks if this pattern is recursive on the left-hand side. |
boolean |
isMatchingEmpty()
Checks if this pattern would match an empty stream of tokens. |
boolean |
isRightRecursive()
Checks if this pattern is recursive on the right-hand side. |
boolean |
isSyntetic()
Checks if the syntetic production flag is set. |
void |
setSyntetic(boolean syntetic)
Sets the syntetic production pattern flag. |
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 ProductionPattern(int id, java.lang.String name)
id
- the production pattern idname
- the production pattern nameMethod Detail |
public boolean isSyntetic()
public boolean isLeftRecursive()
public boolean isRightRecursive()
public boolean isMatchingEmpty()
public int getId()
public java.lang.String getName()
public void setSyntetic(boolean syntetic)
syntetic
- the new value of the syntetic flagpublic int getAlternativeCount()
public ProductionPatternAlternative getAlternative(int pos)
pos
- the alternative position, 0 <= pos < count
public void addAlternative(ProductionPatternAlternative alt) throws ParserCreationException
alt
- the production pattern alternative to add
ParserCreationException
- if an identical alternative has
already been addedpublic 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 |