Back to index

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

List of all members.

Public Member Functions

def __init__
def __repr__
def get_type
def get_id
def get_name
def get_lineno
def is_optimized
def is_nested
def has_children
def has_exec
def has_import_star
def get_identifiers
def lookup
def get_symbols
def get_children

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def __check_children

Private Attributes

 _table
 _filename
 _symbols
 __class__

Detailed Description

Definition at line 40 of file symtable.py.


Constructor & Destructor Documentation

def symtable.SymbolTable.__init__ (   self,
  raw_table,
  filename 
)

Definition at line 42 of file symtable.py.

00042 
00043     def __init__(self, raw_table, filename):
00044         self._table = raw_table
00045         self._filename = filename
00046         self._symbols = {}

Here is the caller graph for this function:


Member Function Documentation

def symtable.SymbolTable.__check_children (   self,
  name 
) [private]

Definition at line 111 of file symtable.py.

00111 
00112     def __check_children(self, name):
00113         return [_newSymbolTable(st, self._filename)
00114                 for st in self._table.children
00115                 if st.name == name]

Here is the caller graph for this function:

Definition at line 47 of file symtable.py.

00047 
00048     def __repr__(self):
00049         if self.__class__ == SymbolTable:
00050             kind = ""
00051         else:
00052             kind = "%s " % self.__class__.__name__
00053 
00054         if self._table.name == "global":
00055             return "<{0}SymbolTable for module {1}>".format(kind, self._filename)
00056         else:
00057             return "<{0}SymbolTable for {1} in {2}>".format(kind,
00058                                                             self._table.name,
00059                                                             self._filename)

Definition at line 116 of file symtable.py.

00116 
00117     def get_children(self):
00118         return [_newSymbolTable(st, self._filename)
00119                 for st in self._table.children]
00120 

Definition at line 70 of file symtable.py.

00070 
00071     def get_id(self):
00072         return self._table.id

Definition at line 97 of file symtable.py.

00097 
00098     def get_identifiers(self):
00099         return self._table.symbols.keys()

Here is the caller graph for this function:

Definition at line 76 of file symtable.py.

00076 
00077     def get_lineno(self):
00078         return self._table.lineno

Definition at line 73 of file symtable.py.

00073 
00074     def get_name(self):
00075         return self._table.name

Definition at line 108 of file symtable.py.

00108 
00109     def get_symbols(self):
00110         return [self.lookup(ident) for ident in self.get_identifiers()]

Here is the call graph for this function:

Definition at line 60 of file symtable.py.

00060 
00061     def get_type(self):
00062         if self._table.type == _symtable.TYPE_MODULE:
00063             return "module"
00064         if self._table.type == _symtable.TYPE_FUNCTION:
00065             return "function"
00066         if self._table.type == _symtable.TYPE_CLASS:
00067             return "class"
00068         assert self._table.type in (1, 2, 3), \
00069                "unexpected type: {0}".format(self._table.type)

Definition at line 86 of file symtable.py.

00086 
00087     def has_children(self):
00088         return bool(self._table.children)

Return true if the scope uses exec.  Deprecated method.

Definition at line 89 of file symtable.py.

00089 
00090     def has_exec(self):
00091         """Return true if the scope uses exec.  Deprecated method."""
00092         return False

Return true if the scope uses import *

Definition at line 93 of file symtable.py.

00093 
00094     def has_import_star(self):
00095         """Return true if the scope uses import *"""
00096         return bool(self._table.optimized & OPT_IMPORT_STAR)

Definition at line 83 of file symtable.py.

00083 
00084     def is_nested(self):
00085         return bool(self._table.nested)

Definition at line 79 of file symtable.py.

00079 
00080     def is_optimized(self):
00081         return bool(self._table.type == _symtable.TYPE_FUNCTION
00082                     and not self._table.optimized)

def symtable.SymbolTable.lookup (   self,
  name 
)

Definition at line 100 of file symtable.py.

00100 
00101     def lookup(self, name):
00102         sym = self._symbols.get(name)
00103         if sym is None:
00104             flags = self._table.symbols[name]
00105             namespaces = self.__check_children(name)
00106             sym = self._symbols[name] = Symbol(name, flags, namespaces)
00107         return sym

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 48 of file symtable.py.

Definition at line 44 of file symtable.py.

Definition at line 45 of file symtable.py.

Definition at line 43 of file symtable.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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