Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.4 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

PerCederberg.Grammatica.Parser
Class ProductionPatternElement

System.Object
   |
   +--ProductionPatternElement

   in ProductionPatternElement.cs

class ProductionPatternElement
extends System.Object

A production pattern element. This class represents a reference to either a token or a production. Each element also contains minimum and maximum occurence counters, controlling the number of repetitions allowed. A production pattern element is always contained within a production pattern rule.


Constructor Summary
ProductionPatternElement( bool isToken, int id, int min, int max )
          Creates a new element.
 
Method Summary
 override bool Equals( object obj )
          Checks if this object is equal to another.
 int GetId()
          Returns the node identity.
 internal LookAheadSet GetLookAhead()
          Returns the look-ahead set associated with this alternative.
 int GetMaxCount()
          Returns the maximum occurence count.
 int GetMinCount()
          Returns the minimum occurence count.
 bool IsMatch( Token token )
          Checks if a specific token matches this element.
 bool IsProduction()
          Returns true if this element represents a production.
 bool IsToken()
          Returns true if this element represents a token.
 internal void SetLookAhead( LookAheadSet lookAhead )
          Sets the look-ahead set for this alternative.
 override string ToString()
          Returns a string representation of this object.
 

Constructor Detail

ProductionPatternElement

public ProductionPatternElement( bool isToken, int id, int min, int max );
Creates a new element. If the maximum value if zero (0) or negative, it will be set to Int32.MaxValue.
Parameters:
isToken - the token flag
id - the node identity
min - the minimum number of occurancies
max - the maximum number of occurancies, or negative for infinite


Method Detail

Equals

public override bool Equals( object obj );
Checks if this object is equal to another. This method only returns true for another identical production pattern element.
Parameters:
obj - the object to compare with
Returns:
true if the object is identical to this one, or false otherwise

GetId

public int GetId();
Returns the node identity.
Returns:
the node identity

GetLookAhead

 internal LookAheadSet GetLookAhead();
Returns the look-ahead set associated with this alternative.
Returns:
the look-ahead set associated with this alternative

GetMaxCount

public int GetMaxCount();
Returns the maximum occurence count.
Returns:
the maximum occurence count

GetMinCount

public int GetMinCount();
Returns the minimum occurence count.
Returns:
the minimum occurence count

IsMatch

public bool IsMatch( Token token );
Checks if a specific token matches this element. This method will only return true if this element is a token element, and the token has the same id and this element.
Parameters:
token - the token to check
Returns:
true if the token matches this element, or false otherwise

IsProduction

public bool IsProduction();
Returns true if this element represents a production.
Returns:
true if the element is a production, or false otherwise

IsToken

public bool IsToken();
Returns true if this element represents a token.
Returns:
true if the element is a token, or false otherwise

SetLookAhead

 internal void SetLookAhead( LookAheadSet lookAhead );
Sets the look-ahead set for this alternative.
Parameters:
lookAhead - the new look-ahead set

ToString

public override string ToString();
Returns a string representation of this object.
Returns:
a string representation of this object

 Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.4 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD