@@ -155,19 +155,22 @@ private ArithmeticFunctionNode mapArithmeticFunctionExpressionContext(BooleanExp
155155
156156 private ComparisonNode mapComparatorExpressionContext (BooleanExpressionParser .ComparatorExpressionContext ctx ) {
157157 final Operator operator = Operator .getOperatorFromSymbol (ctx .op .getText ()).orElse (Operator .EQUALS );
158- if (!(ctx .right instanceof BooleanExpressionParser .TypesExpressionContext ) && !currentNodes .isEmpty ()) {
159- final Node value = currentNodes .pop ();
160- return new ComparisonNode (mapContextToNode (ctx .left ), value , operator , DataType .INTEGER );
161- } else {
162- if (ctx .left instanceof BooleanExpressionParser .ParentExpressionContext && !currentNodes .isEmpty ()) {
158+
159+ if (!currentNodes .isEmpty () && ((ctx .right instanceof BooleanExpressionParser .ParentExpressionContext || ctx .left instanceof BooleanExpressionParser .ParentExpressionContext ) || !(currentNodes .peek () instanceof ComparisonNode || currentNodes .peek () instanceof BooleanNode ))) {
160+ if (ctx .left instanceof BooleanExpressionParser .TypesExpressionContext ) {
161+ final DataType dataType = getDataType (ctx .left .getStart ());
162+ final Node value = mapContextToNode (ctx .left );
163+ return new ComparisonNode (value , currentNodes .pop (), operator , dataType );
164+ } else if (ctx .right instanceof BooleanExpressionParser .TypesExpressionContext ) {
163165 final DataType dataType = getDataType (ctx .right .getStart ());
164166 final Node value = mapContextToNode (ctx .right );
165167 return new ComparisonNode (currentNodes .pop (), value , operator , dataType );
166168 }
167- final DataType dataType = getDataType (ctx .right .getStart ());
168- final Node value = mapContextToNode (ctx .right );
169- return new ComparisonNode (mapContextToNode (ctx .left ), value , operator , dataType );
170169 }
170+
171+ final DataType dataType = getDataType (ctx .right .getStart ());
172+ final Node value = mapContextToNode (ctx .right );
173+ return new ComparisonNode (mapContextToNode (ctx .left ), value , operator , dataType );
171174 }
172175
173176 private ArithmeticNode mapArithmeticExpressionContext (BooleanExpressionParser .ArithmeticExpressionContext ctx ) {
0 commit comments