25 unsigned width_suffix=0;
28 for(
unsigned i=0; i<src.size(); i++)
32 if(ch==
'u' || ch==
'U')
34 else if(ch==
'l' || ch==
'L')
36 else if(ch==
'i' || ch==
'I')
41 if((i+1)<src.size() && isdigit(src[i+1]))
46 else if(ch==
'j' || ch==
'J')
52 if(src.size()>=2 && src[0]==
'0' && tolower(src[1])==
'x')
56 std::string without_prefix(src, 2, std::string::npos);
59 else if(src.size()>=2 && src[0]==
'0' && tolower(src[1])==
'b')
64 std::string without_prefix(src, 2, std::string::npos);
67 else if(src.size()>=2 && src[0]==
'0' && isdigit(src[1]))
87 c_type=
is_unsigned?ID_unsigned_long_int:ID_signed_long_int;
89 c_type=
is_unsigned?ID_unsigned_long_long_int:ID_signed_long_long_int;
92 is_unsigned ? ID_unsignedbv : ID_signedbv, width_suffix);
93 type.
set(ID_C_c_type, c_type);
105 bool is_hex_or_oct_or_bin=(base==8) || (base==16) || (base==2);
107 #define FITS(width, signed) \
108 ((signed?!is_unsigned:(is_unsigned || is_hex_or_oct_or_bin)) && \
109 (power(2, signed?width-1:width)>value_abs))
119 c_type=ID_signed_int;
125 c_type=ID_unsigned_int;
131 c_type=ID_signed_long_int;
138 c_type=ID_unsigned_long_int;
144 c_type=ID_signed_long_long_int;
151 c_type=ID_unsigned_long_long_int;
161 c_type=ID_unsigned_long_long_int;
164 c_type=ID_signed_long_long_int;
168 type.
set(ID_C_c_type, c_type);
180 result.
set(ID_C_base, base);