[TransWarp] fmtparse - named rules
Oleg Broytmann
phd at work.phd.pp.ru
Mon Jun 16 12:19:10 EDT 2003
On Mon, Jun 16, 2003 at 11:37:56AM -0400, Phillip J. Eby wrote:
> At 01:15 PM 6/16/03 +0400, Oleg Broytmann wrote:
> >between_expr = Named("between", ExtractString(Sequence("between", '(',
> >Named("name"), ',', Named("value1"), ',', Named("value2"), ')')))
> >
> >test5 = "between(month,1,12)"
> >print parse(test5, between_expr)
> >
> > {'between': 'between(month,1,12)'}. ExtractString extracted too much...
>
> What did you want it to extract? You told it to extract
> Sequence("between", '(', ... ')'), so that's what you got. I'm having
> trouble understanding what you *want* to do here.
I want to get back the tree
{'between': {"name": "month", "value1": "1", "value2": "12"}}
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the PEAK
mailing list