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

PerCederberg.Grammatica.Runtime
Class ProductionPattern

System.Object
   |
   +--ProductionPattern

   in ProductionPattern.cs

public class ProductionPattern
extends System.Object

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.


Field Summary
 int Count
          The production pattern alternative count property (read-only).
 internal ProductionPatternAlternative DefaultAlternative
          The default pattern alternative property.
 int Id
          The production pattern identity property (read-only).
 internal LookAheadSet LookAhead
          The look-ahead set property.
 string Name
          The production pattern name property (read-only).
 bool Synthetic
          The synthetic production pattern property.
 ProductionPatternAlternative[ int index ] this
          The production pattern alternative index (read-only).
 
Constructor Summary
ProductionPattern( int id, string name )
          Creates a new production pattern.
 
Method Summary
 void AddAlternative( ProductionPatternAlternative alt )
          Adds a production pattern alternative.
 ProductionPatternAlternative GetAlternative( int pos )
          Deprecated. Use the class indexer instead.
 int GetAlternativeCount()
          Deprecated. Use the Count property instead.
 int GetId()
          Deprecated. Use the Id property instead.
 string GetName()
          Deprecated. Use the Name property instead.
 bool IsLeftRecursive()
          Checks if this pattern is recursive on the left-hand side.
 bool IsMatchingEmpty()
          Checks if this pattern would match an empty stream of tokens.
 bool IsRightRecursive()
          Checks if this pattern is recursive on the right-hand side.
 bool IsSyntetic()
          Deprecated. Use the Synthetic property instead.
 void SetSyntetic( bool synthetic )
          Deprecated. Use the Synthetic property instead.
 override string ToString()
          Returns a string representation of this object.
 

Field Detail

Count

public int Count;
The production pattern alternative count property (read-only).
Since:
1.5

DefaultAlternative

 internal ProductionPatternAlternative DefaultAlternative;
The default pattern alternative property. The default alternative is used when no other alternative matches. The default alternative must previously have been added to the list of alternatives. This property is set to null if no default pattern alternative has been set.

Id

public int Id;
The production pattern identity property (read-only). This property contains the unique identity value.
Since:
1.5

LookAhead

 internal LookAheadSet LookAhead;
The look-ahead set property. This property contains the look-ahead set associated with this alternative.

Name

public string Name;
The production pattern name property (read-only).
Since:
1.5

Synthetic

public bool Synthetic;
The synthetic production pattern property. If this property is set, the production identified by this pattern has been artificially inserted into the grammar. No parse tree nodes will be created for such nodes, instead the child nodes will be added directly to the parent node. By default this property is set to false.
Since:
1.5

this

public ProductionPatternAlternative this[ int index ];
The production pattern alternative index (read-only).
Parameters:
index - the alternative index, 0 <= pos < Count
Returns:
the alternative found
Since:
1.5


Constructor Detail

ProductionPattern

public ProductionPattern( int id, string name );
Creates a new production pattern.
Parameters:
id - the production pattern id
name - the production pattern name


Method Detail

AddAlternative

public void AddAlternative( ProductionPatternAlternative alt );
Adds a production pattern alternative.
Parameters:
alt - the production pattern alternative to add
Throws:
ParserCreationException - if an identical alternative has already been added

GetAlternative

public ProductionPatternAlternative GetAlternative( int pos );
Deprecated. Use the class indexer instead.

Returns an alternative in this pattern.

Parameters:
pos - the alternative position, 0 <= pos < count
Returns:
the alternative found

GetAlternativeCount

public int GetAlternativeCount();
Deprecated. Use the Count property instead.

Returns the number of alternatives in this pattern.

Returns:
the number of alternatives in this pattern
See Also:
Count

GetId

public int GetId();
Deprecated. Use the Id property instead.

Returns the unique production pattern identity value.

Returns:
the production pattern id
See Also:
Id

GetName

public string GetName();
Deprecated. Use the Name property instead.

Returns the production pattern name.

Returns:
the production pattern name
See Also:
Name

IsLeftRecursive

public bool IsLeftRecursive();
Checks if this pattern is recursive on the left-hand side. This method checks if any of the production pattern alternatives is left-recursive.
Returns:
true if at least one alternative is left recursive, or false otherwise

IsMatchingEmpty

public bool IsMatchingEmpty();
Checks if this pattern would match an empty stream of tokens. This method checks if any one of the production pattern alternatives would match the empty token stream.
Returns:
true if at least one alternative match no tokens, or false otherwise

IsRightRecursive

public bool IsRightRecursive();
Checks if this pattern is recursive on the right-hand side. This method checks if any of the production pattern alternatives is right-recursive.
Returns:
true if at least one alternative is right recursive, or false otherwise

IsSyntetic

public bool IsSyntetic();
Deprecated. Use the Synthetic property instead.

Checks if the synthetic production flag is set. If this flag is set, the production identified by this pattern has been artificially inserted into the grammar. No parse tree nodes will be created for such nodes, instead the child nodes will be added directly to the parent node.

Returns:
true if this production pattern is synthetic, or false otherwise
See Also:
Synthetic

SetSyntetic

public void SetSyntetic( bool synthetic );
Deprecated. Use the Synthetic property instead.

Sets the synthetic production pattern flag. If this flag is set, the production identified by this pattern has been artificially inserted into the grammar. By default this flag is set to false.

Parameters:
syntetic - the new value of the synthetic flag
See Also:
Synthetic

ToString

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

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