ref: d7a8adfd00c4d92615387463382ba1e000c3b61c
parent: 824cc5f2899438f5865d942e855f907e26a5106c
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Apr 24 13:57:59 EDT 2014
Add default statement
--- a/stmt.c
+++ b/stmt.c
@@ -249,6 +249,17 @@
++lswitch->nr;
}
+static void
+Default(Symbol *lbreak, Symbol *lcont, Caselist *lswitch)
+{
+ Symbol *ldefault = label(NULL, 1);
+
+ expect(DEFAULT);
+ expect(':');
+ emitlabel(ldefault);
+ lswitch->deflabel = ldefault;
+}
+
void
compound(Symbol *lbreak, Symbol *lcont, Caselist *lswitch)
{
@@ -283,6 +294,7 @@
case GOTO: Goto(); break;
case SWITCH: Switch(lcont); break;
case CASE: Case(lbreak, lcont, lswitch); break;
+ case DEFAULT: Default(lbreak, lcont, lswitch); break;
case IDEN:
if (ahead() == ':') {
Label();