Marc Brooks
2014-04-09 19:16:25 UTC
Hi All -
I am building a parser for queries. I have the following structure:
list(foo.bar, bang)
I'd like to end up with something like this:
actions: [ { 'action':'foo','attrib':'bar'}, {'action':'bang'} ]
For starters, I have:
self.action = Combine(oneOf(self.action_names) + \
Optional("."+ self.action_attrib))
That gives me something like this:
actions : ['foo.bar', 'bang']
I'm not sure how to created the named parts that would let me specify
actions and the optional attribs. Any pointers or suggestions would be
appreciated.
Thanks,
Marc
I am building a parser for queries. I have the following structure:
list(foo.bar, bang)
I'd like to end up with something like this:
actions: [ { 'action':'foo','attrib':'bar'}, {'action':'bang'} ]
For starters, I have:
self.action = Combine(oneOf(self.action_names) + \
Optional("."+ self.action_attrib))
That gives me something like this:
actions : ['foo.bar', 'bang']
I'm not sure how to created the named parts that would let me specify
actions and the optional attribs. Any pointers or suggestions would be
appreciated.
Thanks,
Marc