ref: 2b7e1beeced12f7553789848e55c97f857811bb7
parent: 153c82b0106fbc8fbe6e4852d0e9aa4e24332f50
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Apr 24 08:18:56 EDT 2014
Add goto statement
--- a/stmt.c
+++ b/stmt.c
@@ -153,6 +153,18 @@
expect(';');
}
+static void
+Goto(void)
+{
+ expect(GOTO);
+
+ if (yytoken != IDEN)
+ error("unexpected '%s'", yytext);
+ emitjump(label(yytext), NULL);
+ next();
+ expect(';');
+}
+
void
compound(Symbol *lbreak, Symbol *lcont, Symbol *lswitch)
{
@@ -184,6 +196,7 @@
case DO: Dowhile(lswitch); break;
case BREAK: Break(lbreak); break;
case CONTINUE: Continue(lcont); break;
+ case GOTO: Goto(); break;
case IDEN: if (ahead() == ':') Label(); goto repeat;
default: stmtexp(); break;
}