When updating our CQL2 implementation to the current grammar, an issue was reported by ANTLR. ANTLR rejected the scalarExpression rule due to left recursion. The current rule is:
The problem is the use of booleanExpression which is any CQL2 expression. All other options are comprised only of literals, property references or functions. It is also unclear why we included booleanExpression instead of booleanLiteral like for the other data types.
scalarExpression is used in binaryComparisonPredicate and isInListPredicate, so as a result, booleanExpression can be used as an operand with the following operators:
<, >, <=, >=: For these operators, boolean values do not make sense.;
=, <>, IN: For these operators, the predicate can always be written so that a boolean expression is used without the operator.
As a consequence, booleanExpression should be replaced by booleanLiteral to simplify the implementation of CQL2 (without loosing expressiveness).
I discussed this with @pvretano and we decided to implement the change. I will create a PR and merge it. If there are any concerns about this change, please let us know before the Features API SWG meeting this Wednesday at 3:30pm CET, so we can discuss and resolve it there, before the OGC TC Closing Plenary on Thursday this week.
When updating our CQL2 implementation to the current grammar, an issue was reported by ANTLR. ANTLR rejected the
scalarExpression
rule due to left recursion. The current rule is:The problem is the use of
booleanExpression
which is any CQL2 expression. All other options are comprised only of literals, property references or functions. It is also unclear why we includedbooleanExpression
instead ofbooleanLiteral
like for the other data types.scalarExpression
is used inbinaryComparisonPredicate
andisInListPredicate
, so as a result,booleanExpression
can be used as an operand with the following operators:<
,>
,<=
,>=
: For these operators, boolean values do not make sense.;=
,<>
,IN
: For these operators, the predicate can always be written so that a boolean expression is used without the operator.As a consequence,
booleanExpression
should be replaced bybooleanLiteral
to simplify the implementation of CQL2 (without loosing expressiveness).I discussed this with @pvretano and we decided to implement the change. I will create a PR and merge it. If there are any concerns about this change, please let us know before the Features API SWG meeting this Wednesday at 3:30pm CET, so we can discuss and resolve it there, before the OGC TC Closing Plenary on Thursday this week.