Grammatica
|
A token node. More...
Public Member Functions | |
Token (TokenPattern pattern, string image, int line, int col) | |
Creates a new token. More... | |
string | GetImage () |
Returns the token image. More... | |
Token | GetPreviousToken () |
Returns the previous token. More... | |
Token | GetNextToken () |
Returns the next token. More... | |
override string | ToString () |
Returns a string representation of this token. More... | |
string | ToShortString () |
Returns a short string representation of this token. More... | |
Public Member Functions inherited from PerCederberg.Grammatica.Runtime.Node | |
virtual int | GetId () |
Returns the node type id. More... | |
virtual string | GetName () |
Returns the node name. More... | |
virtual int | GetStartLine () |
The line number of the first character in this node. More... | |
virtual int | GetStartColumn () |
The column number of the first character in this node. More... | |
virtual int | GetEndLine () |
The line number of the last character in this node. More... | |
virtual int | GetEndColumn () |
The column number of the last character in this node. More... | |
Node | GetParent () |
Returns the parent node. More... | |
virtual int | GetChildCount () |
Returns the number of child nodes. More... | |
int | GetDescendantCount () |
Returns the number of descendant nodes. More... | |
virtual Node | GetChildAt (int index) |
Returns the child node with the specified index. More... | |
int | GetValueCount () |
Returns the number of computed values associated with this node. More... | |
object | GetValue (int pos) |
Returns a computed value of this node, if previously set. More... | |
ArrayList | GetAllValues () |
Returns the list with all the computed values for this node. More... | |
void | AddValue (object value) |
Adds a computed value to this node. More... | |
void | AddValues (ArrayList values) |
Adds a set of computed values to this node. More... | |
void | RemoveAllValues () |
Removes all computed values stored in this node. More... | |
void | PrintTo (TextWriter output) |
Prints this node and all subnodes to the specified output stream. More... | |
Properties | |
override int | Id [get] |
The node type id property (read-only). More... | |
override string | Name [get] |
The node name property (read-only). More... | |
override int | StartLine [get] |
The line number property of the first character in this node (read-only). More... | |
override int | StartColumn [get] |
The column number property of the first character in this node (read-only). More... | |
override int | EndLine [get] |
The line number property of the last character in this node (read-only). More... | |
override int | EndColumn [get] |
The column number property of the last character in this node (read-only). More... | |
string | Image [get] |
The token image property (read-only). More... | |
Token | Previous [get, set] |
The previous token property. More... | |
Token | Next [get, set] |
The next token property. More... | |
Properties inherited from PerCederberg.Grammatica.Runtime.Node | |
abstract int | Id [get] |
The node type id property (read-only). More... | |
abstract string | Name [get] |
The node name property (read-only). More... | |
virtual int | StartLine [get] |
The line number property of the first character in this node (read-only). More... | |
virtual int | StartColumn [get] |
The column number property of the first character in this node (read-only). More... | |
virtual int | EndLine [get] |
The line number property of the last character in this node (read-only). More... | |
virtual int | EndColumn [get] |
The column number property of the last character in this node (read-only). More... | |
Node | Parent [get] |
The parent node property (read-only). More... | |
virtual int | Count [get] |
The child node count property (read-only). More... | |
virtual Node | this[int index] [get] |
The child node index (read-only). More... | |
ArrayList | Values [get, set] |
The node values property. More... | |
A token node.
This class represents a token (i.e. a set of adjacent characters) in a parse tree. The tokens are created by a tokenizer, that groups characters together into tokens according to a set of token patterns.
|
inline |
Creates a new token.
pattern | the token pattern |
image | the token image (i.e. characters) |
line | the line number of the first character |
col | the column number of the first character |
|
inline |
Returns the token image.
The token image consists of the input characters matched to form this token.
|
inline |
Returns the next token.
The next token may be a token that has been ignored in the parsing. Note that if the token list feature hasn't been used in the tokenizer, this method will always return null. By default the token list feature is not used.
|
inline |
Returns the previous token.
The previous token may be a token that has been ignored in the parsing. Note that if the token list feature hasn't been used in the tokenizer, this method will always return null. By default the token list feature is not used.
|
inline |
Returns a short string representation of this token.
The string will only contain the token image and possibly the token pattern name.
|
inline |
Returns a string representation of this token.
|
get |
The column number property of the last character in this node (read-only).
If the node has child elements, this value will be fetched from the last child.
|
get |
The line number property of the last character in this node (read-only).
If the node has child elements, this value will be fetched from the last child.
|
get |
The node type id property (read-only).
This value is set as a unique identifier for each type of node, in order to simplify later identification.
|
get |
The token image property (read-only).
The token image consists of the input characters matched to form this token.
|
get |
The node name property (read-only).
|
getset |
The next token property.
If the token list feature is used in the tokenizer, all tokens found will be chained together in a double-linked list. The next token may be a token that was ignored during the parsing, due to it's ignore flag being set. If there is no next token or if the token list feature wasn't used in the tokenizer (the default), the next token will always be null.
|
getset |
The previous token property.
If the token list feature is used in the tokenizer, all tokens found will be chained together in a double-linked list. The previous token may be a token that was ignored during the parsing, due to it's ignore flag being set. If there is no previous token or if the token list feature wasn't used in the tokenizer (the default), the previous token will always be null.
|
get |
The column number property of the first character in this node (read-only).
If the node has child elements, this value will be fetched from the first child.
|
get |
The line number property of the first character in this node (read-only).
If the node has child elements, this value will be fetched from the first child.