solved Re: [SimpleParse] How to refer to simpleparse.common in grammar definition?
Brought to you by:
mcfletch
|
From: Christine C M. <we...@MI...> - 2005-07-26 15:36:09
|
Automagic. Thought I might have to specify a dictionary at init or something. Thanks, -xStine On Tue, 26 Jul 2005, Mike C. Fletcher wrote: > Christine C Moran wrote: > > >When defining a grammar I'd like one of my tokens to be a date in the ISO > >8601 format. I notice that simpleparse.common has some modules for parsing > >ISO dates (iso_date,iso_date_loose), how to refer to this in the grammar > >spec of another language? > > > >Something like awesome.def: > > > >token := isodate / spam > >spam := 'python'/'monty' > > > >Where isodate matches if simpleparser.common.iso_date matches. > > > >Feel free to point me back to Google or the docs if this was something > >simple I overlooked. > > > > > # following magically installs the module's productions in the default > production namespace > from simpleparse.common import iso_date_loose > > grammar = r""" > token := ISO_date_time_loose / spam > ...""" > > HTH, > Mike > > -- > ________________________________________________ > Mike C. Fletcher > Designer, VR Plumber, Coder > http://www.vrplumber.com > http://blog.vrplumber.com > > |