shithub: scc

Download patch

ref: 04cb41489c622c8c67321ff6ca713766877e1d17
parent: b1ca62655dbb5c3539ba900d5d2b7d2530efb4a8
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Apr 24 05:26:56 EDT 2014

Add continue statement

--- a/stmt.c
+++ b/stmt.c
@@ -134,6 +134,16 @@
 	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 @@
 	case FOR: For(lswitch); break;
 	case DO: Dowhile(lswitch); break;
 	case BREAK: Break(lbreak); break;
+	case CONTINUE: Continue(lcont); break;
 	default: stmtexp(); break;
 	}
 }