simpleparse.processor
index
/usr/src/tmp/python3-module-simpleparse-buildroot/usr/lib/python3/site-packages/simpleparse/processor.py

Definitions of the MethodSource and Processor APIs

 
Classes
       
object
MethodSource
Processor

 
class MethodSource(object)
    Base class for MethodSource objects (including Processors and Parsers)
Most applications will use either Processor or Parser objects, rather
than directly using a MethodSource object.
 
The MethodSource is basically just a generic object whose attributes
are accessed during generation and/or post-processing of parse results.
The following are the special attribute forms for use in 
 
    _m_productionname -- alters the method used in the TextTools
        engine for storing results.  If this is a callable object,
        then call the object with:
            object( taglist,text,l,r,subtags )
            
        If it is TextTools.AppendToTagobj, then append the result
        tuple to the associated object (_o_productionname).  This
        requires that _o_productionname have an "append" method,
        obviously.
 
        If it is the constant TextTools.AppendMatch, then append
        the string value which matched the production.
        
        If it is TextTools.AppendTagobj, then append the associated
        tagobject itself to the results tree.
        
    _o_productionname -- with AppendToTagobj, AppendTagobj and
        cases where there is no _m_productionname defined, this
        allows you to provide an explicit tagobject for reporting
        in the results tree/getting called with results.
 
  Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Processor(MethodSource)
    Provides definition of a generic processing API
 
Basically, a Processor has a method __call__ which takes
two arguments, a value (which is either a 3-tuple or a 4-tuple
depending on whether a top-level production is being processed),
and a pointer to the buffer being parsed.
 
 
Method resolution order:
Processor
MethodSource
object

Methods defined here:
__call__(self, value, buffer)
Process the results of a parsing run over buffer
__repr__(self)
Return a representation of the class

Data descriptors inherited from MethodSource:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        __file__ = '/usr/src/tmp/python3-module-simpleparse-buildroo...ib/python3/site-packages/simpleparse/processor.py'
__name__ = 'simpleparse.processor'