scc

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

commit 04cb41489c622c8c67321ff6ca713766877e1d17
parent b1ca62655dbb5c3539ba900d5d2b7d2530efb4a8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 24 Apr 2014 09:26:56 +0200

Add continue statement

Diffstat:
Mstmt.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/stmt.c b/stmt.c @@ -134,6 +134,16 @@ Break(Symbol *lbreak) expect(';'); } +static void +Continue(Symbol *lcont) +{ + expect(CONTINUE); + if (!lcont) + error("continue statement not within loop"); + emitjump(lcont, NULL); + expect(';'); +} + void compound(Symbol *lbreak, Symbol *lcont, Symbol *lswitch) { @@ -162,6 +172,7 @@ stmt(Symbol *lbreak, Symbol *lcont, Symbol *lswitch) case FOR: For(lswitch); break; case DO: Dowhile(lswitch); break; case BREAK: Break(lbreak); break; + case CONTINUE: Continue(lcont); break; default: stmtexp(); break; } }