Changeset 44b5ca0 for src/SynTree
- 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/SynTree
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SynTree/CompoundStmt.cc ¶
rcf0941d r44b5ca0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 08:11:02201513 // Update Count : 112 // Last Modified On : Fri Jun 5 07:46:03 2015 13 // Update Count : 2 14 14 // 15 15 … … 34 34 35 35 void CompoundStmt::print( std::ostream &os, int indent ) { 36 os << "\r" << string(indent, ' ') << "CompoundStmt" << endl ;37 printAll( kids, os, indent +2 );36 os << string( indent, ' ' ) << "CompoundStmt" << endl ; 37 printAll( kids, os, indent + 2 ); 38 38 } 39 39 -
TabularUnified src/SynTree/Expression.cc ¶
rcf0941d r44b5ca0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 4 21:42:55201513 // Update Count : 1 012 // Last Modified On : Fri Jun 5 07:51:09 2015 13 // Update Count : 11 14 14 // 15 15 … … 93 93 94 94 void VariableExpr::print( std::ostream &os, int indent ) const { 95 os << std::string( indent, ' ') << "Variable Expression: ";95 os << std::string( indent, ' ' ) << "Variable Expression: "; 96 96 97 97 Declaration *decl = get_var(); … … 122 122 123 123 void SizeofExpr::print( std::ostream &os, int indent) const { 124 os << std::string( indent, ' ') << "Sizeof Expression on: ";124 os << std::string( indent, ' ' ) << "Sizeof Expression on: "; 125 125 126 126 if (isType) … … 152 152 153 153 void AttrExpr::print( std::ostream &os, int indent) const { 154 os << std::string( indent, ' ') << "Attr ";154 os << std::string( indent, ' ' ) << "Attr "; 155 155 attr->print( os, indent + 2 ); 156 156 if ( isType || expr ) { … … 184 184 185 185 void CastExpr::print( std::ostream &os, int indent ) const { 186 os << std::string( indent, ' ') << "Cast of:" << std::endl;186 os << std::string( indent, ' ' ) << "Cast of:" << std::endl; 187 187 arg->print(os, indent+2); 188 os << std::endl << std::string( indent, ' ') << "to:" << std::endl;188 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 189 189 if ( results.empty() ) { 190 os << std::string( indent+2, ' ') << "nothing" << std::endl;190 os << std::string( indent+2, ' ' ) << "nothing" << std::endl; 191 191 } else { 192 192 printAll(results, os, indent+2); … … 207 207 208 208 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 209 os << std::string( indent, ' ') << "Member Expression, with field: " << get_member();209 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member(); 210 210 211 211 Expression *agg = get_aggregate(); 212 os << std::string( indent, ' ') << "from aggregate: ";212 os << std::string( indent, ' ' ) << "from aggregate: "; 213 213 if (agg != 0) agg->print(os, indent + 2); 214 214 Expression::print( os, indent ); … … 234 234 235 235 void MemberExpr::print( std::ostream &os, int indent ) const { 236 os << std::string( indent, ' ') << "Member Expression, with field: " << std::endl;236 os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl; 237 237 238 238 assert( member ); 239 os << std::string( indent + 2, ' ');239 os << std::string( indent + 2, ' ' ); 240 240 member->print( os, indent + 2 ); 241 241 os << std::endl; 242 242 243 243 Expression *agg = get_aggregate(); 244 os << std::string( indent, ' ') << "from aggregate: " << std::endl;244 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 245 245 if (agg != 0) agg->print(os, indent + 2); 246 246 Expression::print( os, indent ); … … 261 261 262 262 void UntypedExpr::print( std::ostream &os, int indent ) const { 263 os << std::string( indent, ' ') << "Applying untyped: " << std::endl;263 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 264 264 function->print(os, indent + 4); 265 os << "\r" << std::string(indent, ' ') << "...to: " << std::endl;265 os << std::string( indent, ' ' ) << "...to: " << std::endl; 266 266 printArgs(os, indent + 4); 267 267 Expression::print( os, indent ); … … 282 282 283 283 void NameExpr::print( std::ostream &os, int indent ) const { 284 os << std::string( indent, ' ') << "Name: " << get_name() << std::endl;284 os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl; 285 285 Expression::print( os, indent ); 286 286 } … … 301 301 302 302 void LogicalExpr::print( std::ostream &os, int indent )const { 303 os << std::string( indent, ' ') << "Short-circuited operation (" << (isAnd?"and":"or") << ") on: ";303 os << std::string( indent, ' ' ) << "Short-circuited operation (" << (isAnd?"and":"or") << ") on: "; 304 304 arg1->print(os); 305 305 os << " and "; … … 323 323 324 324 void ConditionalExpr::print( std::ostream &os, int indent ) const { 325 os << std::string( indent, ' ') << "Conditional expression on: " << std::endl;325 os << std::string( indent, ' ' ) << "Conditional expression on: " << std::endl; 326 326 arg1->print( os, indent+2 ); 327 os << std::string( indent, ' ') << "First alternative:" << std::endl;327 os << std::string( indent, ' ' ) << "First alternative:" << std::endl; 328 328 arg2->print( os, indent+2 ); 329 os << std::string( indent, ' ') << "Second alternative:" << std::endl;329 os << std::string( indent, ' ' ) << "Second alternative:" << std::endl; 330 330 arg3->print( os, indent+2 ); 331 331 os << std::endl; … … 334 334 335 335 void UntypedValofExpr::print( std::ostream &os, int indent ) const { 336 os << std::string( indent, ' ') << "Valof Expression: " << std::endl;336 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl; 337 337 if ( get_body() != 0 ) 338 338 get_body()->print( os, indent + 2 ); -
TabularUnified src/SynTree/Statement.cc ¶
rcf0941d r44b5ca0 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Jun 02 13:07:09201513 // Update Count : 1 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 5 07:51:04 2015 13 // Update Count : 15 14 14 // 15 15 … … 39 39 40 40 void ExprStmt::print( std::ostream &os, int indent ) { 41 os << "\r" << string(indent, ' ') << "Expression Statement:" << endl;41 os << string( indent, ' ' ) << "Expression Statement:" << endl; 42 42 expr->print( os, indent + 2 ); 43 43 } … … 59 59 60 60 void BranchStmt::print( std::ostream &os, int indent ) { 61 os << "\r" << string( indent, ' ') << "Branch (" << brType[type] << ")" << endl ;61 os << string( indent, ' ' ) << "Branch (" << brType[type] << ")" << endl ; 62 62 } 63 63 … … 69 69 70 70 void ReturnStmt::print( std::ostream &os, int indent ) { 71 os << "\r" << std::string( indent, ' ') << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";71 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 72 72 if ( expr != 0 ) expr->print( os ); 73 73 os << endl; … … 80 80 81 81 void IfStmt::print( std::ostream &os, int indent ) { 82 os << "\r" << string( indent, ' ') << "If on condition: " << endl ;82 os << string( indent, ' ' ) << "If on condition: " << endl ; 83 83 condition->print( os, indent + 4 ); 84 84 85 os << string( indent, ' ' ) << ".... and branches: " << endl;85 os << string( indent, ' ' ) << ".... and branches: " << endl; 86 86 87 87 thenPart->print( os, indent + 4 ); … … 104 104 105 105 void SwitchStmt::print( std::ostream &os, int indent ) { 106 os << "\r" << string( indent, ' ') << "Switch on condition: ";106 os << string( indent, ' ' ) << "Switch on condition: "; 107 107 condition->print( os ); 108 108 os << endl; … … 131 131 132 132 void CaseStmt::print( std::ostream &os, int indent ) { 133 os << "\r" << string( indent, ' ');133 os << string( indent, ' ' ); 134 134 135 135 if ( isDefault()) … … 159 159 160 160 void ChooseStmt::print( std::ostream &os, int indent ) { 161 os << "\r" << string( indent, ' ') << "Choose on condition: ";161 os << string( indent, ' ' ) << "Choose on condition: "; 162 162 condition->print( os ); 163 163 os << endl; … … 172 172 173 173 void FallthruStmt::print( std::ostream &os, int indent ) { 174 os << "\r" << string( indent, ' ') << "Fall-through statement" << endl;174 os << string( indent, ' ' ) << "Fall-through statement" << endl; 175 175 } 176 176 … … 184 184 185 185 void WhileStmt::print( std::ostream &os, int indent ) { 186 os << "\r" << string( indent, ' ') << "While on condition: " << endl ;186 os << string( indent, ' ' ) << "While on condition: " << endl ; 187 187 condition->print( os, indent + 4 ); 188 188 189 os << string( indent, ' ' ) << ".... with body: " << endl;189 os << string( indent, ' ' ) << ".... with body: " << endl; 190 190 191 191 if ( body != 0 ) body->print( os, indent + 4 ); … … 204 204 205 205 void ForStmt::print( std::ostream &os, int indent ) { 206 os << "\r" << string( indent, ' ') << "Labels: {";206 os << string( indent, ' ' ) << "Labels: {"; 207 207 for (std::list<Label>::iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 208 208 os << *it << ","; … … 210 210 os << "}" << endl; 211 211 212 os << "\r" << string( indent, ' ') << "For Statement" << endl ;213 214 os << "\r" << string( indent + 2, ' ') << "initialization: \n";212 os << string( indent, ' ' ) << "For Statement" << endl ; 213 214 os << string( indent + 2, ' ' ) << "initialization: \n"; 215 215 if ( initialization != 0 ) 216 216 initialization->print( os, indent + 4 ); 217 217 218 os << "\n \r" << string( indent + 2, ' ') << "condition: \n";218 os << "\n" << string( indent + 2, ' ' ) << "condition: \n"; 219 219 if ( condition != 0 ) 220 220 condition->print( os, indent + 4 ); 221 221 222 os << "\n \r" << string( indent + 2, ' ') << "increment: \n";222 os << "\n" << string( indent + 2, ' ' ) << "increment: \n"; 223 223 if ( increment != 0 ) 224 224 increment->print( os, indent + 4 ); 225 225 226 os << "\n \r" << string( indent + 2, ' ') << "statement block: \n";226 os << "\n" << string( indent + 2, ' ' ) << "statement block: \n"; 227 227 if ( body != 0 ) 228 228 body->print( os, indent + 4 ); … … 246 246 247 247 void TryStmt::print( std::ostream &os, int indent ) { 248 os << "\r" << string( indent, ' ') << "Try Statement" << endl;249 os << string( indent + 2, ' ' ) << "with block: " << endl;248 os << string( indent, ' ' ) << "Try Statement" << endl; 249 os << string( indent + 2, ' ' ) << "with block: " << endl; 250 250 block->print( os, indent + 4 ); 251 251 252 252 // handlers 253 os << string( indent + 2, ' ' ) << "and handlers: " << endl;253 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 254 254 std::list<Statement *>::iterator i; 255 255 for ( i = handlers.begin(); i != handlers.end(); i++) … … 258 258 // finally block 259 259 if ( finallyBlock != 0 ) { 260 os << string( indent + 2, ' ' ) << "Finally block: " << endl;260 os << string( indent + 2, ' ' ) << "Finally block: " << endl; 261 261 finallyBlock->print( os, indent + 4 ); 262 262 } // if … … 273 273 274 274 void CatchStmt::print( std::ostream &os, int indent ) { 275 os << "\r" << string( indent, ' ') << "Catch Statement" << endl;276 277 os << "\r" << string( indent, ' ') << "... catching" << endl;275 os << string( indent, ' ' ) << "Catch Statement" << endl; 276 277 os << string( indent, ' ' ) << "... catching" << endl; 278 278 if ( decl ) { 279 279 decl->printShort( os, indent + 4 ); 280 280 os << endl; 281 281 } else if ( catchRest ) 282 os << "\r" << string( indent + 4 , ' ') << "the rest" << endl;282 os << string( indent + 4 , ' ' ) << "the rest" << endl; 283 283 else 284 os << "\r" << string( indent + 4 , ' ') << ">>> Error: this catch clause must have a declaration <<<" << endl;284 os << string( indent + 4 , ' ' ) << ">>> Error: this catch clause must have a declaration <<<" << endl; 285 285 } 286 286 … … 295 295 296 296 void FinallyStmt::print( std::ostream &os, int indent ) { 297 os << "\r" << string( indent, ' ') << "Finally Statement" << endl;298 os << string( indent + 2, ' ' ) << "with block: " << endl;297 os << string( indent, ' ' ) << "Finally Statement" << endl; 298 os << string( indent + 2, ' ' ) << "with block: " << endl; 299 299 block->print( os, indent + 4 ); 300 300 } … … 305 305 306 306 void NullStmt::print( std::ostream &os, int indent ) { 307 os << "\r" << string( indent, ' ') << "Null Statement" << endl ;307 os << string( indent, ' ' ) << "Null Statement" << endl ; 308 308 } 309 309
Note: See TracChangeset
for help on using the changeset viewer.