Changes in / [78a0b88:a01f7c94]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r78a0b88 ra01f7c94  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 15:07:09 2017
    13 // Update Count     : 618
     12// Last Modified On : Thu Aug 31 21:05:04 2017
     13// Update Count     : 605
    1414//
    1515
     
    6161        string::size_type posn = str.find_first_of( "`" );
    6262        if ( posn != string::npos ) {
    63                 units = "?" + str.substr( posn );                               // extract units
     63                units = str.substr( posn );                                             // extract units
    6464                str.erase( posn );                                                              // remove units
    6565        } // if
     
    145145        } // if
    146146
    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
    148153  CLEANUP:
    149         if ( units.length() != 0 ) {
    150                 ret = new UntypedExpr( new NameExpr( units, ret ) );
    151         } // if
    152 
    153154        delete &str;                                                                            // created by lex
    154155        return ret;
     
    188189        } // if
    189190
    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
    194198
    195199        delete &str;                                                                            // created by lex
     
    200204        string::size_type posn = str.find_last_of( delimit ) + 1;
    201205        if ( posn != str.length() ) {
    202                 units = "?" + str.substr( posn );                               // extract units
     206                units = str.substr( posn );                                             // extract units
    203207                str.erase( posn );                                                              // remove units
    204208        } // if
     
    209213        sepString( str, units, '\'' );                                          // separate constant from units
    210214
    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
    215222
    216223        delete &str;                                                                            // created by lex
     
    222229        sepString( str, units, '"' );                                           // separate constant from units
    223230
    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
    232242               
    233243        delete &str;                                                                            // created by lex
Note: See TracChangeset for help on using the changeset viewer.