Changes in src/SynTree/Statement.cc [de62360d:44b5ca0]
- File:
-
- 1 edited
-
src/SynTree/Statement.cc (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
rde62360d r44b5ca0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jun 23 11:42:09201513 // Update Count : 2112 // Last Modified On : Fri Jun 5 07:51:04 2015 13 // Update Count : 15 14 14 // 15 15 … … 30 30 Statement::Statement( std::list<Label> _labels ) : labels(_labels ) {} 31 31 32 void Statement::print( std::ostream &, int indent ) const{}32 void Statement::print( std::ostream &, int indent ) {} 33 33 34 34 Statement::~Statement() {} … … 38 38 ExprStmt::~ExprStmt() {} 39 39 40 void ExprStmt::print( std::ostream &os, int indent ) const{40 void ExprStmt::print( std::ostream &os, int indent ) { 41 41 os << string( indent, ' ' ) << "Expression Statement:" << endl; 42 42 expr->print( os, indent + 2 ); … … 58 58 } 59 59 60 void BranchStmt::print( std::ostream &os, int indent ) const{60 void BranchStmt::print( std::ostream &os, int indent ) { 61 61 os << string( indent, ' ' ) << "Branch (" << brType[type] << ")" << endl ; 62 62 } … … 68 68 } 69 69 70 void ReturnStmt::print( std::ostream &os, int indent ) const{70 void ReturnStmt::print( std::ostream &os, int indent ) { 71 71 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 72 72 if ( expr != 0 ) expr->print( os ); … … 79 79 IfStmt::~IfStmt() {} 80 80 81 void IfStmt::print( std::ostream &os, int indent ) const{81 void IfStmt::print( std::ostream &os, int indent ) { 82 82 os << string( indent, ' ' ) << "If on condition: " << endl ; 83 83 condition->print( os, indent + 4 ); … … 103 103 void SwitchStmt::add_case( CaseStmt *c ) {} 104 104 105 void SwitchStmt::print( std::ostream &os, int indent ) const{105 void SwitchStmt::print( std::ostream &os, int indent ) { 106 106 os << string( indent, ' ' ) << "Switch on condition: "; 107 107 condition->print( os ); … … 109 109 110 110 // branches 111 std::list<Statement *>:: const_iterator i;111 std::list<Statement *>::iterator i; 112 112 for ( i = branches.begin(); i != branches.end(); i++) 113 (*i )->print( os, indent + 4 );113 (*i )->print( os, indent + 4 ); 114 114 115 115 //for_each( branches.begin(), branches.end(), mem_fun( bind1st(&Statement::print ), os )); … … 130 130 } 131 131 132 void CaseStmt::print( std::ostream &os, int indent ) const{132 void CaseStmt::print( std::ostream &os, int indent ) { 133 133 os << string( indent, ' ' ); 134 134 135 if ( isDefault() )135 if ( isDefault()) 136 136 os << "Default "; 137 137 else { … … 142 142 os << endl; 143 143 144 std::list<Statement *>:: const_iterator i;144 std::list<Statement *>::iterator i; 145 145 for ( i = stmts.begin(); i != stmts.end(); i++) 146 146 (*i )->print( os, indent + 4 ); … … 158 158 void ChooseStmt::add_case( CaseStmt *c ) {} 159 159 160 void ChooseStmt::print( std::ostream &os, int indent ) const{160 void ChooseStmt::print( std::ostream &os, int indent ) { 161 161 os << string( indent, ' ' ) << "Choose on condition: "; 162 162 condition->print( os ); … … 164 164 165 165 // branches 166 std::list<Statement *>:: const_iterator i;166 std::list<Statement *>::iterator i; 167 167 for ( i = branches.begin(); i != branches.end(); i++) 168 168 (*i )->print( os, indent + 4 ); … … 171 171 } 172 172 173 void FallthruStmt::print( std::ostream &os, int indent ) const{173 void FallthruStmt::print( std::ostream &os, int indent ) { 174 174 os << string( indent, ' ' ) << "Fall-through statement" << endl; 175 175 } … … 183 183 } 184 184 185 void WhileStmt::print( std::ostream &os, int indent ) const{185 void WhileStmt::print( std::ostream &os, int indent ) { 186 186 os << string( indent, ' ' ) << "While on condition: " << endl ; 187 187 condition->print( os, indent + 4 ); … … 203 203 } 204 204 205 void ForStmt::print( std::ostream &os, int indent ) const{205 void ForStmt::print( std::ostream &os, int indent ) { 206 206 os << string( indent, ' ' ) << "Labels: {"; 207 for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) {207 for (std::list<Label>::iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 208 208 os << *it << ","; 209 209 } … … 245 245 } 246 246 247 void TryStmt::print( std::ostream &os, int indent ) const{247 void TryStmt::print( std::ostream &os, int indent ) { 248 248 os << string( indent, ' ' ) << "Try Statement" << endl; 249 249 os << string( indent + 2, ' ' ) << "with block: " << endl; … … 252 252 // handlers 253 253 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 254 for ( std::list<Statement *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) 254 std::list<Statement *>::iterator i; 255 for ( i = handlers.begin(); i != handlers.end(); i++) 255 256 (*i )->print( os, indent + 4 ); 256 257 … … 271 272 } 272 273 273 void CatchStmt::print( std::ostream &os, int indent ) const{274 void CatchStmt::print( std::ostream &os, int indent ) { 274 275 os << string( indent, ' ' ) << "Catch Statement" << endl; 275 276 … … 293 294 } 294 295 295 void FinallyStmt::print( std::ostream &os, int indent ) const{296 void FinallyStmt::print( std::ostream &os, int indent ) { 296 297 os << string( indent, ' ' ) << "Finally Statement" << endl; 297 298 os << string( indent + 2, ' ' ) << "with block: " << endl; … … 303 304 NullStmt::~NullStmt() {} 304 305 305 void NullStmt::print( std::ostream &os, int indent ) const{306 void NullStmt::print( std::ostream &os, int indent ) { 306 307 os << string( indent, ' ' ) << "Null Statement" << endl ; 307 308 }
Note:
See TracChangeset
for help on using the changeset viewer.