After some different ways of trying, the sugested solution (now deleted by the author) worked in some way.
What he suggested was updating the lex and yacc definition of comparision.
In the lex file change
<SQL>"=" |
<SQL>"<>" |
<SQL>"<" |
<SQL>">" |
<SQL>"<=" |
<SQL>">=" TOK(COMPARISON)
by
<SQL>"=" TOK(EQ)
<SQL>"<>" TOK(NE)
<SQL>"<" TOK(LT)
<SQL>">" TOK(GT)
<SQL>"<=" TOK(LE)
<SQL>">=" TOK(GE)
In the yacc file add:
comparison:
EQ
| NE
| LT
| GT
| LE
| GE
;
And change all references to = with EQ and the other symbols and COMPARISON with comparison:
%left COMPARISON /* = <> < > <= >= */
by
%left EQ NE LT GT LE GE /* = <> < > <= >= */
assignment:
column = scalar_exp
| column = NULLX
;
by
assignment:
column EQ scalar_exp
| column EQ NULLX
;
And
comparison_predicate:
scalar_exp COMPARISON scalar_exp
| scalar_exp COMPARISON subquery
;
by
comparison_predicate:
scalar_exp comparison scalar_exp
| scalar_exp comparison subquery
;
And it works!