summary refs log tree commit diff
path: root/bin/order.y
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-05-15 23:19:00 -0400
committerJune McEnroe <june@causal.agency>2019-05-15 23:19:00 -0400
commit27fef8b782291fb68b643d67bdc2cc0757290591 (patch)
tree775f7cdf6a2f6ef3a4e5ebbfac904e1cc2d4dfd7 /bin/order.y
parentImplement sizeof in order (diff)
downloadsrc-27fef8b782291fb68b643d67bdc2cc0757290591.tar.gz
src-27fef8b782291fb68b643d67bdc2cc0757290591.zip
Support simple assignment in order
Diffstat (limited to '')
-rw-r--r--bin/order.y4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/order.y b/bin/order.y
index 4327c00a..8700ded4 100644
--- a/bin/order.y
+++ b/bin/order.y
@@ -44,9 +44,10 @@ static int yylex(void);
 
 %}
 
-%token Var Arr Inc Dec Sizeof Shl Shr Le Ge Eq Ne And Or
+%token Var
 
 %left ','
+%right '='
 %right '?' ':'
 %left Or
 %left And
@@ -102,6 +103,7 @@ expr:
 	| expr And expr { $$ = fmt("(%s && %s)", $1, $3); }
 	| expr Or expr { $$ = fmt("(%s || %s)", $1, $3); }
 	| expr '?' expr ':' expr { $$ = fmt("(%s ? %s : %s)", $1, $3, $5); }
+	| expr '=' expr { $$ = fmt("(%s = %s)", $1, $3); }
 	| expr ',' expr { $$ = fmt("(%s, %s)", $1, $3); }
 	;