|
siplasplas
|
Public Member Functions | |
| def | __init__ (self, cursor, parent=None, translation_unit=None, file=None) |
| def | skip (self) |
| def | set_skip (self) |
| def | print_ast_node (self) |
| def | get_children (self) |
| def | create_child (nodeClass, kwargs) |
| def | create_node (nodeClass, kwargs) |
| def | process (self) |
| def | initialize_children (nodeClass, node) |
| def | spelling (self) |
| def | displayname (self) |
| def | spelling_as_charpack (self) |
| def | displayname_as_charpack (self) |
| def | file_as_charpack (self) |
| def | name (self) |
| def | is_public (self) |
| def | kind (self) |
| def | kindstring (self) |
| def | node_class_kind (nodeClass) |
| def | fullname (self) |
| def | fullname_as_charpack (self) |
| def | __str__ (self) |
| def | attribute (self) |
| def | reflection_enabled (self) |
Public Attributes | |
| cursor | |
| parent | |
| children | |
| attributes | |
| translation_unit | |
| file | |
| kindstring | |
Base class of all processed AST nodes
An AST node has the original AST node (libclang.cindex.Cursor)
info plus parsed attributes associated with it
Node processing works by associating Node subclasses with different
clang.cindex cursor kinds. Each Node subclass declares which members
it recognises by mapping between the known cursor kinds and the corresponding Node
subclasses. For example, a namespace may declare it only knows about classes and other
namespaces as members, as follows:
class Namespace(Node):
@staticmethod
def MEMBERS_MAPPING():
return {
CursorKind.NAMESPACE: Namespace,
CursorKind.CLASS_DECL: Class
}
Node instances should be created through the Node.create_node() function,
which takes care of creating the node and initializing its attributes and
child nodes.
| def ast.node.Node.__init__ | ( | self, | |
| cursor, | |||
parent = None, |
|||
translation_unit = None, |
|||
file = None |
|||
| ) |
Initializes a node, given its libclang AST cursor and the parent node
NEVER create nodes calling plain class constructor, use create_node()
instead.
| def ast.node.Node.attribute | ( | self | ) |
Returns the attribute (if any) applied to this node
Currently only one attribute per node is supported (See TranslationUnit.match_annotations()
for the reasoning behind this limitation)
| def ast.node.Node.create_child | ( | nodeClass, | |
| kwargs | |||
| ) |
Creates a child node of the given parent node, from the given
libclang cursor
If a mapping of the cursor kind is found (See Node class docstring above) an
instance of the corresponding Node subclass is returned. Else None is returned.
| def ast.node.Node.create_node | ( | nodeClass, | |
| kwargs | |||
| ) |
Creates a node and initializes its children and attributes
| def ast.node.Node.fullname | ( | self | ) |
Returns the full qualified name of the entity pointed by the node
| def ast.node.Node.initialize_children | ( | nodeClass, | |
| node | |||
| ) |
Fills the children dict of the node
The children dictionary has one entry for each node kind
recognised by this node class, so classes, functions, fields, etc
are classified.
Each kind entry is a dict 'node name' -> 'node', where the node name
is the spelling of the AST node ('f', 'std::vector<int>', 'MyClass', etc)
| def ast.node.Node.kindstring | ( | self | ) |
Returns the string representation of the kind of this node
| def ast.node.Node.node_class_kind | ( | nodeClass | ) |
Returns an string representation of the node kind implemented by the node class
| def ast.node.Node.print_ast_node | ( | self | ) |
Yields an string representation of the node, suitable for AST printing
| def ast.node.Node.process | ( | self | ) |
Processes node data after creation
| def ast.node.Node.reflection_enabled | ( | self | ) |
Says whether the user requested reflection for this node
Disabled by default, each Node subclass may implement a different criteria
1.8.12