Changes in / [78a0b88:a01f7c94]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r78a0b88 ra01f7c94 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 15:07:09201713 // Update Count : 6 1812 // Last Modified On : Thu Aug 31 21:05:04 2017 13 // Update Count : 605 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 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) ); 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 148 153 CLEANUP: 149 if ( units.length() != 0 ) {150 ret = new UntypedExpr( new NameExpr( units, ret ) );151 } // if152 153 154 delete &str; // created by lex 154 155 return ret; … … 188 189 } // if 189 190 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 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 194 198 195 199 delete &str; // created by lex … … 200 204 string::size_type posn = str.find_last_of( delimit ) + 1; 201 205 if ( posn != str.length() ) { 202 units = "?" + str.substr( posn );// extract units206 units = str.substr( posn ); // extract units 203 207 str.erase( posn ); // remove units 204 208 } // if … … 209 213 sepString( str, units, '\'' ); // separate constant from units 210 214 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 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 215 222 216 223 delete &str; // created by lex … … 222 229 sepString( str, units, '"' ); // separate constant from units 223 230 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 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 232 242 233 243 delete &str; // created by lex
Note:
See TracChangeset
for help on using the changeset viewer.