-
Notifications
You must be signed in to change notification settings - Fork 79
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
Allow use of logical operators with single arg #224
Allow use of logical operators with single arg #224
Conversation
Previously, searching for things like `& thing` constructed the AST incorrectly. Parsing `& thing` would produce the AST which would simplify into `<AST::OperatorNode [:and, "thing"]>`, which then couldn't really be used for searching. This change builds the AST fully, meaning this will accept even things like `& & & & & & thing` which will then simplify into a single LeafNode.
Thanks, @adamruzicka, seems to work fine with most (if not all) corner cases, but I think I've found one more: If I'm not mistaken, then if the whole string starts with
|
Good catch,
In this case, I'd probably go with the second option. Opinions? |
That could do it, but then again, we do support "weird stuff" and don't throw a syntax error, but silently "support" it. Wouldn't it be inconsistent in that case? |
Right, went with 1 for the sake of consistency |
Some more chaotic testing:
|
I'd say the original issue we set out to resolve was resolved. We resolved the things which sort of make sense and made left-hand-side-less handling a little bit more consistent. There are still cases in which the input is just unparseable, if that's even a word, and in that case halting with an error feels acceptable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @adamruzicka, fine by me then :)
b178bed
to
b08ad90
Compare
Thank you @ofedoren ! |
Previously, searching for things like
& thing
constructed the AST incorrectly. Parsing& thing
would produce the AST which would simplify into<AST::OperatorNode [:and, "thing"]>
, which then couldn't really be used for searching.This change builds the AST fully, meaning this will accept even things like
& & & & & & thing
which will then simplify into a single LeafNode.