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.
||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):
Where children may be either a list, or None, and buffer is the
entire buffer being parsed.
- Method resolution order:
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
Methods inherited from Processor:
- Return a representation of the class
- dispatch(source, tag, buffer)
- Dispatch on source for tag with buffer
Find the attribute or key tag 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
||__file__ = '/home/mcfletch/pylive/simpleparse/dispatchprocessor.pyc'|
__name__ = 'simpleparse.dispatchprocessor'
__package__ = 'simpleparse'