How To Validate Boolean Expression Syntax Using Pyparsing?
I'm using the Pyparsing library to evaluate simple boolean queries like these ones: (True AND True) OR False AND True (True AND (True OR False OR True)) Using the simpleBool scri
Solution 1:
Answer by @PaulMcGuire:
Change boolExpr.parseString(t)[0] to boolExpr.parseString(t, parseAll=True)[0]. Pyparsing will not raise an exception if it can find a valid match in the leading part of the string, even if there is junk tacked on to the end. By adding parseAll=True, you tell pyparsing that the entire string must parse successfully.
Post a Comment for "How To Validate Boolean Expression Syntax Using Pyparsing?"