scc

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

commit 439fd8a6d2e636acabe21de2b9223d1030adc8b0
parent 696f09d26baafa1b2369c2b20784d5ad2f73dcc7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 15 Aug 2012 20:14:25 +0200

Fixed bug in compound function

Once that parser arrive to the function compound MUST be a '{' and not CAN
be a one. So we have to change accept call to expect call.

Diffstat:
Mflow.c | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/flow.c b/flow.c @@ -122,12 +122,11 @@ stmt(void) void compound(void) { - if (accept('{')) { - new_ctx(); - while (decl()) - /* nothing */; - while (!accept('}')) - stmt(); - del_ctx(); - } + expect('{'); + new_ctx(); + while (decl()) + /* nothing */; + while (!accept('}')) + stmt(); + del_ctx(); }