Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public fields | Public Member Functions | List of all members
Loyc.Syntax.Lexing.TokenTree Class Reference

A list of Token structures along with the ISourceFile object that represents the source file that the tokens came from. More...


Source file:
Inheritance diagram for Loyc.Syntax.Lexing.TokenTree:
Loyc.ICloneable< out T >

Remarks

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< LNodeToLNodes ()
 Converts this list of Token to a list of LNode. More...
 
DList< TokenFlatten ()
 Converts a token tree back to a plain list. More...
 

Member Function Documentation

new TokenTree Loyc.Syntax.Lexing.TokenTree.Clone ( )
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().

bool Loyc.Syntax.Lexing.TokenTree.Equals ( TokenTree  other)
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.

DList<Token> Loyc.Syntax.Lexing.TokenTree.Flatten ( )
inline

Converts a token tree back to a plain list.

VList<LNode> Loyc.Syntax.Lexing.TokenTree.ToLNodes ( )
inline

Converts this list of Token to a list of LNode.

See Token.ToLNode(ISourceFile) for more information.