Re: [SimpleParse] Look ahead in the tree
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@ro...> - 2003-08-08 00:13:58
|
Martin d'Anjou wrote: >Hi, > >It appears I've defined a syntax where some amount of looking ahead in the >tree is required. What support is there when I parse the tree with a >DispatchProcessor extension? > Not anything specific. Keep in mind, however, that dispatch processor is just a simple method-dispatching mechanism. You can readily tell your higher-level dispatch method to pass multiple values to a method for dealing with the complex data-set and then have that method use the dispatching mechanism when it wants to recurse: class X( DispatchProcessor ): def parent( self, ... ): result = [] for childIndex in range(len(children)): result.append( self.subElements( children[childIndex:] )) def subElements( self, elements ): current = self.dispatch( elements[0] ) do_stuff_that_needs_to_know_about_rest_of_set(current, elements) return current or the like... HTH, Mike _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ |