Changeset 44b5ca0 for src/Parser
- Timestamp:
- Jun 5, 2015, 8:12:32 AM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- a65d92e
- Parents:
- cf0941d
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Parser/ExpressionNode.cc ¶
rcf0941d r44b5ca0 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 4 21:40:22201513 // Update Count : 912 // Last Modified On : Fri Jun 5 07:44:47 2015 13 // Update Count : 10 14 14 // 15 15 … … 250 250 void VarRefNode::print( std::ostream &os, int indent ) const { 251 251 printDesignation( os ); 252 os << '\r' << string( indent, ' ') << "Referencing: ";252 os << string( indent, ' ' ) << "Referencing: "; 253 253 os << "Variable: " << get_name(); 254 254 os << endl; … … 273 273 void OperatorNode::print( std::ostream &os, int indent ) const{ 274 274 printDesignation( os ); 275 os << '\r' << string( indent, ' ') << "Operator: " << OpName[type] << endl;275 os << string( indent, ' ' ) << "Operator: " << OpName[type] << endl; 276 276 return; 277 277 } … … 550 550 void CompositeExprNode::print( std::ostream &os, int indent ) const { 551 551 printDesignation( os ); 552 os << '\r' << string( indent, ' ') << "Application of: " << endl;552 os << string( indent, ' ' ) << "Application of: " << endl; 553 553 function->print( os, indent + ParseNode::indent_by ); 554 554 555 os << '\r' << string( indent, ' ') ;555 os << string( indent, ' ' ) ; 556 556 if ( arguments ) { 557 557 os << "... on arguments: " << endl; -
TabularUnified src/Parser/StatementNode.cc ¶
rcf0941d r44b5ca0 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 3 11:55:01201513 // Update Count : 812 // Last Modified On : Fri Jun 5 07:43:40 2015 13 // Update Count : 10 14 14 // 15 15 … … 49 49 next->set_next( new StatementNode( dynamic_cast< DeclarationNode* >( decl->get_link() ) ) ); 50 50 decl->set_next( 0 ); 51 } 51 } // if 52 52 } else { 53 53 if ( decl->get_link() ) { 54 54 next = new StatementNode( dynamic_cast< DeclarationNode* >( decl->get_link() ) ); 55 55 decl->set_next( 0 ); 56 } 56 } // if 57 57 this->decl = decl; 58 } 59 } 58 } // if 59 } // if 60 60 } 61 61 … … 98 98 } else { 99 99 newnode->target = 0; 100 } 100 } // if 101 101 newnode->decl = maybeClone( decl ); 102 102 return newnode; … … 132 132 labels->push_front(*l ); 133 133 delete l; 134 } 134 } // if 135 135 return this; 136 136 } … … 151 151 else 152 152 block->set_link( stmt ); 153 } 153 } // if 154 154 return this; 155 155 } … … 165 165 else 166 166 block->set_link( stmt ); 167 } 167 } // if 168 168 return this; 169 169 } 170 170 171 171 void StatementNode::print( std::ostream &os, int indent ) const { 172 if ( labels != 0 ) 172 if ( labels != 0 ) { 173 173 if ( ! labels->empty()) { 174 174 std::list<std::string>::const_iterator i; 175 175 176 os << '\r' << string( indent, ' ');176 os << string( indent, ' ' ); 177 177 for ( i = labels->begin(); i != labels->end(); i++ ) 178 178 os << *i << ":"; 179 179 os << endl; 180 } 180 } // if 181 } // if 181 182 182 183 switch ( type ) { … … 193 194 break; 194 195 default: 195 os << '\r' << string( indent, ' ') << StatementNode::StType[type] << endl;196 os << string( indent, ' ' ) << StatementNode::StType[type] << endl; 196 197 if ( type == Catch ) { 197 198 if ( decl ) { 198 os << '\r' <<string( indent + ParseNode::indent_by, ' ' ) << "Declaration: " << endl;199 os << string( indent + ParseNode::indent_by, ' ' ) << "Declaration: " << endl; 199 200 decl->print( os, indent + 2*ParseNode::indent_by ); 200 201 } else if ( isCatchRest ) { 201 os << '\r' <<string( indent + ParseNode::indent_by, ' ' ) << "Catches the rest " << endl;202 os << string( indent + ParseNode::indent_by, ' ' ) << "Catches the rest " << endl; 202 203 } else { 203 204 ; // should never reach here 204 } 205 } 205 } // if 206 } // if 206 207 if ( control ) { 207 os << '\r' <<string( indent + ParseNode::indent_by, ' ' ) << "Expression: " << endl;208 os << string( indent + ParseNode::indent_by, ' ' ) << "Expression: " << endl; 208 209 control->printList( os, indent + 2*ParseNode::indent_by ); 209 } 210 } // if 210 211 if ( block ) { 211 os << '\r' <<string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl;212 os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl; 212 213 block->printList( os, indent + 2*ParseNode::indent_by ); 213 } 214 } // if 214 215 if ( target ) { 215 os << '\r' <<string( indent + ParseNode::indent_by, ' ' ) << "Target: " << get_target() << endl;216 } 216 os << string( indent + ParseNode::indent_by, ' ' ) << "Target: " << get_target() << endl; 217 } // if 217 218 break; 218 } 219 } // switch 219 220 } 220 221 … … 227 228 std::back_insert_iterator< std::list<Label> > lab_it( labs ); 228 229 copy( labels->begin(), labels->end(), lab_it ); 229 } 230 } // if 230 231 231 232 // try { … … 254 255 elseb = branches.front(); 255 256 branches.pop_front(); 256 } 257 } // if 257 258 return new IfStmt( labs, notZeroExpr( get_control()->build() ), thenb, elseb ); 258 259 } … … 299 300 assert( get_control() != 0 ); 300 301 return new BranchStmt( labs, get_control()->build(), BranchStmt::Goto ); 301 } 302 } // if 302 303 303 304 return new BranchStmt( labs, get_target(), BranchStmt::Goto ); … … 322 323 if ( ( finallyBlock = dynamic_cast<FinallyStmt *>( branches.back())) ) { 323 324 branches.pop_back(); 324 } 325 } // if 325 326 return new TryStmt( labs, tryBlock, branches, finallyBlock ); 326 327 } … … 342 343 // shouldn't be here 343 344 return 0; 344 } 345 } // switch 345 346 } 346 347 … … 356 357 } else { 357 358 last = 0; 358 } 359 } // if 359 360 } 360 361 … … 367 368 last->set_link( stmt ); 368 369 last = ( StatementNode *)( stmt->get_link()); 369 } 370 } // if 370 371 } 371 372 … … 373 374 if ( first ) { 374 375 first->printList( os, indent+2 ); 375 } 376 } // if 376 377 } 377 378 … … 383 384 std::back_insert_iterator< std::list<Label> > lab_it( labs ); 384 385 copy( labels->begin(), labels->end(), lab_it ); 385 } 386 } // if 386 387 387 388 CompoundStmt *cs = new CompoundStmt( labs ); … … 391 392 392 393 void NullStmtNode::print( ostream &os, int indent ) const { 393 os << "\r" << string( indent, ' ') << "Null Statement:" << endl;394 os << string( indent, ' ' ) << "Null Statement:" << endl; 394 395 } 395 396
Note: See TracChangeset
for help on using the changeset viewer.