22 const std::string &src)
26 if(src[0]==
'u' && src[1]==
'8')
31 std::basic_string<unsigned int> value=
38 value.resize(utf8_value.size());
39 for(std::size_t i=0; i<utf8_value.size(); i++)
40 value[i]=utf8_value[i];
44 else if(src[0]==
'L' || src[0]==
'u' || src[0]==
'U')
56 std::string char_value=
60 std::basic_string<unsigned int> value;
61 value.resize(char_value.size());
62 for(std::size_t i=0; i<char_value.size(); i++)
63 value[i]=char_value[i];
75 std::basic_string<unsigned int> value;
79 for(std::size_t i=0; i<src.size(); i++)
84 if(ch!=
'L' && ch!=
'u' && ch!=
'U' && ch!=
'"')
89 if((ch==
'u' || ch==
'U') && i+1<src.size() && src[i+1]==
'"')
93 std::size_t j=src.
find(
'"', i);
97 for(++j; j<src.size() && src[j]!=
'"'; ++j)
101 INVARIANT(j < src.size(),
"non-terminated string constant '" + src +
"'");
103 std::string tmp_src=std::string(src, i, j-i+1);
104 std::basic_string<unsigned int> tmp_value=
106 value.append(tmp_value);
128 result.
set(ID_C_string_constant,
true);
132 result.
operands().resize(value.size());
133 for(std::size_t i=0; i<value.size(); i++)
140 std::string char_value;
142 char_value.resize(value.size());
144 for(std::size_t i=0; i<value.size(); i++)
148 char_value[i]=value[i];
unsignedbv_typet char32_t_type()
bitvector_typet wchar_t_type()
bitvector_typet c_index_type()
unsignedbv_typet char16_t_type()
Base class for all expressions.
typet & type()
Return the type of the expression.
const irept & find(const irep_idt &name) const
void set(const irep_idt &name, const irep_idt &value)
The type of an expression, extends irept.
std::basic_string< unsigned int > convert_one_string_literal(const std::string &src)
C/C++ Language Conversion.
exprt convert_string_literal(const std::string &src)
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
std::string unescape_string(const std::string &src)
std::basic_string< unsigned int > unescape_wide_string(const std::string &src)
ANSI-C Language Conversion.
std::string utf32_native_endian_to_utf8(const std::basic_string< unsigned int > &s)