Grammatica
|
A production pattern alternative. More...
Public Member Functions | |
ProductionPatternAlternative () | |
Creates a new production pattern alternative. | |
ProductionPattern | GetPattern () |
Returns the production pattern containing this alternative. More... | |
int | GetElementCount () |
Returns the number of elements in this alternative. More... | |
ProductionPatternElement | GetElement (int pos) |
Returns an element in this alternative. More... | |
bool | IsLeftRecursive () |
Checks if this alternative is recursive on the left-hand side. More... | |
bool | IsRightRecursive () |
Checks if this alternative is recursive on the right-hand side. More... | |
bool | IsMatchingEmpty () |
Checks if this alternative would match an empty stream of tokens. More... | |
int | GetMinElementCount () |
Returns the minimum number of elements needed to satisfy this alternative. More... | |
int | GetMaxElementCount () |
Returns the maximum number of elements needed to satisfy this alternative. More... | |
void | AddToken (int id, int min, int max) |
Adds a token to this alternative. More... | |
void | AddProduction (int id, int min, int max) |
Adds a production to this alternative. More... | |
void | AddElement (ProductionPatternElement elem) |
Adds a production pattern element to this alternative. More... | |
void | AddElement (ProductionPatternElement elem, int min, int max) |
Adds a production pattern element to this alternative. More... | |
override bool | Equals (object obj) |
Checks if this object is equal to another. More... | |
bool | Equals (ProductionPatternAlternative alt) |
Checks if this alternative is equal to another. More... | |
override int | GetHashCode () |
Returns a hash code for this object. More... | |
override string | ToString () |
Returns a string representation of this object. More... | |
Properties | |
ProductionPattern | Pattern [get] |
The production pattern property (read-only). More... | |
int | Count [get] |
The production pattern element count property (read-only). More... | |
ProductionPatternElement | this[int index] [get] |
The production pattern element index (read-only). More... | |
A production pattern alternative.
This class represents a list of production pattern elements. In order to provide productions that cannot be represented with the element occurance counters, multiple alternatives must be created and added to the same production pattern. A production pattern alternative is always contained within a production pattern.
|
inline |
Adds a production pattern element to this alternative.
The element is appended to the end of the element list.
elem | the production pattern element |
|
inline |
Adds a production pattern element to this alternative.
The multiplicity values in the element will be overridden with the specified values. The element is appended to the end of the element list.
elem | the production pattern element |
min | the minimum number of occurancies |
max | the maximum number of occurancies, or -1 for infinite |
|
inline |
Adds a production to this alternative.
The production is appended to the end of the element list. The multiplicity values specified define if the production is optional or required, and if it can be repeated.
id | the production (pattern) id |
min | the minimum number of occurancies |
max | the maximum number of occurancies, or -1 for infinite |
|
inline |
Adds a token to this alternative.
The token is appended to the end of the element list. The multiplicity values specified define if the token is optional or required, and if it can be repeated.
id | the token (pattern) id |
min | the minimum number of occurancies |
max | the maximum number of occurancies, or -1 for infinite |
|
inline |
Checks if this object is equal to another.
This method only returns true for another production pattern alternative with identical elements in the same order.
obj | the object to compare with |
|
inline |
Checks if this alternative is equal to another.
This method returns true if the other production pattern alternative has identical elements in the same order.
alt | the alternative to compare with |
|
inline |
Returns an element in this alternative.
pos | the element position, 0 <= pos < count |
|
inline |
Returns the number of elements in this alternative.
|
inline |
Returns a hash code for this object.
|
inline |
Returns the maximum number of elements needed to satisfy this alternative.
The value returned is the sum of all the elements maximum count.
|
inline |
Returns the minimum number of elements needed to satisfy this alternative.
The value returned is the sum of all the elements minimum count.
|
inline |
Returns the production pattern containing this alternative.
|
inline |
Checks if this alternative is recursive on the left-hand side.
This method checks all the possible left side elements and returns true if the pattern itself is among them.
|
inline |
Checks if this alternative would match an empty stream of tokens.
This check is equivalent of getMinElementCount() returning zero (0).
|
inline |
Checks if this alternative is recursive on the right-hand side.
This method checks all the possible right side elements and returns true if the pattern itself is among them.
|
inline |
Returns a string representation of this object.
|
get |
The production pattern element count property (read-only).
|
get |
The production pattern property (read-only).
This property contains the pattern having this alternative.
|
get |
The production pattern element index (read-only).
index | the element index, 0 <= pos < Count |