Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
asdl_c.ASTModuleVisitor Class Reference
Inheritance diagram for asdl_c.ASTModuleVisitor:
Inheritance graph
[legend]
Collaboration diagram for asdl_c.ASTModuleVisitor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def visitModule
def visitProduct
def visitSum
def visitConstructor
def addObj
def visitType
def visitField
def emit
def visit

Public Attributes

 file
 cache
 skip
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Definition at line 900 of file asdl_c.py.


Member Function Documentation

def asdl_c.ASTModuleVisitor.addObj (   self,
  name 
)

Definition at line 937 of file asdl_c.py.

00937 
00938     def addObj(self, name):
00939         self.emit('if (PyDict_SetItemString(d, "%s", (PyObject*)%s_type) < 0) return NULL;' % (name, name), 1)
00940 

Here is the call graph for this function:

Here is the caller graph for this function:

def asdl_c.EmitVisitor.emit (   self,
  s,
  depth,
  reflow = True 
) [inherited]

Definition at line 89 of file asdl_c.py.

00089 
00090     def emit(self, s, depth, reflow=True):
00091         # XXX reflow long lines?
00092         if reflow:
00093             lines = reflow_lines(s, depth)
00094         else:
00095             lines = [s]
00096         for line in lines:
00097             line = (" " * TABSIZE * depth) + line + "\n"
00098             self.file.write(line)
00099 

Here is the call graph for this function:

def asdl.VisitorBase.visit (   self,
  object,
  args 
) [inherited]

Definition at line 319 of file asdl.py.

00319 
00320     def visit(self, object, *args):
00321         meth = self._dispatch(object)
00322         if meth is None:
00323             return
00324         try:
00325             meth(object, *args)
00326         except Exception:
00327             output("Error visiting" + repr(object))
00328             output(str(sys.exc_info()[1]))
00329             traceback.print_exc()
00330             # XXX hack
00331             if hasattr(self, 'file'):
00332                 self.file.flush()
00333             os._exit(1)

Here is the call graph for this function:

Here is the caller graph for this function:

def asdl_c.ASTModuleVisitor.visitConstructor (   self,
  cons,
  name 
)

Reimplemented from asdl_c.PickleVisitor.

Definition at line 934 of file asdl_c.py.

00934 
00935     def visitConstructor(self, cons, name):
00936         self.addObj(cons.name)

Here is the call graph for this function:

def asdl_c.PickleVisitor.visitField (   self,
  sum 
) [inherited]

Definition at line 350 of file asdl_c.py.

00350 
00351     def visitField(self, sum):
00352         pass
00353 

Here is the caller graph for this function:

def asdl_c.ASTModuleVisitor.visitModule (   self,
  mod 
)

Reimplemented from asdl_c.PickleVisitor.

Definition at line 902 of file asdl_c.py.

00902 
00903     def visitModule(self, mod):
00904         self.emit("static struct PyModuleDef _astmodule = {", 0)
00905         self.emit('  PyModuleDef_HEAD_INIT, "_ast"', 0)
00906         self.emit("};", 0)
00907         self.emit("PyMODINIT_FUNC", 0)
00908         self.emit("PyInit__ast(void)", 0)
00909         self.emit("{", 0)
00910         self.emit("PyObject *m, *d;", 1)
00911         self.emit("if (!init_types()) return NULL;", 1)
00912         self.emit('m = PyModule_Create(&_astmodule);', 1)
00913         self.emit("if (!m) return NULL;", 1)
00914         self.emit("d = PyModule_GetDict(m);", 1)
00915         self.emit('if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return NULL;', 1)
00916         self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1)
00917         self.emit("return NULL;", 2)
00918         # Value of version: "$Revision$"
00919         self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)'
00920                 % mod.version, 1)
00921         self.emit("return NULL;", 2)
00922         for dfn in mod.dfns:
00923             self.visit(dfn)
00924         self.emit("return m;", 1)
00925         self.emit("}", 0)

Here is the call graph for this function:

def asdl_c.ASTModuleVisitor.visitProduct (   self,
  prod,
  name 
)

Reimplemented from asdl_c.PickleVisitor.

Definition at line 926 of file asdl_c.py.

00926 
00927     def visitProduct(self, prod, name):
00928         self.addObj(name)

Here is the call graph for this function:

def asdl_c.ASTModuleVisitor.visitSum (   self,
  sum,
  name 
)

Reimplemented from asdl_c.PickleVisitor.

Definition at line 929 of file asdl_c.py.

00929 
00930     def visitSum(self, sum, name):
00931         self.addObj(name)
00932         for t in sum.types:
00933             self.visitConstructor(t, name)

Here is the call graph for this function:

def asdl_c.PickleVisitor.visitType (   self,
  type 
) [inherited]

Definition at line 338 of file asdl_c.py.

00338 
00339     def visitType(self, type):
00340         self.visit(type.value, type.name)

Here is the call graph for this function:


Member Data Documentation

Definition at line 316 of file asdl.py.

Definition at line 86 of file asdl_c.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

asdl.VisitorBase.skip [inherited]

Definition at line 317 of file asdl.py.


The documentation for this class was generated from the following file: