[This is preliminary documentation and is subject to change.]
| C# |
public class ProductionToken : Token, IEnumerable<Token>, IEnumerable
| All Members | Methods | Properties | |||
| Icon | Member | Description |
|---|---|---|
| AppendString(StringBuilder, Int32) | Appends a string containing a representation of the abstract
syntax tree to a StringBuilder. | |
| Count | Gets the number of RHS tokens in this ProductionToken. | |
| DecimalValue | Gets the value of this token as a decimal number. Must be
overridden in derived classes. (Inherited from Token.) | |
| DumpString(String) | Creates a string containing a representation of the abstract
syntax tree. | |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) | |
| FloatingValue | Gets the value of this token as a floating point number. Must be
overridden in derived classes. (Inherited from Token.) | |
| GeneratedToken(Int32) | Gets the GeneratedToken at a
particular index in this ProductionToken's RHS tokens. | |
| GeneratedTokenName(Int32) | Gets the production name of the GeneratedToken at a
particular index. | |
| GeneratedValue(Int32) | Gets the generated object within the GeneratedToken
at a particular index in the RHS tokens. | |
| GetEnumerator()()()() | Obtains an enumerator for the tokens in this ProductionToken's
RHS Tokens. | |
| GetHashCode()()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
| GetType()()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| HasDecimalValue | Gets whether this token has a decimal value. Must be overridden
in derived classes. (Inherited from Token.) | |
| Insert(Int32, Token) | Inserts a token into this ProductionToken's RHS tokens at a
particular position. | |
| IntegerToken(Int32) | Gets the IntegerToken at a particular
index in this ProductionToken's RHS tokens. | |
| IntegerValue(Int32) | Gets the long value within the IntegerToken at a particular
index in the RHS tokens. | |
| IntegerValue | Gets the value of this token as an integer number. Must be
overridden in derived classes. (Inherited from Token.) | |
| Item[([( Int32])]) | Gets or sets one of the RHS Tokens in this ProductionToken.
| |
| MemberwiseClone()()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
| ProdToken(Int32) | Gets the ProductionToken at a particular index in this
ProductionToken's tokens collection. | |
| ProdTokenName(Int32) | Gets the Production name of the ProductionToken at
a particular index. | |
| Production | Gets the Production object which was parsed to
produce this token. | |
| RemoveAt(Int32) | Removes the token at a particular index from this
ProductionToken. | |
| RemoveFixedSymbols()()()() | Removes from the RHS tokens any SymbolTokens which have matched against fixed
terminals in the grammar. | |
| Section | Gets the Section denoting the range of characters
corresponding to this token in the source text. (Inherited from Token.) | |
| StringToken(Int32) | Gets the StringToken at a particular
index in this ProductionToken's RHS tokens. | |
| StringValue(Int32) | Gets the string value within the StringToken at a particular
index in the RHS tokens. | |
| SymbolToken(Int32) | Gets the SymbolToken at a particular
index in this ProductionToken's RHS tokens. | |
| SymbolValue(Int32) | Gets the string value within the SymbolToken> at a particular
index in the RHS tokens. | |
| ToString()()()() | Creates a string containing a short representation of this
ProductionToken. (Overrides Object.ToString()()()().) |
Objects of this class represent a parsed instance of a Production in the source grammar. It contains a set of Tokens representing the items on the RHS of the parsed production. These can be other ProductionTokens, or Tokens for terminals, special tokens for symbols, numbers, etc. They can also be ErrorTokens or GeneratedTokens inserted into the syntax tree by code generation methods for productions lower down in the tree.
The RHS Tokens are accessible using the standard integer indexer on this object, and the Count property gets the number of them. There are a number of convenience methods to get a Token of a particular type at a given index, such as SymbolToken, IntegerToken, GeneratedToken, etc.. You will very often know the type of particular Tokens at the code generation stage, as the input source will have passed the syntax parse.
There are also convenience methods to extract the values from Tokens of a particular type at particular indexes. See SymbolValue, IntegerValue, GeneratedValue, etc..
You can add and remove Tokens from the RHS Tokens in this ProductionToken. One use of this is to supply default values for optional clauses in the source grammar, making later processing easier. The methods Insert and RemoveAt perform these functions. One special case of this is the RemoveFixedSymbols method which gets rid of fixed terminal Tokens.