compiler.transformer
index
/usr/lib/python2.2/compiler/transformer.py

Parse tree transformation module.
 
Transforms Python source code into an abstract syntax tree (AST)
defined in the ast module.
 
The simplest ways to invoke this module are via parse and parseFile.
parse(buf) -> AST
parseFile(path) -> AST

 
Modules
            
parser
string
symbol
sys
token
types
 
Classes
            
Transformer
 
class Transformer
      Utility object for transforming Python parse trees.
 
Exposes the following methods:
    tree = transform(ast_tree)
    tree = parsesuite(text)
    tree = parseexpr(text)
    tree = parsefile(fileob | filename)
 
   Methods defined here:
__init__(self)
and_expr(self, nodelist)
and_test(self, nodelist)
argument(self, nodelist)
arith_expr(self, nodelist)
assert_stmt(self, nodelist)
atom(self, nodelist)
atom_backquote(self, nodelist)
atom_lbrace(self, nodelist)
atom_lpar(self, nodelist)
atom_lsqb(self, nodelist)
atom_name(self, nodelist)
atom_number(self, nodelist)
atom_string(self, nodelist)
break_stmt(self, nodelist)
classdef(self, nodelist)
com_NEWLINE(self, *args)
com_append_stmt(self, stmts, node)
com_apply_trailer(self, primaryNode, nodelist)
com_arglist(self, nodelist)
com_argument(self, nodelist, kw)
com_assign(self, node, assigning)
com_assign_attr(self, primary, node, assigning)
com_assign_list(self, node, assigning)
com_assign_name(self, node, assigning)
com_assign_trailer(self, primary, node, assigning)
com_assign_tuple(self, node, assigning)
com_augassign(self, node)
Return node suitable for lvalue of augmented assignment
 
Names, slices, and attributes are the only allowable nodes.
com_augassign_op(self, node)
com_bases(self, node)
com_binary(self, constructor, nodelist)
Compile 'NODE (OP NODE)*' into (type, [ node1, ..., nodeN ]).
com_call_function(self, primaryNode, nodelist)
com_dictmaker(self, nodelist)
com_dotted_as_name(self, node)
com_dotted_name(self, node)
com_fpdef(self, node)
com_fplist(self, node)
com_import_as_name(self, node)
com_list_comprehension(self, expr, node)
com_list_constructor(self, nodelist)
com_list_iter(self, node)
com_node(self, node)
com_select_member(self, primaryNode, nodelist)
com_slice(self, primary, node, assigning)
com_sliceobj(self, node)
com_stmt(self, node)
com_subscript(self, node)
com_subscriptlist(self, primary, nodelist, assigning)
com_try_except(self, nodelist)
com_try_finally(self, nodelist)
comp_op(self, nodelist)
comparison(self, nodelist)
compile_node(self, node)
compound_stmt = stmt(self, nodelist)
continue_stmt(self, nodelist)
del_stmt(self, nodelist)
dotted_name(self, nodelist)
eval_input(self, nodelist)
exec_stmt(self, nodelist)
expr(self, nodelist)
expr_stmt(self, nodelist)
exprlist = testlist(self, nodelist)
factor(self, nodelist)
file_input(self, nodelist)
flow_stmt = stmt(self, nodelist)
for_stmt(self, nodelist)
fpdef(self, nodelist)
fplist(self, nodelist)
funcdef(self, nodelist)
get_docstring(self, node, n=None)
global_stmt(self, nodelist)
if_stmt(self, nodelist)
import_stmt(self, nodelist)
lambdef(self, nodelist)
lookup_node(self, node)
not_test(self, nodelist)
parameters(self, nodelist)
parseexpr(self, text)
Return a modified parse tree for the given expression text.
parsefile(self, file)
Return a modified parse tree for the contents of the given file.
parsesuite(self, text)
Return a modified parse tree for the given suite text.
pass_stmt(self, nodelist)
power(self, nodelist)
print_stmt(self, nodelist)
raise_stmt(self, nodelist)
return_stmt(self, nodelist)
shift_expr(self, nodelist)
simple_stmt(self, nodelist)
single_input(self, node)
sliceop(self, nodelist)
small_stmt = stmt(self, nodelist)
stmt(self, nodelist)
suite(self, nodelist)
term(self, nodelist)
test(self, nodelist)
testlist(self, nodelist)
testlist_safe = testlist(self, nodelist)
trailer(self, nodelist)
transform(self, tree)
Transform an AST into a modified parse tree.
try_stmt(self, nodelist)
varargslist(self, nodelist)
while_stmt(self, nodelist)
xor_expr(self, nodelist)
yield_stmt(self, nodelist)

Data and non-method functions defined here:
__doc__ = 'Utility object for transforming Python parse tr... tree = parsefile(fileob | filename)\n '
__module__ = 'compiler.transformer'
 
Functions
            
Node(*args)
asList(nodes)
debug_tree(tree)
parse(buf, mode='exec')
parseFile(path)
 
Data
             CO_VARARGS = 4
CO_VARKEYWORDS = 8
OP_APPLY = 'OP_APPLY'
OP_ASSIGN = 'OP_ASSIGN'
OP_DELETE = 'OP_DELETE'
__file__ = '/usr/lib/python2.2/compiler/transformer.pyc'
__name__ = 'compiler.transformer'
_assign_types = [292, 293, 294, 295, 297, 298, 299, 300, 301, 302, 303]
_cmp_types = {20: '<', 21: '>', 22: '==', 28: '==', 29: '!=', 30: '<=', 31: '>='}
_doc_nodes = [267, 313, 314, 292, 293, 294, 295, 297, 298, 299, 300, 301, 302, 303, 304]
_legal_node_types = [259, 316, 264, 266, 272, 265, 285, 267, 269, 270, 271, 273, 274, 275, 277, 278, 282, 283, 284, 286, ...]
_names = {0: 'ENDMARKER', 1: 'NAME', 2: 'NUMBER', 3: 'STRING', 4: 'NEWLINE', 5: 'INDENT', 6: 'DEDENT', 7: 'LPAR', 8: 'RPAR', 9: 'LSQB', ...}
error = 'walker.error'
k = 0
klasses = {'Add': <class compiler.ast.Add>, 'And': <class compiler.ast.And>, 'AssAttr': <class compiler.ast.AssAttr>, 'AssList': <class compiler.ast.AssList>, 'AssName': <class compiler.ast.AssName>, 'AssTuple': <class compiler.ast.AssTuple>, 'Assert': <class compiler.ast.Assert>, 'Assign': <class compiler.ast.Assign>, 'AugAssign': <class compiler.ast.AugAssign>, 'Backquote': <class compiler.ast.Backquote>, ...}
nodes = {'add': <class compiler.ast.Add>, 'and': <class compiler.ast.And>, 'assattr': <class compiler.ast.AssAttr>, 'assert': <class compiler.ast.Assert>, 'assign': <class compiler.ast.Assign>, 'asslist': <class compiler.ast.AssList>, 'assname': <class compiler.ast.AssName>, 'asstuple': <class compiler.ast.AssTuple>, 'augassign': <class compiler.ast.AugAssign>, 'backquote': <class compiler.ast.Backquote>, ...}
v = 'ENDMARKER'