Back to index

enigmail  1.4.3
Public Member Functions | Public Attributes
ply.yacc.LRTable Class Reference
Inheritance diagram for ply.yacc.LRTable:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def read_table
def read_pickle
def bind_callables

Public Attributes

 lr_action
 lr_goto
 lr_productions
 lr_method

Detailed Description

Definition at line 1814 of file yacc.py.


Constructor & Destructor Documentation

def ply.yacc.LRTable.__init__ (   self)

Definition at line 1815 of file yacc.py.

01815 
01816     def __init__(self):
01817         self.lr_action = None
01818         self.lr_goto = None
01819         self.lr_productions = None
01820         self.lr_method = None


Member Function Documentation

def ply.yacc.LRTable.bind_callables (   self,
  pdict 
)

Definition at line 1870 of file yacc.py.

01870 
01871     def bind_callables(self,pdict):
01872         for p in self.lr_productions:
01873             p.bind(pdict)
01874     
01875 # -----------------------------------------------------------------------------
01876 #                           === LR Generator ===
01877 #
01878 # The following classes and functions are used to generate LR parsing tables on 
01879 # a grammar.
01880 # -----------------------------------------------------------------------------
01881 
01882 # -----------------------------------------------------------------------------
01883 # digraph()
01884 # traverse()
01885 #
01886 # The following two functions are used to compute set valued functions
01887 # of the form:
01888 #
01889 #     F(x) = F'(x) U U{F(y) | x R y}
01890 #
01891 # This is used to compute the values of Read() sets as well as FOLLOW sets
01892 # in LALR(1) generation.
01893 #
01894 # Inputs:  X    - An input set
01895 #          R    - A relation
01896 #          FP   - Set-valued function
01897 # ------------------------------------------------------------------------------

def ply.yacc.LRTable.read_pickle (   self,
  filename 
)

Definition at line 1845 of file yacc.py.

01845 
01846     def read_pickle(self,filename):
01847         try:
01848             import cPickle as pickle
01849         except ImportError:
01850             import pickle
01851 
01852         in_f = open(filename,"rb")
01853 
01854         tabversion = pickle.load(in_f)
01855         if tabversion != __tabversion__:
01856             raise VersionError("yacc table file version is out of date")
01857         self.lr_method = pickle.load(in_f)
01858         signature      = pickle.load(in_f)
01859         self.lr_action = pickle.load(in_f)
01860         self.lr_goto   = pickle.load(in_f)
01861         productions    = pickle.load(in_f)
01862 
01863         self.lr_productions = []
01864         for p in productions:
01865             self.lr_productions.append(MiniProduction(*p))
01866 
01867         in_f.close()
01868         return signature

def ply.yacc.LRTable.read_table (   self,
  module 
)

Definition at line 1821 of file yacc.py.

01821 
01822     def read_table(self,module):
01823         if isinstance(module,types.ModuleType):
01824             parsetab = module
01825         else:
01826             if sys.version_info[0] < 3:
01827                 exec("import %s as parsetab" % module)
01828             else:
01829                 env = { }
01830                 exec("import %s as parsetab" % module, env, env)
01831                 parsetab = env['parsetab']
01832 
01833         if parsetab._tabversion != __tabversion__:
01834             raise VersionError("yacc table file version is out of date")
01835 
01836         self.lr_action = parsetab._lr_action
01837         self.lr_goto = parsetab._lr_goto
01838 
01839         self.lr_productions = []
01840         for p in parsetab._lr_productions:
01841             self.lr_productions.append(MiniProduction(*p))
01842 
01843         self.lr_method = parsetab._lr_method
01844         return parsetab._lr_signature


Member Data Documentation

Reimplemented in ply.yacc.LRGeneratedTable.

Definition at line 1816 of file yacc.py.

Reimplemented in ply.yacc.LRGeneratedTable.

Definition at line 1817 of file yacc.py.

Reimplemented in ply.yacc.LRGeneratedTable.

Definition at line 1819 of file yacc.py.

Reimplemented in ply.yacc.LRGeneratedTable.

Definition at line 1818 of file yacc.py.


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