Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
Symbol Class Reference

Public Member Functions

def __init__
 
def __repr__
 
def get_name
 
def is_referenced
 
def is_parameter
 
def is_global
 
def is_vararg
 
def is_keywordarg
 
def is_local
 
def is_free
 
def is_imported
 
def is_assigned
 
def is_in_tuple
 
def is_namespace
 
def get_namespaces
 
def get_namespace
 

Detailed Description

Definition at line 175 of file symtable.py.

Constructor & Destructor Documentation

def __init__ (   self,
  name,
  flags,
  namespaces = None 
)

Definition at line 176 of file symtable.py.

References Symbol.__flags, Symbol.__name, _Printer.__name, and Symbol.__namespaces.

177  def __init__(self, name, flags, namespaces=None):
178  self.__name = name
179  self.__flags = flags
180  self.__namespaces = namespaces or ()

Member Function Documentation

def __repr__ (   self)

Definition at line 181 of file symtable.py.

References Symbol.__name, and _Printer.__name.

182  def __repr__(self):
183  return "<symbol '%s'>" % self.__name
def get_name (   self)

Definition at line 184 of file symtable.py.

References Symbol.__name, and _Printer.__name.

185  def get_name(self):
186  return self.__name
def get_namespace (   self)
Returns the single namespace bound to this name.

Raises ValueError if the name is bound to multiple namespaces.

Definition at line 240 of file symtable.py.

References Symbol.__namespaces.

241  def get_namespace(self):
242  """Returns the single namespace bound to this name.
243 
244  Raises ValueError if the name is bound to multiple namespaces.
245  """
246  if len(self.__namespaces) != 1:
247  raise ValueError, "name is bound to multiple namespaces"
248  return self.__namespaces[0]
def get_namespaces (   self)
Return a list of namespaces bound to this name

Definition at line 236 of file symtable.py.

References Symbol.__namespaces.

237  def get_namespaces(self):
238  """Return a list of namespaces bound to this name"""
239  return self.__namespaces
def is_assigned (   self)

Definition at line 217 of file symtable.py.

References Symbol.__flags, and symtable.bool().

218  def is_assigned(self):
219  return bool(self.__flags & DEF_LOCAL)
def is_free (   self)

Definition at line 206 of file symtable.py.

References Symbol.__flags.

207  def is_free(self):
208  if (self.__flags & (USE | DEF_FREE)) \
209  and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)):
210  return 1
211  if self.__flags & DEF_FREE_CLASS:
212  return 1
213  return 0
def is_global (   self)

Definition at line 193 of file symtable.py.

References Symbol.__flags, and symtable.bool().

194  def is_global(self):
195  return bool((self.__flags & DEF_GLOBAL)
196  or (self.__flags & DEF_FREE_GLOBAL))
def is_imported (   self)

Definition at line 214 of file symtable.py.

References Symbol.__flags, and symtable.bool().

215  def is_imported(self):
216  return bool(self.__flags & DEF_IMPORT)
def is_in_tuple (   self)

Definition at line 220 of file symtable.py.

References Symbol.__flags, and symtable.bool().

221  def is_in_tuple(self):
222  return bool(self.__flags & DEF_INTUPLE)
def is_keywordarg (   self)

Definition at line 200 of file symtable.py.

References Symbol.__flags, and symtable.bool().

201  def is_keywordarg(self):
202  return bool(self.__flags & DEF_DOUBLESTAR)
def is_local (   self)

Definition at line 203 of file symtable.py.

References Symbol.__flags, and symtable.bool().

204  def is_local(self):
205  return bool(self.__flags & DEF_BOUND)
def is_namespace (   self)
Returns true if name binding introduces new namespace.

If the name is used as the target of a function or class
statement, this will be true.

Note that a single name can be bound to multiple objects.  If
is_namespace() is true, the name may also be bound to other
objects, like an int or list, that does not introduce a new
namespace.

Definition at line 223 of file symtable.py.

References Symbol.__namespaces, and symtable.bool().

224  def is_namespace(self):
225  """Returns true if name binding introduces new namespace.
226 
227  If the name is used as the target of a function or class
228  statement, this will be true.
229 
230  Note that a single name can be bound to multiple objects. If
231  is_namespace() is true, the name may also be bound to other
232  objects, like an int or list, that does not introduce a new
233  namespace.
234  """
235  return bool(self.__namespaces)
def is_parameter (   self)

Definition at line 190 of file symtable.py.

References Symbol.__flags, and symtable.bool().

191  def is_parameter(self):
192  return bool(self.__flags & DEF_PARAM)
def is_referenced (   self)

Definition at line 187 of file symtable.py.

References Symbol.__flags, and symtable.bool().

188  def is_referenced(self):
189  return bool(self.__flags & _symtable.USE)
def is_vararg (   self)

Definition at line 197 of file symtable.py.

References Symbol.__flags, and symtable.bool().

198  def is_vararg(self):
199  return bool(self.__flags & DEF_STAR)

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