Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminals as regular expresions #8

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

Terminals as regular expresions #8

versae opened this issue Apr 8, 2013 · 4 comments

Comments

@versae
Copy link

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
Copy link
Author

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()

@washort
Copy link
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
Copy link
Author

versae commented Apr 23, 2013

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

On Tue, Apr 23, 2013 at 2:23 AM, washort [email protected] 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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants