22 #define STL_INT_MAX_VALUE 32767LL
24 #define STL_INT_MIN_VALUE -32768LL
32 #define PREFIX_SEPARATOR '#'
34 #define OUT_OF_RANGE_MSG "Int literal out of range"
39 if(offset == std::string::npos)
43 const std::string literal{src.substr(offset)};
44 return std::stoll(literal,
nullptr, base);
49 long long literal_value;
54 catch(std::out_of_range &)
58 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
66 long long literal_value;
71 catch(std::out_of_range &)
75 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
83 long long literal_value;
88 catch(std::out_of_range &)
92 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
100 long long literal_value;
105 catch(std::out_of_range &)
109 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
117 long long literal_value;
122 catch(std::out_of_range &)
126 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
134 long long literal_value;
139 catch(std::out_of_range &)
143 if(STL_INT_MIN_VALUE <= literal_value && STL_INT_MAX_VALUE >= literal_value)
Pre-defined bitvector types.
A constant literal expression.
constant_exprt convert_dint_bit_literal_value(const std::string &src)
Converts a string into the corresponding 'DInt' expression.
constant_exprt convert_dint_dec_literal_value(const std::string &src)
Converts a string into the corresponding 'DInt' expression.
constant_exprt convert_dint_hex_literal_value(const std::string &src)
Converts a string into the corresponding 'DInt' expression.
Statement List Language Conversion.
constant_exprt convert_int_hex_literal(const std::string &src)
Converts a string into the corresponding 'Int' or 'DInt' expression.
constant_exprt convert_int_bit_literal(const std::string &src)
Converts a string into the corresponding 'Int' or 'DInt' expression.
#define BASE_10
Base of decimal integer literals.
static long long get_literal_value(const std::string &src, unsigned int base)
constant_exprt convert_int_bit_literal_value(const std::string &src)
Converts a string into the corresponding 'Int' expression.
#define BASE_2
Base of binary integer literals.
#define BASE_16
Base of hexadecimal integer literals.
constant_exprt convert_int_dec_literal_value(const std::string &src)
Converts a string into the corresponding 'Int' expression.
constant_exprt convert_int_dec_literal(const std::string &src)
Converts a string into the corresponding 'Int' or 'DInt' expression.
#define OUT_OF_RANGE_MSG
Message for the case of a literal being out of range.
constant_exprt convert_int_hex_literal_value(const std::string &src)
Converts a string into the corresponding 'Int' expression.
#define PREFIX_SEPARATOR
Character between a prefix and another prefix or the actual literal.
Statement List Language Conversion.
signedbv_typet get_int_type()
Creates a new type that resembles the 'Int' type of the Siemens PLC languages.
Statement List Type Helper.