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

Fails to detect repeated operators in a single expression (e.g. a &&& b) #61

Open
ItsAshleyJ182 opened this issue Feb 13, 2017 · 3 comments
Labels

Comments

@ItsAshleyJ182
Copy link

Parsing search strings such as 'a &&& b' or even 'a & & b' generates a result of
AND( Symbol('a'), Symbol('yes') )
When realistically, neither expression makes that much sense syntactically. Looking at the code, there only seems to be checking for repeated Symbol objects. Is this a design decision that was made during development? I see this leading to potential instances where a user would send in an incorrect search string that evaluates to an unintended result.

@pombredanne
Copy link
Collaborator

@banjoanderson this is eventually a bug. Fixes welcomed if you feel like it.

@pombredanne
Copy link
Collaborator

One approach to resolve this would be to iterate on the tokenize() results

def tokenize(self, expr):
at the start of parse()
def parse(self, expr, simplify=False):
eventually in another function and raise ParseError for illegal token sub-sequences such as repeated & and likely a few other cases

@pombredanne
Copy link
Collaborator

And btw, sorry for the late reply to your ticket! and thank you for using boolean.py!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants