Closed MatthijsBurgh closed 4 years ago
@dirk-thomas I created this before I found out that a fix was already implemented in master, but not yet released.
I think this is a more elegant solution as we don't abuse _evaluate
to be a recursive function which handles all cases all parts of the solution. Instead create different classes with each handling there part of the solution.
Please let me know what you think of it.
Thanks for this improvement.
I updated the title to reflect the actual content of the patch. I also added some commits to mainly keep the diff more readable / minimal. I hope they make sense to you.
@dirk-thomas looks good!
Inspired by https://github.com/pyparsing/pyparsing/blob/master/examples/simpleBool.py With the use of ParseActions, the result are specific classes in which better use is made of the results of the operatorPrecedence.
I wanted to use
bool
with an extra argument, but that isn't allowed, therefore I chose to implement__call__
for all the classes.Fixes #277, #281, improvement of #279