You probably meant to write relationalExpression
in its tree form, where numericExpression
is likely a child of EQUAL
instead of a sibling of it.
// tree parser rule:
relationalExpression
: ^(EQUAL numericExpression relationalExpression)
| ^(NOT_EQUAL numericExpression relationalExpression)
| numericExpression
;
This is of course assuming that your parser has a relationalExpression
rule with either the following form (which uses the AST operator ^
):
// parser rule:
relationalExpression
: numericExpression
( EQUAL^ relationalExpression
| NOT_EQUAL^ relationalExpression
)?
;
Or the following, which uses the rewrite operator ->
:
// parser rule:
relationalExpression
: numericExpression
( EQUAL relationalExpression
-> ^(EQUAL numericExpression relationalExpression)
| NOT_EQUAL relationalExpression
-> ^(NOT_EQUAL numericExpression relationalExpression)
)?
;