Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision eb3261fd6cc2439133a09df37e3122c389e05622)
+++ src/CodeGen/CodeGenerator.cc	(revision ea9b9d33c90ef6c70aca29326f7d0a19eaf37b6c)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Thu Jun 04 15:00:00 2015
-// Update Count     : 125
+// Last Modified On : Thu Jun 11 13:22:39 2015
+// Update Count     : 137
 //
 
@@ -43,13 +43,21 @@
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream &os ) : cur_indent( 0 ), insideFunction( false ), output( os ) { }
-
-	CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indent, bool infunp )
-			: cur_indent( indent ), insideFunction( infunp ), output( os ) {
+	ostream & CodeGenerator::Indenter::operator()( ostream & output ) {
+	  return output << string( cg.cur_indent, ' ' );
+	}
+
+	ostream & operator<<( ostream & output, CodeGenerator::Indenter &indent ) {
+		return indent( output );
+	}
+
+	CodeGenerator::CodeGenerator( std::ostream &os ) : indent(*this), cur_indent( 0 ), insideFunction( false ), output( os ) { }
+
+	CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indentation, bool infunp )
+			: indent(*this), cur_indent( indentation ), insideFunction( infunp ), output( os ) {
 		//output << std::string( init );
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indent, bool infunp )
-			: cur_indent( indent ), insideFunction( infunp ), output( os ) {
+	CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indentation, bool infunp )
+			: indent(*this), cur_indent( indentation ), insideFunction( infunp ), output( os ) {
 		//output << std::string( init );
 	}
@@ -62,5 +70,5 @@
 		} // if
 	}
-  
+ 
 	//*** Declarations
 	void CodeGenerator::visit( FunctionDecl *functionDecl ) {
@@ -104,9 +112,9 @@
 
 		if ( ! memb.empty() ) {
-			output << endl << string( cur_indent, ' ' ) << "{" << endl;
+			output << endl << indent << "{" << endl;
 
 			cur_indent += CodeGenerator::tabsize; 
 			for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
-				output << string( cur_indent, ' ' ); 
+				output << indent; 
 				(*i)->accept(*this );
 				output << ";" << endl;
@@ -115,5 +123,5 @@
 			cur_indent -= CodeGenerator::tabsize; 
 
-			output << string( cur_indent, ' ' ) << "}";
+			output << indent << "}";
 		} // if
 	}
@@ -138,5 +146,5 @@
 
 		if ( ! memb.empty() ) {
-			output << endl << "{" << endl;
+			output << " {" << endl;
 
 			cur_indent += CodeGenerator::tabsize; 
@@ -144,5 +152,5 @@
 				ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i );
 				assert( obj );
-				output << string( cur_indent, ' ' ) << mangleName( obj ); 
+				output << indent << mangleName( obj ); 
 				if ( obj->get_init() ) {
 					output << " = ";
@@ -154,5 +162,5 @@
 			cur_indent -= CodeGenerator::tabsize; 
 
-			output << "}" << endl;
+			output << indent << "}";
 		} // if
 	}
@@ -444,5 +452,5 @@
 
 		for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++) {
-			output << string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() );
+			output << indent << printLabels( (*i)->get_labels() );
 			(*i)->accept(*this );
 
@@ -454,5 +462,5 @@
 		cur_indent -= CodeGenerator::tabsize; 
 
-		output << string( cur_indent, ' ' ) << "}";
+		output << indent << "}";
 	}
 
@@ -494,9 +502,9 @@
 		cur_indent -= CodeGenerator::tabsize;
 
-		output << string( cur_indent, ' ' ) << "}";
+		output << indent << "}";
 	}
 
 	void CodeGenerator::visit( CaseStmt *caseStmt ) {
-		output << string( cur_indent, ' ' );
+		output << indent;
 		if ( caseStmt->isDefault()) {
 			output << "default";
@@ -511,5 +519,5 @@
 		cur_indent += CodeGenerator::tabsize;
 		for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
-			output << string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() )  ;
+			output << indent << printLabels( (*i)->get_labels() )  ;
 			(*i)->accept(*this );
 			output << endl;
@@ -564,5 +572,5 @@
 		whileStmt->get_body()->accept( *this );
 
-		output << string( cur_indent, ' ' );
+		output << indent;
 
 		if ( whileStmt->get_isDoWhile() ) {
@@ -596,5 +604,5 @@
 
 	void CodeGenerator::visit( NullStmt *nullStmt ) {
-		//output << string( cur_indent, ' ' ) << CodeGenerator::printLabels( nullStmt->get_labels() );
+		//output << indent << CodeGenerator::printLabels( nullStmt->get_labels() );
 		output << "/* null statement */ ;";
 	}
