Open ItsAshleyJ182 opened 7 years ago
@banjoanderson this is eventually a bug. Fixes welcomed if you feel like it.
One approach to resolve this would be to iterate on the tokenize()
results https://github.com/bastikr/boolean.py/blob/6ff13163c1360574534913d15a3b0bee2660c26a/boolean/boolean.py#L359 at the start of parse()
https://github.com/bastikr/boolean.py/blob/6ff13163c1360574534913d15a3b0bee2660c26a/boolean/boolean.py#L179 eventually in another function and raise ParseError for illegal token sub-sequences such as repeated &
and likely a few other cases
And btw, sorry for the late reply to your ticket! and thank you for using boolean.py!
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.