Re: [SimpleParse] How to process the tree?
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@ro...> - 2003-07-17 22:59:03
|
Martin d'Anjou wrote:
>Hi,
>
>
>
...
>I tried to subclass the DispatchProcessor, and added a function for each
>production I had (with a simple print statement in each one). I
>instantiated MyProcessor class once. Now I don't now what to do. What
>function should I call to get the ball rolling?
>
Pass the processor in to the parse method:
def parse( self, data, production=None, processor=None, start=0,
stop=None):
"""Parse data with production "production" of this parser
data -- data to be parsed, a Python string, for now
production -- optional string specifying a non-default
production to use
for parsing data
processor -- optional pointer to a Processor or MethodSource
object for
use in determining reporting format and/or post-processing
the results
of the parsing pass. Can be None if neither is desired
(default)
start -- starting index for the parsing, default 0
stop -- stoping index for the parsing, default len(data)
"""
or just call the processor object with the tag-tree result-set and the
data (the string source):
processor( result, data )
HTH,
Mike
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
|