From 44e7342cc3b13404df73945a9304dcc52b9aae10 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 19 May 2019 19:08:21 -0400 Subject: Specify precedence of unary versions of operators --- bin/order.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/order.y b/bin/order.y index 78051fe1..5bb93f9b 100644 --- a/bin/order.y +++ b/bin/order.y @@ -80,9 +80,9 @@ expr: | Dec expr { $$ = fmt("(--%s)", $2); } | expr Inc { $$ = fmt("(%s++)", $1); } | expr Dec { $$ = fmt("(%s--)", $1); } - | '-' expr { $$ = fmt("(-%s)", $2); } - | '*' expr { $$ = fmt("(*%s)", $2); } - | '&' expr { $$ = fmt("(&%s)", $2); } + | '-' expr %prec '!' { $$ = fmt("(-%s)", $2); } + | '*' expr %prec '!' { $$ = fmt("(*%s)", $2); } + | '&' expr %prec '!' { $$ = fmt("(&%s)", $2); } | Sizeof expr { $$ = fmt("(sizeof %s)", $2); } | expr '*' expr { $$ = fmt("(%s * %s)", $1, $3); } | expr '/' expr { $$ = fmt("(%s / %s)", $1, $3); } -- cgit 1.4.1