Changeset e8ccca3 for src/Parser
- Timestamp:
- Sep 1, 2017, 3:33:19 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:
- 78a0b88
- Parents:
- 76c62b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r76c62b2 re8ccca3 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 31 21:05:04201713 // Update Count : 6 0512 // Last Modified On : Fri Sep 1 15:07:09 2017 13 // Update Count : 618 14 14 // 15 15 … … 61 61 string::size_type posn = str.find_first_of( "`" ); 62 62 if ( posn != string::npos ) { 63 units = str.substr( posn );// extract units63 units = "?" + str.substr( posn ); // extract units 64 64 str.erase( posn ); // remove units 65 65 } // if … … 145 145 } // if 146 146 147 // if ( units.length() == 0 ) { 148 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) ); 149 // } else { 150 // // ROB: generate call to units routine 151 // ret = nullptr; 152 // } // if 147 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) ); 153 148 CLEANUP: 149 if ( units.length() != 0 ) { 150 ret = new UntypedExpr( new NameExpr( units, ret ) ); 151 } // if 152 154 153 delete &str; // created by lex 155 154 return ret; … … 189 188 } // if 190 189 191 Expression * ret; 192 // if ( units.length() == 0 ) { 193 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) ); 194 // } else { 195 // ret = nullptr; 196 // // ROB: generate call to units routine 197 // } // if 190 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) ); 191 if ( units.length() != 0 ) { 192 ret = new UntypedExpr( new NameExpr( units, ret ) ); 193 } // if 198 194 199 195 delete &str; // created by lex … … 204 200 string::size_type posn = str.find_last_of( delimit ) + 1; 205 201 if ( posn != str.length() ) { 206 units = str.substr( posn );// extract units202 units = "?" + str.substr( posn ); // extract units 207 203 str.erase( posn ); // remove units 208 204 } // if … … 213 209 sepString( str, units, '\'' ); // separate constant from units 214 210 215 Expression * ret; 216 // if ( units.length() == 0 ) { 217 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 218 // } else { 219 // ret = nullptr; 220 // // ROB: generate call to units routine 221 // } // if 211 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 212 if ( units.length() != 0 ) { 213 ret = new UntypedExpr( new NameExpr( units, ret ) ); 214 } // if 222 215 223 216 delete &str; // created by lex … … 229 222 sepString( str, units, '"' ); // separate constant from units 230 223 231 ConstantExpr * ret; 232 // if ( units.length() == 0 ) { 233 // string should probably be a primitive type 234 ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 235 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 236 false, false ); 237 ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value 238 // } else { 239 // ret = nullptr; 240 // // ROB: generate call to units routine 241 // } // if 224 ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 225 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 226 false, false ); 227 ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value 228 // ROB: type mismatch 229 // if ( units.length() != 0 ) { 230 // ret = new UntypedExpr( new NameExpr( units, ret ) ); 231 // } // if 242 232 243 233 delete &str; // created by lex
Note: See TracChangeset
for help on using the changeset viewer.