Terminals as regular expresions #8

Open
versae opened this Issue Apr 8, 2013 · 4 comments

Projects

None yet

2 participants

versae commented Apr 8, 2013

I need to build a grammar from user inputs, and I was trying to do something like this

parsley.makeGrammar("d = '{test}'".format(test="TeSt"), {})("TeSt").d()

But having {test} case insensitive, so I tried the next

parsley.makeGrammar("d = '(?i){test}'".format(test="TeSt"), {})("TeSt").d()
parsley.makeGrammar("d = (?i)'{test}'".format(test="TeSt"), {})("TeSt").d()

But none of them worked. Is there any way to achieve that?

versae commented Apr 18, 2013

Any update on this?

I almost got it working using this ugly rule

import re
parsley.makeGrammar("d = anything*:x !(re.compile('(?i){test}').match(''.join(x)) and ''.join(x))".format(test="TeSt"), {"re": re})("TeSt").d()
Contributor
washort commented Apr 23, 2013

having an re() rule that took a regular expression could be interesting. let me know what you come up with :)

versae commented Apr 23, 2013

+1. Provided that all (?iLmsux) flags are accepted :-D

On Tue, Apr 23, 2013 at 2:23 AM, washort notifications@github.com wrote:

having an re() rule that took a regular expression could be interesting.
let me know what you come up with :)


Reply to this email directly or view it on GitHubhttps://github.com/washort/parsley/issues/8#issuecomment-16841429
.

Javier de la Rosa
http://versae.es

versae commented Aug 11, 2013

Any advance on this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment