Changes in src/SynTree/Statement.cc [3be261a:bb8ea30]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
r3be261a rbb8ea30 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Dec 09 14:09:34 201512 // Last Modified On : Thu May 12 13:33:18 2016 13 13 // Update Count : 54 14 14 // … … 43 43 44 44 void ExprStmt::print( std::ostream &os, int indent ) const { 45 os << string( indent, ' ' ) << "Expression Statement:" << endl;45 os << "Expression Statement:" << endl << std::string( indent + 2, ' ' ); 46 46 expr->print( os, indent + 2 ); 47 47 } … … 110 110 111 111 void ReturnStmt::print( std::ostream &os, int indent ) const { 112 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 if ( expr != 0 ) expr->print( os ); 112 os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 if ( expr != 0 ) { 114 os << endl << string( indent+2, ' ' ); 115 expr->print( os, indent + 2 ); 116 } 114 117 os << endl; 115 118 } … … 124 127 125 128 void IfStmt::print( std::ostream &os, int indent ) const { 126 os << string( indent, ' ' ) << "If on condition: " << endl ; 129 os << "If on condition: " << endl ; 130 os << string( indent+4, ' ' ); 127 131 condition->print( os, indent + 4 ); 128 132 129 os << string( indent, ' ' ) << ".... and branches: " << endl; 130 133 os << string( indent+2, ' ' ) << "... then: " << endl; 134 135 os << string( indent+4, ' ' ); 131 136 thenPart->print( os, indent + 4 ); 132 137 133 138 if ( elsePart != 0 ) { 139 os << string( indent+2, ' ' ) << "... else: " << endl; 140 os << string( indent+4, ' ' ); 134 141 elsePart->print( os, indent + 4 ); 135 142 } // if … … 153 160 154 161 void SwitchStmt::print( std::ostream &os, int indent ) const { 155 os << string( indent, ' ' ) <<"Switch on condition: ";162 os << "Switch on condition: "; 156 163 condition->print( os ); 157 164 os << endl; … … 218 225 219 226 void ChooseStmt::print( std::ostream &os, int indent ) const { 220 os << string( indent, ' ' ) <<"Choose on condition: ";227 os << "Choose on condition: "; 221 228 condition->print( os ); 222 229 os << endl; … … 247 254 248 255 void WhileStmt::print( std::ostream &os, int indent ) const { 249 os << string( indent, ' ' ) <<"While on condition: " << endl ;256 os << "While on condition: " << endl ; 250 257 condition->print( os, indent + 4 ); 251 258 … … 273 280 274 281 void ForStmt::print( std::ostream &os, int indent ) const { 275 os << string( indent, ' ' ) <<"Labels: {";282 os << "Labels: {"; 276 283 for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 277 284 os << *it << ","; … … 283 290 os << string( indent + 2, ' ' ) << "initialization: \n"; 284 291 for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) { 292 os << string( indent + 4, ' ' ); 285 293 (*it)->print( os, indent + 4 ); 286 294 } 287 295 288 296 os << "\n" << string( indent + 2, ' ' ) << "condition: \n"; 289 if ( condition != 0 ) 297 if ( condition != 0 ) { 298 os << string( indent + 4, ' ' ); 290 299 condition->print( os, indent + 4 ); 300 } 291 301 292 302 os << "\n" << string( indent + 2, ' ' ) << "increment: \n"; 293 if ( increment != 0 ) 303 if ( increment != 0 ) { 304 os << string( indent + 4, ' ' ); 294 305 increment->print( os, indent + 4 ); 306 } 295 307 296 308 os << "\n" << string( indent + 2, ' ' ) << "statement block: \n"; 297 if ( body != 0 ) 309 if ( body != 0 ) { 310 os << string( indent + 4, ' ' ); 298 311 body->print( os, indent + 4 ); 312 } 299 313 300 314 os << endl; … … 314 328 315 329 void TryStmt::print( std::ostream &os, int indent ) const { 316 os << string( indent, ' ' ) <<"Try Statement" << endl;330 os << "Try Statement" << endl; 317 331 os << string( indent + 2, ' ' ) << "with block: " << endl; 318 332 block->print( os, indent + 4 ); … … 378 392 379 393 void NullStmt::print( std::ostream &os, int indent ) const { 380 os << string( indent, ' ' ) <<"Null Statement" << endl ;394 os << "Null Statement" << endl ; 381 395 } 382 396
Note: See TracChangeset
for help on using the changeset viewer.