scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 3939d91c2494e9de10f4f7e8a692544416c5f021
parent 71c6d0ec20a1644b4cf34d52691993d271417660
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  8 Sep 2015 22:36:19 +0200

Fix grammar of aggregate initializers

After last commits, the grammar was incorrect because
there was no loop until no accept(,').

Diffstat:
Mcc1/decl.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -363,11 +363,15 @@ return_type: static void initializer(Symbol *sym) { - Type *tp = sym->type; Node *np; if (accept('{')) { - initializer(sym); + do { + if (yytoken == '}') + break; + initializer(sym); + } while (accept(','); + expect('}'); return; } @@ -376,7 +380,6 @@ initializer(Symbol *sym) emit(OEXPR, assignop(OINIT, varnode(sym), np)); return; } - return; } static Symbol *