summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2018-07-17 08:57:58 +0000
committerOri Bernstein <ori@eigenstate.org>2018-07-19 21:29:35 -0700
commitf4a43f90e3ffe1712aec13566e8ac545da4161c4 (patch)
tree57a3edcd99ff2cae6ab74b6435af32d3182174ba /parse/gram.y
parent8a3e8add6e0180565312d1079395ad39de4d9ce3 (diff)
downloadmc-f4a43f90e3ffe1712aec13566e8ac545da4161c4.tar.gz
Support direct tuple access operators "tuple.N"
This patch adds tuple access expressions. If t is a tuple, its N-th component can be retrieved with the syntax t.N. Of course, the components are zero indexed. I believe the code also works if 't' is a pointer to a tuple (but I have not checked this).
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y2
1 files changed, 2 insertions, 0 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 7d95300..5836b0c 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -786,6 +786,8 @@ prefixexpr
postfixexpr
: postfixexpr Tdot Tident
{$$ = mkexpr($1->loc, Omemb, $1, mkname($3->loc, $3->id), NULL);}
+ | postfixexpr Tdot Tintlit
+ {$$ = mkexpr($1->loc, Otupmemb, $1, mkint($3->loc, $3->intval), NULL);}
| postfixexpr Tinc
{$$ = mkexpr($1->loc, Opostinc, $1, NULL);}
| postfixexpr Tdec