Changes in src/SynTree/Expression.cc [843054c2:5f2f2d7]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r843054c2 r5f2f2d7 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:27:07201513 // Update Count : 212 // Last Modified On : Sun Jun 7 08:40:46 2015 13 // Update Count : 16 14 14 // 15 15 … … 50 50 } 51 51 52 void Expression::print( std::ostream &os, int indent) const {52 void Expression::print( std::ostream &os, int indent ) const { 53 53 if ( env ) { 54 os << std::string( indent, ' ') << "with environment:" << std::endl;54 os << std::string( indent, ' ' ) << "with environment:" << std::endl; 55 55 env->print( os, indent+2 ); 56 56 } // if 57 57 58 58 if ( argName ) { 59 os << std::string( indent, ' ') << "with designator:";59 os << std::string( indent, ' ' ) << "with designator:"; 60 60 argName->print( os, indent+2 ); 61 61 } // if … … 72 72 73 73 void ConstantExpr::print( std::ostream &os, int indent ) const { 74 os << std::string(indent, ' ') << "Constant Expression: " ; 75 constant.print(os); 76 os << std::endl; 74 os << "constant expression " ; 75 constant.print( os ); 77 76 Expression::print( os, indent ); 78 77 } … … 93 92 94 93 void VariableExpr::print( std::ostream &os, int indent ) const { 95 os << std::string( indent, ' ') << "Variable Expression: ";94 os << std::string( indent, ' ' ) << "Variable Expression: "; 96 95 97 96 Declaration *decl = get_var(); … … 122 121 123 122 void SizeofExpr::print( std::ostream &os, int indent) const { 124 os << std::string( indent, ' ') << "Sizeof Expression on: ";123 os << std::string( indent, ' ' ) << "Sizeof Expression on: "; 125 124 126 125 if (isType) … … 152 151 153 152 void AttrExpr::print( std::ostream &os, int indent) const { 154 os << std::string( indent, ' ') << "Attr ";153 os << std::string( indent, ' ' ) << "Attr "; 155 154 attr->print( os, indent + 2 ); 156 155 if ( isType || expr ) { … … 184 183 185 184 void CastExpr::print( std::ostream &os, int indent ) const { 186 os << std::string( indent, ' ') << "Cast of:" << std::endl;185 os << std::string( indent, ' ' ) << "Cast of:" << std::endl; 187 186 arg->print(os, indent+2); 188 os << std::endl << std::string( indent, ' ') << "to:" << std::endl;187 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 189 188 if ( results.empty() ) { 190 os << std::string( indent+2, ' ') << "nothing" << std::endl;189 os << std::string( indent+2, ' ' ) << "nothing" << std::endl; 191 190 } else { 192 191 printAll(results, os, indent+2); … … 207 206 208 207 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 209 os << std::string( indent, ' ') << "Member Expression, with field: " << get_member();208 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member(); 210 209 211 210 Expression *agg = get_aggregate(); 212 os << std::string( indent, ' ') << "from aggregate: ";211 os << std::string( indent, ' ' ) << "from aggregate: "; 213 212 if (agg != 0) agg->print(os, indent + 2); 214 213 Expression::print( os, indent ); … … 234 233 235 234 void MemberExpr::print( std::ostream &os, int indent ) const { 236 os << std::string( indent, ' ') << "Member Expression, with field: " << std::endl;235 os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl; 237 236 238 237 assert( member ); 239 os << std::string( indent + 2, ' ');238 os << std::string( indent + 2, ' ' ); 240 239 member->print( os, indent + 2 ); 241 240 os << std::endl; 242 241 243 242 Expression *agg = get_aggregate(); 244 os << std::string( indent, ' ') << "from aggregate: " << std::endl;243 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 245 244 if (agg != 0) agg->print(os, indent + 2); 246 245 Expression::print( os, indent ); … … 261 260 262 261 void UntypedExpr::print( std::ostream &os, int indent ) const { 263 os << std::string( indent, ' ') << "Applying untyped: " << std::endl;262 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 264 263 function->print(os, indent + 4); 265 os << "\r" << std::string(indent, ' ') << "...to: " << std::endl;264 os << std::string( indent, ' ' ) << "...to: " << std::endl; 266 265 printArgs(os, indent + 4); 267 266 Expression::print( os, indent ); … … 282 281 283 282 void NameExpr::print( std::ostream &os, int indent ) const { 284 os << std::string( indent, ' ') << "Name: " << get_name() << std::endl;283 os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl; 285 284 Expression::print( os, indent ); 286 285 } … … 301 300 302 301 void LogicalExpr::print( std::ostream &os, int indent )const { 303 os << std::string( indent, ' ') << "Short-circuited operation (" << (isAnd?"and":"or") << ") on: ";302 os << std::string( indent, ' ' ) << "Short-circuited operation (" << (isAnd?"and":"or") << ") on: "; 304 303 arg1->print(os); 305 304 os << " and "; … … 323 322 324 323 void ConditionalExpr::print( std::ostream &os, int indent ) const { 325 os << std::string( indent, ' ') << "Conditional expression on: " << std::endl;324 os << std::string( indent, ' ' ) << "Conditional expression on: " << std::endl; 326 325 arg1->print( os, indent+2 ); 327 os << std::string( indent, ' ') << "First alternative:" << std::endl;326 os << std::string( indent, ' ' ) << "First alternative:" << std::endl; 328 327 arg2->print( os, indent+2 ); 329 os << std::string( indent, ' ') << "Second alternative:" << std::endl;328 os << std::string( indent, ' ' ) << "Second alternative:" << std::endl; 330 329 arg3->print( os, indent+2 ); 331 330 os << std::endl; … … 334 333 335 334 void UntypedValofExpr::print( std::ostream &os, int indent ) const { 336 os << std::string( indent, ' ') << "Valof Expression: " << std::endl;335 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl; 337 336 if ( get_body() != 0 ) 338 337 get_body()->print( os, indent + 2 );
Note:
See TracChangeset
for help on using the changeset viewer.