Enhanced C#
Language of your choice: library documentation
|
A list of Token structures along with the ISourceFile object that represents the source file that the tokens came from. More...
A list of Token structures along with the ISourceFile object that represents the source file that the tokens came from.
This class is called TokenTree
because certain kinds of tokens used by some parsers are formed into trees by using TokenTree as the type of the Token.Value of certain tokens. Specifically, the LES and EC# parsers expect open-bracket and open-brace tokens ('(', '[' and '{') to have a child TokenTree that contains all the tokens within a pair of brackets or braces. Typically this tree is not created directly by the lexer, but by a helper class (TokensToTree).
Caution: this class is mutable, even though TokenTrees are sometimes stored in LNodes which are supposed to be immutable. Please do not modify token trees that are stored inside LNodes.
Public fields | |
readonly ISourceFile | File |
Public Member Functions | |
TokenTree (ISourceFile file, int capacity) | |
TokenTree (ISourceFile file, ICollectionAndReadOnly< Token > items) | |
TokenTree (ISourceFile file, IReadOnlyCollection< Token > items) | |
TokenTree (ISourceFile file, ICollection< Token > items) | |
TokenTree (ISourceFile file, IEnumerable< Token > items) | |
TokenTree (ISourceFile file, Token[] items) | |
TokenTree (ISourceFile file) | |
new TokenTree | Clone () |
Gets a deep (recursive) clone of the token tree. More... | |
TokenTree | Clone (bool deep) |
override string | ToString () |
string | ToString (Func< Token, string > toStringStrategy=null) |
override bool | Equals (object obj) |
bool | Equals (TokenTree other) |
Compares the elements of the token tree for equality. More... | |
override int | GetHashCode () |
VList< LNode > | ToLNodes () |
Converts this list of Token to a list of LNode. More... | |
DList< Token > | Flatten () |
Converts a token tree back to a plain list. More... | |
|
inline |
Gets a deep (recursive) clone of the token tree.
Implements Loyc.ICloneable< out T >.
References Loyc.Syntax.Lexing.TokenTree.Clone().
Referenced by Loyc.Syntax.Lexing.TokenTree.Clone().
|
inline |
Compares the elements of the token tree for equality.
Because LNodes are compared by value and not by reference, and LNodes can contain TokenTrees, TokenTrees should also be compared by value.
Converts a token tree back to a plain list.
|
inline |
Converts this list of Token to a list of LNode.
See Token.ToLNode(ISourceFile) for more information.