|
GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java (public API).
|
Class TNode is an implementation of the AST interface and adds many useful features: More...
Classes | |
| class | DebugASTVisitor |
Public Member Functions | |
| ASTLocusTag | getASTLocusTag () |
Returns this instance's ASTLocusTag, if available, otherwise returns null. More... | |
| void | initialize (final Token token) |
| void | initialize (final AST tr) |
| int | getType () |
| Get the token type for this node. More... | |
| void | setType (final int ttype_) |
| Set the token type for this node. More... | |
| boolean | getMarker () |
| Get the marker value for this node. More... | |
| void | setMarker (final boolean marker_) |
| Set the marker value for this node. More... | |
| Hashtable< String, Object > | getAttributesTable () |
| get the hashtable that holds attribute values. More... | |
| void | setAttribute (final String attrName, final Object value) |
| set an attribute in the attribute table. More... | |
| Object | getAttribute (final String attrName) |
| lookup the attribute name in the attribute table. More... | |
| int | getLineNum () |
| Get the line number for this node. More... | |
| int | getLocalLineNum () |
| void | setLineNum (final int lineNum_) |
| Set the line number for this node. More... | |
| String | getText () |
| Get the token text for this node. More... | |
| void | setText (final String text_) |
| Set the token text for this node. More... | |
| String | getAllChildrenText (final String name) |
| Returns the text for this node, its children and siblings. More... | |
| TNode | getLastChild () |
| return the last child of this node, or null if there is none More... | |
| TNode | getLastSibling () |
| return the last sibling of this node, which is this if the next sibling is null More... | |
| TNode | getFirstSibling () |
| return the first sibling of this node, which is this if the prev sibling is null More... | |
| TNode | getParent () |
| return the parent node of this node More... | |
| void | addSibling (final AST node) |
| add the new node as a new sibling, inserting it ahead of any existing next sibling. More... | |
| int | numberOfChildren () |
| return the number of children of this node More... | |
| void | removeSelf () |
| remove this node from the tree, resetting sibling and parent pointers as necessary. More... | |
| TNode | getDefNode () |
| return the def node for this node More... | |
| void | setDefNode (final TNode n) |
| set the def node for this node More... | |
| TNode | deepCopy () |
| return a deep copy of this node, and all sub nodes. More... | |
| TNode | deepCopyWithRightSiblings () |
| return a deep copy of this node, all sub nodes, and right siblings. More... | |
| String | toString () |
| return a short string representation of the node More... | |
| void | doubleLink () |
| set up reverse links between this node and its first child and its first sibling, and link those as well More... | |
| TNode | parentOfType (final int type) |
| find first parent of the given type, return null on failure More... | |
| TNode | firstChildOfType (final int type) |
| find the first child of the node of the given type, return null on failure More... | |
| TNode | firstSiblingOfType (final int type) |
| find the first sibling of the node of the given type, return null on failure More... | |
| ASTLocusTag | getASTLocusTag () |
Returns this instance's ASTLocusTag, if available, otherwise returns null. More... | |
Static Public Member Functions | |
| static void | setTokenVocabulary (final String s) |
| Set the token vocabulary to a tokentypes class generated by antlr. More... | |
| static void | printTree (final AST t) |
| print given tree to System.out More... | |
| static String | getNameForType (final int t) |
| converts an int tree token type to a name. More... | |
Static Protected Member Functions | |
| static void | printASTNode (final AST t, final int indent) |
| protected method that does the work of printing More... | |
Protected Attributes | |
| int | ttype |
| String | text |
| int | lineNum = 0 |
| TNode | defNode |
| TNode | up |
| TNode | left |
| boolean | marker = false |
| Hashtable< String, Object > | attributes = null |
Class TNode is an implementation of the AST interface and adds many useful features:
It is double-linked for reverse searching. (this is currently incomplete, in that method doubleLink() must be called after any changes to the tree to maintain the reverse links).
It can store a definition node (defNode), so that nodes such as scoped names can refer to the node that defines the name.
It stores line numbers for nodes.
Searches for parents and children of a tree can be done based on their type.
The tree can be printed to System.out using a lisp-style syntax.
Definition at line 38 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.addSibling | ( | final AST | node | ) |
add the new node as a new sibling, inserting it ahead of any existing next sibling.
This method maintains double-linking. if node is null, nothing happens. If the node has siblings, then they are added in as well.
Definition at line 306 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.deepCopy | ( | ) |
return a deep copy of this node, and all sub nodes.
New tree is doubleLinked, with no parent or siblings. Marker value is not copied!
Definition at line 368 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.deepCopyWithRightSiblings | ( | ) |
return a deep copy of this node, all sub nodes, and right siblings.
New tree is doubleLinked, with no parent or left siblings. defNode is not copied
Definition at line 387 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.doubleLink | ( | ) |
set up reverse links between this node and its first child and its first sibling, and link those as well
Definition at line 494 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.firstChildOfType | ( | final int | type | ) |
find the first child of the node of the given type, return null on failure
Definition at line 523 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.firstSiblingOfType | ( | final int | type | ) |
find the first sibling of the node of the given type, return null on failure
Definition at line 534 of file TNode.java.
| String com.jogamp.gluegen.cgram.TNode.getAllChildrenText | ( | final String | name | ) |
Returns the text for this node, its children and siblings.
Implementation converts the AST LISP notation to serialized form.
Definition at line 219 of file TNode.java.
| ASTLocusTag com.jogamp.gluegen.cgram.TNode.getASTLocusTag | ( | ) |
Returns this instance's ASTLocusTag, if available, otherwise returns null.
If source is not available, implementation returns null.
Implements com.jogamp.gluegen.ASTLocusTag.ASTLocusTagProvider.
Definition at line 57 of file TNode.java.
| Object com.jogamp.gluegen.cgram.TNode.getAttribute | ( | final String | attrName | ) |
lookup the attribute name in the attribute table.
If the value does not exist, it returns null.
Definition at line 136 of file TNode.java.
| Hashtable< String, Object > com.jogamp.gluegen.cgram.TNode.getAttributesTable | ( | ) |
get the hashtable that holds attribute values.
Definition at line 119 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.getDefNode | ( | ) |
return the def node for this node
Definition at line 354 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.getFirstSibling | ( | ) |
return the first sibling of this node, which is this if the prev sibling is null
Definition at line 286 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.getLastChild | ( | ) |
return the last child of this node, or null if there is none
Definition at line 266 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.getLastSibling | ( | ) |
return the last sibling of this node, which is this if the next sibling is null
Definition at line 276 of file TNode.java.
| int com.jogamp.gluegen.cgram.TNode.getLineNum | ( | ) |
Get the line number for this node.
If the line number is 0, search for a non-zero line num among children
Definition at line 145 of file TNode.java.
| int com.jogamp.gluegen.cgram.TNode.getLocalLineNum | ( | ) |
Definition at line 155 of file TNode.java.
| boolean com.jogamp.gluegen.cgram.TNode.getMarker | ( | ) |
Get the marker value for this node.
This member is a general-use marker.
Definition at line 108 of file TNode.java.
|
static |
converts an int tree token type to a name.
Does this by reflecting on nsdidl.IDLTreeTokenTypes, and is dependent on how ANTLR 2.00 outputs that class.
Definition at line 481 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.getParent | ( | ) |
return the parent node of this node
Definition at line 296 of file TNode.java.
| String com.jogamp.gluegen.cgram.TNode.getText | ( | ) |
Get the token text for this node.
Definition at line 175 of file TNode.java.
| int com.jogamp.gluegen.cgram.TNode.getType | ( | ) |
Get the token type for this node.
Definition at line 97 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.initialize | ( | final AST | tr | ) |
| void com.jogamp.gluegen.cgram.TNode.initialize | ( | final Token | token | ) |
| int com.jogamp.gluegen.cgram.TNode.numberOfChildren | ( | ) |
return the number of children of this node
Definition at line 319 of file TNode.java.
| TNode com.jogamp.gluegen.cgram.TNode.parentOfType | ( | final int | type | ) |
find first parent of the given type, return null on failure
Definition at line 509 of file TNode.java.
|
staticprotected |
protected method that does the work of printing
Definition at line 432 of file TNode.java.
|
static |
print given tree to System.out
Definition at line 424 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.removeSelf | ( | ) |
remove this node from the tree, resetting sibling and parent pointers as necessary.
This method maintains double-linking
Definition at line 332 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setAttribute | ( | final String | attrName, |
| final Object | value | ||
| ) |
set an attribute in the attribute table.
Definition at line 127 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setDefNode | ( | final TNode | n | ) |
set the def node for this node
Definition at line 359 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setLineNum | ( | final int | lineNum_ | ) |
Set the line number for this node.
Definition at line 169 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setMarker | ( | final boolean | marker_ | ) |
Set the marker value for this node.
This property is a general-use boolean marker.
Definition at line 113 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setText | ( | final String | text_ | ) |
Set the token text for this node.
Definition at line 179 of file TNode.java.
|
static |
Set the token vocabulary to a tokentypes class generated by antlr.
Definition at line 70 of file TNode.java.
| void com.jogamp.gluegen.cgram.TNode.setType | ( | final int | ttype_ | ) |
Set the token type for this node.
Definition at line 101 of file TNode.java.
| String com.jogamp.gluegen.cgram.TNode.toString | ( | ) |
return a short string representation of the node
Definition at line 406 of file TNode.java.
|
protected |
Definition at line 46 of file TNode.java.
|
protected |
Definition at line 42 of file TNode.java.
|
protected |
Definition at line 44 of file TNode.java.
|
protected |
Definition at line 41 of file TNode.java.
|
protected |
Definition at line 45 of file TNode.java.
|
protected |
Definition at line 40 of file TNode.java.
|
protected |
Definition at line 39 of file TNode.java.
|
protected |
Definition at line 43 of file TNode.java.