Changeset f43df73
- Timestamp:
- Sep 1, 2017, 11:04:35 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- e612146c
- Parents:
- dbc733e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
rdbc733e rf43df73 7 7 // ExpressionNode.cc -- 8 8 // 9 // Author : Rodolfo G. Esteves9 // Author : Peter A. Buhr 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 1 2 1:49:16201713 // Update Count : 62 212 // Last Modified On : Fri Sep 1 22:57:24 2017 13 // Update Count : 625 14 14 // 15 15 … … 155 155 } // build_constantInteger 156 156 157 Expression * build_constantFloat( st d::string & str ) {157 Expression * build_constantFloat( string & str ) { 158 158 static const BasicType::Kind kind[2][3] = { 159 159 { BasicType::Float, BasicType::Double, BasicType::LongDouble }, … … 205 205 } // sepString 206 206 207 Expression * build_constantChar( st d::string & str ) {207 Expression * build_constantChar( string & str ) { 208 208 string units; // units 209 209 sepString( str, units, '\'' ); // separate constant from units … … 218 218 } // build_constantChar 219 219 220 ConstantExpr * build_constantStr( st d::string & str ) {220 ConstantExpr * build_constantStr( string & str ) { 221 221 string units; // units 222 222 sepString( str, units, '"' ); // separate constant from units … … 235 235 } // build_constantStr 236 236 237 Expression * build_field_name_FLOATINGconstant( const st d::string & str ) {237 Expression * build_field_name_FLOATINGconstant( const string & str ) { 238 238 // str is of the form A.B -> separate at the . and return member expression 239 239 int a, b; 240 240 char dot; 241 st d::stringstream ss( str );241 stringstream ss( str ); 242 242 ss >> a >> dot >> b; 243 243 UntypedMemberExpr * ret = new UntypedMemberExpr( new ConstantExpr( Constant::from_int( b ) ), new ConstantExpr( Constant::from_int( a ) ) ); … … 253 253 } else { 254 254 return new UntypedMemberExpr( fracts, fieldName ); 255 } 256 } 255 } // if 256 } // if 257 257 return fieldName; 258 258 } // make_field_name_fraction_constants … … 262 262 } // build_field_name_fraction_constants 263 263 264 Expression * build_field_name_REALFRACTIONconstant( const st d::string & str ) {264 Expression * build_field_name_REALFRACTIONconstant( const string & str ) { 265 265 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) throw SemanticError( "invalid tuple index " + str ); 266 Expression * ret = build_constantInteger( *new st d::string( str.substr(1) ) );266 Expression * ret = build_constantInteger( *new string( str.substr(1) ) ); 267 267 delete &str; 268 268 return ret; 269 269 } // build_field_name_REALFRACTIONconstant 270 270 271 Expression * build_field_name_REALDECIMALconstant( const st d::string & str ) {271 Expression * build_field_name_REALDECIMALconstant( const string & str ) { 272 272 if ( str[str.size()-1] != '.' ) throw SemanticError( "invalid tuple index " + str ); 273 Expression * ret = build_constantInteger( *new st d::string( str.substr( 0, str.size()-1 ) ) );273 Expression * ret = build_constantInteger( *new string( str.substr( 0, str.size()-1 ) ) ); 274 274 delete &str; 275 275 return ret; … … 353 353 354 354 Expression * build_unary_val( OperKinds op, ExpressionNode * expr_node ) { 355 std::list< Expression * > args;355 list< Expression * > args; 356 356 args.push_back( maybeMoveBuild< Expression >(expr_node) ); 357 357 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); … … 359 359 360 360 Expression * build_unary_ptr( OperKinds op, ExpressionNode * expr_node ) { 361 std::list< Expression * > args;361 list< Expression * > args; 362 362 args.push_back( maybeMoveBuild< Expression >(expr_node) ); // xxx -- this is exactly the same as the val case now, refactor this code. 363 363 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); … … 365 365 366 366 Expression * build_binary_val( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) { 367 std::list< Expression * > args;367 list< Expression * > args; 368 368 args.push_back( maybeMoveBuild< Expression >(expr_node1) ); 369 369 args.push_back( maybeMoveBuild< Expression >(expr_node2) ); … … 372 372 373 373 Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) { 374 std::list< Expression * > args;374 list< Expression * > args; 375 375 args.push_back( maybeMoveBuild< Expression >(expr_node1) ); 376 376 args.push_back( maybeMoveBuild< Expression >(expr_node2) ); … … 395 395 396 396 Expression * build_tuple( ExpressionNode * expr_node ) { 397 std::list< Expression * > exprs;397 list< Expression * > exprs; 398 398 buildMoveList( expr_node, exprs ); 399 399 return new UntypedTupleExpr( exprs );; … … 401 401 402 402 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ) { 403 std::list< Expression * > args;403 list< Expression * > args; 404 404 buildMoveList( expr_node, args ); 405 405 return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
Note: See TracChangeset
for help on using the changeset viewer.