Skip to content
Snippets Groups Projects
Commit e827b450 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

parser changes for "!"

parent 7baf2330
Branches
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@ public class ParserGeneration {
"support strings in field accesses",
"allow NULL= in switch",
"support NA_complex_",
"simplified unary and binary operations"
"simplified unary and binary operations",
"allow unary ! in normal expressions"
};
}
......@@ -360,7 +360,7 @@ and_expr returns [ASTNode v]
;
not_expr returns [ASTNode v]
: t=NOT n_ l=not_expr { $v = UnaryOperation.create(sourceSection("not_expr", $t, $l.stop), Operator.UNARY_NOT, $l.v); }
: {true}? t=NOT n_ l=not_expr { $v = UnaryOperation.create(sourceSection("not_expr", $t, $l.stop), Operator.UNARY_NOT, $l.v); }
| b=comp_expr { $v = $b.v; }
;
......@@ -440,6 +440,9 @@ unary_expression returns [ASTNode v]
( (number) => num=number { ((Constant) num).addNegativeSign(); $v = num; }
| l=unary_expression { $v = UnaryOperation.create(sourceSection("unary_expression/MINUS", $m, $l.stop), Operator.UNARY_MINUS, $l.v); }
)
| m=NOT n_ { plusOrMinus = true; }
( l=unary_expression { $v = UnaryOperation.create(sourceSection("unary_expression/UNARY_NOT", $m, $l.stop), Operator.UNARY_NOT, $l.v); }
)
| b=power_expr { $v = $b.v; }
;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment