commit b3e3524087ab46e9a93a197e839e132af399e32b
parent d4d8cae71b3c941b8fba7da8ee31ebccbfdd8457
Author: m21c <ho*******@gmail.com>
Date: Fri, 17 Sep 2021 00:21:34 +0200
worked on compund-literal (poc parsing)
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -2469,6 +2469,18 @@ readatom(Source *source, int flags) {
gettok(source);
}
+ /* compound-literal */
+ if (getkind(source) == '{' && lhs->kind == 'T') {
+ lhs = makenode(&source->tok, lhs);
+ lhs->kind = 'A';
+ lhs->type = lhs->lhs->type;
+ gettok(source);
+
+ lhs->rhs = exprlist(source, false, NULL);
+
+ expect(source, '}', "expected '}'");
+ }
+
/* unary postfix operators */
while (getunarysuffix(source)) {
lhs = makenode(&source->tok, lhs);