-
Notifications
You must be signed in to change notification settings - Fork 129
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
Struggling with what I thought should be a simple grammar #230
Comments
The typical practice with Parsimonious grammars is to add a whitespace term (e.g. parsimonious/parsimonious/grammar.py Lines 220 to 256 in d5636a6
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to parse Gmail-like queries, stuff like
Since I'm dealing entirely with strings and
parsimonious
doesn't seem to have a tokenizer, I'm happy for now to use something like this, so the character set of the operators is completely distinct from the character set of words:Still, I'm not getting that to work. My grammar looks like this:
When trying to parse the second query string I get:
If I tack optional whitespace around the and/or operators to gobble up the space before the
||
operator, it parses:but that seems like a crude hack. While I'm not totally averse to the idea of hacking my way to a solution, it still seems there should be a cleaner way to define the grammar. None of the
parsimonious
examples I found dealt with anything like this. Am I missing something?The text was updated successfully, but these errors were encountered: