Classes | |
class | Ast |
A class for capturing the AST as the parser traverses the parse tree. More... | |
Functions | |
def | inner_add_callback (nodes, name, callback) |
Set a callback function for a named node. More... | |
def | inner_translate (input, nodes, records, data=None) |
Traverse the AST and call the user's callback functions for translation of the saved AST node phrases. More... | |
def apg_py.lib.ast.inner_add_callback | ( | nodes, | |
name, | |||
callback | |||
) |
Set a callback function for a named node.
Records will only be kept for nodes that have a callback assigned to them. Called by both the original AST and the shallow copy of the AST passed to the pattern-matching results.
nodes | The list of AST nodes. |
name | the rule or UDT name of the node |
callback | the callback function for this node |
def apg_py.lib.ast.inner_translate | ( | input, | |
nodes, | |||
records, | |||
data = None |
|||
) |
Traverse the AST and call the user's callback functions for translation of the saved AST node phrases.
Called by both the original AST and the shallow copy of the AST passed to the pattern-matching results.
input | The input string to the parser as a tuple of integers. |
nodes | The list of AST nodes. |
records | The list of AST node records. |
data | arbitary user data to be passed to the callback functions |