Index: src/Parser/StatementNode.cc
===================================================================
--- src/Parser/StatementNode.cc	(revision ee3c93d9425378dba13f5e7407f9097ac9d1cbb8)
+++ src/Parser/StatementNode.cc	(revision 95487027f53dabc24b643cfc26071635ae66fab5)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 14:59:41 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Apr 30 09:21:16 2018
-// Update Count     : 354
+// Last Modified On : Tue Jun  5 08:58:34 2018
+// Update Count     : 362
 //
 
@@ -69,14 +69,12 @@
 	caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts );
 	return this;
-}
+} // StatementNode::append_last_case
 
 Statement * build_expr( ExpressionNode * ctl ) {
 	Expression * e = maybeMoveBuild< Expression >( ctl );
 
-	if ( e )
-		return new ExprStmt( e );
-	else
-		return new NullStmt();
-}
+	if ( e ) return new ExprStmt( e );
+	else return new NullStmt();
+} // build_expr
 
 Expression * build_if_control( IfCtl * ctl, std::list< Statement * > & init ) {
@@ -100,8 +98,8 @@
 	delete ctl;
 	return cond;
-}
+} // build_if_control
 
 Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) {
-	Statement * thenb, * elseb = 0;
+	Statement * thenb, * elseb = nullptr;
 	std::list< Statement * > branches;
 	buildMoveList< Statement, StatementNode >( then_stmt, branches );
@@ -119,5 +117,5 @@
 	Expression * cond = build_if_control( ctl, init );
 	return new IfStmt( cond, thenb, elseb, init );
-}
+} // build_if
 
 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ) {
@@ -135,15 +133,17 @@
 	// branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
 	return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
-}
+} // build_switch
+
 Statement * build_case( ExpressionNode * ctl ) {
 	std::list< Statement * > branches;
 	return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches );
-}
+} // build_case
+
 Statement * build_default() {
 	std::list< Statement * > branches;
 	return new CaseStmt( nullptr, branches, true );
-}
-
-Statement * build_while( ExpressionNode * ctl, StatementNode * stmt, bool kind ) {
+} // build_default
+
+Statement * build_while( IfCtl * ctl, StatementNode * stmt ) {
 	std::list< Statement * > branches;
 	buildMoveList< Statement, StatementNode >( stmt, branches );
@@ -151,6 +151,16 @@
 
 	std::list< Statement * > init;
-	return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), init, kind );
-}
+	Expression * cond = build_if_control( ctl, init );
+	return new WhileStmt( cond, branches.front(), init, false );
+} // build_while
+
+Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt ) {
+	std::list< Statement * > branches;
+	buildMoveList< Statement, StatementNode >( stmt, branches );
+	assert( branches.size() == 1 );
+
+	std::list< Statement * > init;
+	return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), init, true );
+} // build_do_while
 
 Statement * build_for( ForCtl * forctl, StatementNode * stmt ) {
@@ -174,18 +184,20 @@
 	delete forctl;
 	return new ForStmt( init, cond, incr, branches.front() );
-}
+} // build_for
 
 Statement * build_branch( BranchStmt::Type kind ) {
 	Statement * ret = new BranchStmt( "", kind );
 	return ret;
-}
+} // build_branch
+
 Statement * build_branch( std::string * identifier, BranchStmt::Type kind ) {
 	Statement * ret = new BranchStmt( * identifier, kind );
 	delete identifier; 									// allocated by lexer
 	return ret;
-}
+} // build_branch
+
 Statement * build_computedgoto( ExpressionNode * ctl ) {
 	return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
-}
+} // build_computedgoto
 
 Statement * build_return( ExpressionNode * ctl ) {
@@ -193,5 +205,5 @@
 	buildMoveList( ctl, exps );
 	return new ReturnStmt( exps.size() > 0 ? exps.back() : nullptr );
-}
+} // build_return
 
 Statement * build_throw( ExpressionNode * ctl ) {
@@ -200,5 +212,5 @@
 	assertf( exps.size() < 2, "This means we are leaking memory");
 	return new ThrowStmt( ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
-}
+} // build_throw
 
 Statement * build_resume( ExpressionNode * ctl ) {
@@ -207,5 +219,5 @@
 	assertf( exps.size() < 2, "This means we are leaking memory");
 	return new ThrowStmt( ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
-}
+} // build_resume
 
 Statement * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) {
@@ -213,5 +225,5 @@
 	(void)target;
 	assertf( false, "resume at (non-local throw) is not yet supported," );
-}
+} // build_resume_at
 
 Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ) {
@@ -221,5 +233,6 @@
 	FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
 	return new TryStmt( tryBlock, branches, finallyBlock );
-}
+} // build_try
+
 Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body ) {
 	std::list< Statement * > branches;
@@ -227,5 +240,6 @@
 	assert( branches.size() == 1 );
 	return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
-}
+} // build_catch
+
 Statement * build_finally( StatementNode * stmt ) {
 	std::list< Statement * > branches;
@@ -233,5 +247,5 @@
 	assert( branches.size() == 1 );
 	return new FinallyStmt( dynamic_cast< CompoundStmt * >( branches.front() ) );
-}
+} // build_finally
 
 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) {
@@ -254,5 +268,5 @@
 
 	return node;
-}
+} // build_waitfor
 
 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) {
@@ -273,5 +287,5 @@
 
 	return node;
-}
+} // build_waitfor
 
 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ) {
@@ -282,12 +296,11 @@
 		node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
 		node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
-	}
-	else {
+	} else {
 		node->orelse.statement  = maybeMoveBuild<Statement >( stmt );
 		node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( when ) );
-	}
+	} // if
 
 	return node;
-}
+} // build_waitfor_timeout
 
 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when,  StatementNode * else_stmt, ExpressionNode * else_when ) {
@@ -302,5 +315,5 @@
 
 	return node;
-}
+} // build_waitfor_timeout
 
 WithStmt * build_with( ExpressionNode * exprs, StatementNode * stmt ) {
@@ -309,5 +322,5 @@
 	Statement * s = maybeMoveBuild<Statement>( stmt );
 	return new WithStmt( e, s );
-}
+} // build_with
 
 Statement * build_compound( StatementNode * first ) {
@@ -315,5 +328,5 @@
 	buildMoveList( first, cs->get_kids() );
 	return cs;
-}
+} // build_compound
 
 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
@@ -325,9 +338,9 @@
 	buildMoveList( clobber, clob );
 	return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
-}
+} // build_asm
 
 Statement * build_directive( string * directive ) {
 	return new DirectiveStmt( *directive );
-}
+} // build_directive
 
 // Local Variables: //
