Back to index

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

List of all members.

Public Member Functions

def visitProduct
def visitSum
def visitConstructor
def visitModule
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 549 of file asdl_c.py.


Member Function Documentation

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.PyTypesDeclareVisitor.visitConstructor (   self,
  cons,
  name 
)

Reimplemented from asdl_c.PickleVisitor.

Definition at line 579 of file asdl_c.py.

00579 
00580     def visitConstructor(self, cons, name):
00581         self.emit("static PyTypeObject *%s_type;" % cons.name, 0)
00582         if cons.fields:
00583             self.emit("static char *%s_fields[]={" % cons.name, 0)
00584             for t in cons.fields:
00585                 self.emit('"%s",' % t.name, 1)
00586             self.emit("};",0)

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.PickleVisitor.visitModule (   self,
  mod 
) [inherited]

Reimplemented in asdl_c.ASTModuleVisitor, and asdl_c.PyTypesVisitor.

Definition at line 334 of file asdl_c.py.

00334 
00335     def visitModule(self, mod):
00336         for dfn in mod.dfns:
00337             self.visit(dfn)

Here is the call graph for this function:

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

Reimplemented from asdl_c.PickleVisitor.

Definition at line 551 of file asdl_c.py.

00551 
00552     def visitProduct(self, prod, name):
00553         self.emit("static PyTypeObject *%s_type;" % name, 0)
00554         self.emit("static PyObject* ast2obj_%s(void*);" % name, 0)
00555         if prod.fields:
00556             self.emit("static char *%s_fields[]={" % name,0)
00557             for f in prod.fields:
00558                 self.emit('"%s",' % f.name, 1)
00559             self.emit("};", 0)

Here is the call graph for this function:

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

Reimplemented from asdl_c.PickleVisitor.

Definition at line 560 of file asdl_c.py.

00560 
00561     def visitSum(self, sum, name):
00562         self.emit("static PyTypeObject *%s_type;" % name, 0)
00563         if sum.attributes:
00564             self.emit("static char *%s_attributes[] = {" % name, 0)
00565             for a in sum.attributes:
00566                 self.emit('"%s",' % a.name, 1)
00567             self.emit("};", 0)
00568         ptype = "void*"
00569         if is_simple(sum):
00570             ptype = get_c_type(name)
00571             tnames = []
00572             for t in sum.types:
00573                 tnames.append(str(t.name)+"_singleton")
00574             tnames = ", *".join(tnames)
00575             self.emit("static PyObject *%s;" % tnames, 0)
00576         self.emit("static PyObject* ast2obj_%s(%s);" % (name, ptype), 0)
00577         for t in sum.types:
00578             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: