summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-02-04 23:00:27 -0800
committerOri Bernstein <ori@eigenstate.org>2017-02-04 23:00:27 -0800
commit545d75324d8ad1d9f8f9977b0911e8e9e0704674 (patch)
tree9be767627108edab0ce0833e5b5a308eaafc8ab0 /parse/gram.y
parentd6bd40e37b085aec922c6bb56e867e85a6c36982 (diff)
downloadmc-545d75324d8ad1d9f8f9977b0911e8e9e0704674.tar.gz
Ucons are now prefix expressions.
It's just what it looks like. This cleans up taking the address of union literals.
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y16
1 files changed, 6 insertions, 10 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 10f2843..67edb24 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -140,7 +140,7 @@ static void setupinit(Node *n);
%type<node> exprln retexpr goto continue break expr atomicexpr
%type<node> littok literal lorexpr landexpr borexpr strlit bandexpr
-%type<node> cmpexpr unionexpr addexpr mulexpr shiftexpr prefixexpr
+%type<node> cmpexpr addexpr mulexpr shiftexpr prefixexpr
%type<node> postfixexpr funclit seqlit tuplit name block stmt label
%type<node> use fnparam declbody declcore typedeclcore structent
%type<node> arrayelt structelt tuphead ifstmt forstmt whilestmt
@@ -384,7 +384,7 @@ implbody
}
;
-traitdef: Ttrait Tident generictype optauxtypes Tendln { /* trait prototype */
+traitdef: Ttrait Tident generictype optauxtypes { /* trait prototype */
$$ = mktrait($1->loc,
mkname($2->loc, $2->id), $3,
$4.types, $4.ntypes,
@@ -639,19 +639,13 @@ landexpr: landexpr Tland cmpexpr
| cmpexpr
;
-cmpexpr : cmpexpr cmpop unionexpr
+cmpexpr : cmpexpr cmpop borexpr
{$$ = mkexpr($1->loc, binop($2->type), $1, $3, NULL);}
- | unionexpr
+ | borexpr
;
cmpop : Teq | Tgt | Tlt | Tge | Tle | Tne ;
-unionexpr
- : Ttick name unionexpr {$$ = mkexpr($1->loc, Oucon, $2, $3, NULL);}
- | Ttick name {$$ = mkexpr($1->loc, Oucon, $2, NULL);}
- | borexpr
- ;
-
borexpr : borexpr Tbor bandexpr
{$$ = mkexpr($1->loc, binop($2->type), $1, $3, NULL);}
@@ -696,6 +690,8 @@ prefixexpr
| Tbnot prefixexpr {$$ = mkexpr($1->loc, Obnot, $2, NULL);}
| Tminus prefixexpr {$$ = mkexpr($1->loc, Oneg, $2, NULL);}
| Tplus prefixexpr {$$ = $2;} /* positive is a nop */
+ | Ttick name prefixexpr {$$ = mkexpr($1->loc, Oucon, $2, $3, NULL);}
+ | Ttick name {$$ = mkexpr($1->loc, Oucon, $2, NULL);}
| postfixexpr
;