compiler.transformer
index
/usr/local/lib/python2.4/compiler/transformer.py
Module Docs

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
symbol
sys
token
types

 
Classes
       
Transformer
exceptions.StandardError(exceptions.Exception)
WalkerError

 
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_as_names(self, node)
com_dotted_name(self, node)
com_fpdef(self, node)
com_fplist(self, node)
com_gen_iter(self, node)
com_generator_expression(self, expr, node)
com_import_as_name(self, node)
com_import_as_names(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)
decode_literal(self, lit)
decorator(self, nodelist)
decorator_name(self, nodelist)
decorators(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_from(self, nodelist)
import_name(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)
testlist1 = testlist(self, nodelist)
testlist_gexp(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)

 
class WalkerError(exceptions.StandardError)
    
Method resolution order:
WalkerError
exceptions.StandardError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
Functions
       
Node(*args)
asList(nodes)
debug_tree(tree)
extractLineNo(ast)
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'
k = 51
name = 'If'
nodes = {'expression': 'Expression'}
v = 'OP'