TreeWizard Class |
Namespace: Stimulsoft.Data.Expressions.Antlr.Runtime.Tree
The TreeWizard type exposes the following members.
Name | Description | |
---|---|---|
![]() | TreeWizard(String) | Initializes a new instance of the TreeWizard class |
![]() | TreeWizard(ITreeAdaptor) | Initializes a new instance of the TreeWizard class |
![]() | TreeWizard(ITreeAdaptor, IDictionaryString, Int32) | Initializes a new instance of the TreeWizard class |
![]() | TreeWizard(ITreeAdaptor, String) | Initializes a new instance of the TreeWizard class |
Name | Description | |
---|---|---|
![]() | ComputeTokenTypes |
Compute a Map<String, Integer> that is an inverted index of
tokenNames (which maps int token types to names).
|
![]() | Create |
Create a tree or node from the indicated tree pattern that closely
follows ANTLR tree grammar tree element syntax:
(root child1 ... child2).
|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Equals(Object, Object) |
Compare type, structure, and text of two trees, assuming adaptor in
this instance of a TreeWizard.
|
![]() ![]() | Equals(Object, Object, ITreeAdaptor) |
Compare t1 and t2; return true if token types/text, structure match exactly.
The trees are examined in their entirety so that (A B) does not match
(A B C) nor (A (B C)).
|
![]() ![]() | EqualsCore | |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | Find(Object, Int32) | Return a List of tree nodes with token type ttype |
![]() | Find(Object, String) | Return a List of subtrees matching pattern. |
![]() | FindFirst(Object, Int32) | |
![]() | FindFirst(Object, String) | |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetTokenType | Using the map of token names to token types, return the type. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Index |
Walk the entire tree and make a node name to nodes mapping.
For now, use recursion but later nonrecursive version may be
more efficient. Returns Map<Integer, List> where the List is
of your AST node type. The Integer is the token type of the node.
|
![]() | IndexCore | Do the work for index |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Parse(Object, String) | |
![]() | Parse(Object, String, IDictionaryString, Object) |
Given a pattern like (ASSIGN %lhs:ID %rhs:.) with optional labels
on the various nodes and '.' (dot) as the node/subtree wildcard,
return true if the pattern matches and fill the labels Map with
the labels pointing at the appropriate nodes. Return false if
the pattern is malformed or the tree does not match.
|
![]() | ParseCore |
Do the work for parse. Check to see if the t2 pattern fits the
structure and token types in t1. Check text if the pattern has
text arguments on nodes. Fill labels map with pointers to nodes
in tree matched against nodes in pattern with labels.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Visit(Object, Int32, TreeWizardIContextVisitor) |
Visit every ttype node in t, invoking the visitor. This is a quicker
version of the general visit(t, pattern) method. The labels arg
of the visitor action method is never set (it's null) since using
a token type rather than a pattern doesn't let us set a label.
|
![]() | Visit(Object, Int32, ActionObject) | |
![]() | Visit(Object, String, TreeWizardIContextVisitor) |
For all subtrees that match the pattern, execute the visit action.
The implementation uses the root node of the pattern in combination
with visit(t, ttype, visitor) so nil-rooted patterns are not allowed.
Patterns with wildcard roots are also not allowed.
|
![]() | VisitCore | Do the recursive work for visit |
Name | Description | |
---|---|---|
![]() | adaptor | |
![]() | tokenNameToTypeMap |