Changes in src/Parser/ExpressionNode.cc [d56e5bc:d7dc824]
- File:
-
- 1 edited
-
src/Parser/ExpressionNode.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
rd56e5bc rd7dc824 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 16:44:46201713 // Update Count : 5 4112 // Last Modified On : Wed May 17 21:31:01 2017 13 // Update Count : 527 14 14 // 15 15 … … 62 62 bool dec = true, Unsigned = false; // decimal, unsigned constant 63 63 int size; // 0 => int, 1 => long, 2 => long long 64 unsigned long long intv; // converted integral value64 unsigned long long v; // converted integral value 65 65 size_t last = str.length() - 1; // last character of constant 66 66 … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str , v) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 133 133 // floating-point constant has minimum of 2 characters: 1. or .1 134 134 size_t last = str.length() - 1; 135 double v;136 137 sscanf( str.c_str(), "%lg", &v );138 135 139 136 if ( checkI( str[last] ) ) { // imaginary ? … … 153 150 } // if 154 151 155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str , v) );152 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str ) ); 156 153 delete &str; // created by lex 157 154 return ret; … … 159 156 160 157 Expression *build_constantChar( const std::string & str ) { 161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str , (unsigned long long int)(unsigned char)str[1]) );158 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str ) ); 162 159 delete &str; // created by lex 163 160 return ret; … … 167 164 // string should probably be a primitive type 168 165 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 166 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ), 167 toString( str.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"' 170 168 false, false ); 171 // constant 0 is ignored for pure string value 172 ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); 169 ConstantExpr * ret = new ConstantExpr( Constant( at, str ) ); 173 170 delete &str; // created by lex 174 171 return ret; … … 176 173 177 174 Expression *build_constantZeroOne( const std::string & str ) { 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str, 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 175 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str ) ); 180 176 delete &str; // created by lex 181 177 return ret; … … 188 184 std::stringstream ss( str ); 189 185 ss >> a >> dot >> b; 190 UntypedMemberExpr * ret = new UntypedMemberExpr( new ConstantExpr( Constant::from_int( b ) ), new ConstantExpr( Constant::from_int( a ) ) ); 186 UntypedMemberExpr * ret = new UntypedMemberExpr( 187 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( b ) ) ), 188 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( a ) ) ) ); 191 189 delete &str; 192 190 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.