simpleparse.dispatchprocessor
index
s:\sp\simpleparse\dispatchprocessor.py

Dispatch-processor API
 
This is a post-processing processor API based on dispatching
each element of a result tree in a top-down recursive call
structure.  It is the API used by the SimpleParseGrammar Parser,
and likely will be the default processor for SimpleParse.

 
Classes
            
simpleparse.processor.Processor(simpleparse.processor.MethodSource)
DispatchProcessor
 
class DispatchProcessor(simpleparse.processor.Processor)
      Dispatch results-tree in a top-down recursive pattern with
attribute lookup to determine production -> method correspondence.
 
To use the class, subclass it, then define methods for
processing each production.  The methods should take this form:
        def production_name( self, (tag, left, right, children), buffer):
                pass
Where children may be either a list, or None, and buffer is the
entire buffer being parsed.
 
  
Method resolution order:
DispatchProcessor
simpleparse.processor.Processor
simpleparse.processor.MethodSource

Methods defined here:
__call__(self, value, buffer)
Process the results of the parsing run over buffer
 
Value can either be: (success, tags, next) for a top-level
production, or (tag, left, right, children) for a non-top
production.

Data and non-method functions defined here:
__doc__ = 'Dispatch results-tree in a top-down recursive pa... and buffer is the\n\tentire buffer being parsed.\n\t'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'simpleparse.dispatchprocessor'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from simpleparse.processor.Processor:
__repr__(self)
Return a representation of the class
 
Functions
            
dispatch(source, tag, buffer)
Dispatch on source for tag with buffer
 
Find the attribute or key tag[0] of source,
then call it with (tag, buffer)
dispatchList(source, taglist, buffer)
Dispatch on source for each tag in taglist with buffer
getString((tag, left, right, sublist), buffer)
Return the string value of the tag passed
lines(start=None, end=None, buffer=None)
Return line number in file at character index (mx.TextTools version)
multiMap(taglist, source=None, buffer=None)
Convert a taglist to a mapping from tag-object:[list-of-tags]
 
For instance, if you have items of 3 different types, in any order,
you can retrieve them all sorted by type with multimap( childlist)
then access them by tagobject key.
singleMap(taglist, source=None, buffer=None)
Convert a taglist to a mapping from tag-object:tag, overwritting early with late tags
 
Data
             __file__ = r'S:\sp\simpleparse\dispatchprocessor.pyc'
__name__ = 'simpleparse.dispatchprocessor'