Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    r3be261a rbb8ea30  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Dec 09 14:09:34 2015
     12// Last Modified On : Thu May 12 13:33:18 2016
    1313// Update Count     : 54
    1414//
     
    4343
    4444void ExprStmt::print( std::ostream &os, int indent ) const {
    45         os << string( indent, ' ' ) << "Expression Statement:" << endl;
     45        os << "Expression Statement:" << endl << std::string( indent + 2, ' ' );
    4646        expr->print( os, indent + 2 );
    4747}
     
    110110
    111111void 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        }
    114117        os << endl;
    115118}
     
    124127
    125128void 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, ' ' );
    127131        condition->print( os, indent + 4 );
    128132
    129         os << string( indent, ' ' ) << ".... and branches: " << endl;
    130 
     133        os << string( indent+2, ' ' ) << "... then: " << endl;
     134
     135        os << string( indent+4, ' ' );
    131136        thenPart->print( os, indent + 4 );
    132137
    133138        if ( elsePart != 0 ) {
     139                os << string( indent+2, ' ' ) << "... else: " << endl;
     140                os << string( indent+4, ' ' );
    134141                elsePart->print( os, indent + 4 );
    135142        } // if
     
    153160
    154161void SwitchStmt::print( std::ostream &os, int indent ) const {
    155         os << string( indent, ' ' ) << "Switch on condition: ";
     162        os << "Switch on condition: ";
    156163        condition->print( os );
    157164        os << endl;
     
    218225
    219226void ChooseStmt::print( std::ostream &os, int indent ) const {
    220         os << string( indent, ' ' ) << "Choose on condition: ";
     227        os << "Choose on condition: ";
    221228        condition->print( os );
    222229        os << endl;
     
    247254
    248255void WhileStmt::print( std::ostream &os, int indent ) const {
    249         os << string( indent, ' ' ) << "While on condition: " << endl ;
     256        os << "While on condition: " << endl ;
    250257        condition->print( os, indent + 4 );
    251258
     
    273280
    274281void ForStmt::print( std::ostream &os, int indent ) const {
    275         os << string( indent, ' ' ) << "Labels: {";
     282        os << "Labels: {";
    276283        for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) {
    277284                os << *it << ",";
     
    283290        os << string( indent + 2, ' ' ) << "initialization: \n";
    284291        for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
     292                os << string( indent + 4, ' ' );
    285293                (*it)->print( os, indent + 4 );
    286294        }
    287295
    288296        os << "\n" << string( indent + 2, ' ' ) << "condition: \n";
    289         if ( condition != 0 )
     297        if ( condition != 0 ) {
     298                os << string( indent + 4, ' ' );
    290299                condition->print( os, indent + 4 );
     300        }
    291301
    292302        os << "\n" << string( indent + 2, ' ' ) << "increment: \n";
    293         if ( increment != 0 )
     303        if ( increment != 0 ) {
     304                os << string( indent + 4, ' ' );
    294305                increment->print( os, indent + 4 );
     306        }
    295307
    296308        os << "\n" << string( indent + 2, ' ' ) << "statement block: \n";
    297         if ( body != 0 )
     309        if ( body != 0 ) {
     310                os << string( indent + 4, ' ' );
    298311                body->print( os, indent + 4 );
     312        }
    299313
    300314        os << endl;
     
    314328
    315329void TryStmt::print( std::ostream &os, int indent ) const {
    316         os << string( indent, ' ' ) << "Try Statement" << endl;
     330        os << "Try Statement" << endl;
    317331        os << string( indent + 2, ' ' ) << "with block: " << endl;
    318332        block->print( os, indent + 4 );
     
    378392
    379393void NullStmt::print( std::ostream &os, int indent ) const {
    380         os << string( indent, ' ' ) << "Null Statement" << endl ;
     394        os << "Null Statement" << endl ;
    381395}
    382396
Note: See TracChangeset for help on using the changeset viewer.