JSqlParser
JSqlParser copied to clipboard
NotExpression parsing error
trafficstars
Describe the bug NotExpression is not parsed correctly.
To Reproduce Steps to reproduce the behavior:
CCJSqlParserUtil.parseCondExpression("not not 1 = 1")generates following objects:NotExpression ( EqualsTo ( NotExpression ( 1 ) = 1 ) ). Instead, the result should be:NotExpression ( NotExpression ( EqualsTo (1 = 1) ) )CCJSqlParserUtil.parseCondExpression("not not not 1 = 1")yields Exception:net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "not" "NOT"
Expected behavior Based on SQL operator precedence and associativity, NOT operator should be evaluated after equal (=), and NOT operator should be evaluated from right to left.
System
- Database you are using - irrelative
- Java Version - 1.8
- JSqlParser version - 4.0
You are right, that not expressions are not truly hierarchical handled by JSqlParser. This would lead to heavy grammar refactoring, I think.
Is this a pressing feature you need?