ref: b1ca62655dbb5c3539ba900d5d2b7d2530efb4a8
parent: cf8e9e411ee41b2bdf227922c88038785319fc0c
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Apr 24 05:22:10 EDT 2014
Add break statement
--- a/stmt.c
+++ b/stmt.c
@@ -124,6 +124,16 @@
emitexp(np);
}
+static void
+Break(Symbol *lbreak)
+{
+ expect(BREAK);
+ if (!lbreak)
+ error("break statement not within loop or switch");
+ emitjump(lbreak, NULL);
+ expect(';');
+}
+
void
compound(Symbol *lbreak, Symbol *lcont, Symbol *lswitch)
{
@@ -151,6 +161,7 @@
case WHILE: While(lswitch); break;
case FOR: For(lswitch); break;
case DO: Dowhile(lswitch); break;
+ case BREAK: Break(lbreak); break;
default: stmtexp(); break;
}
}