ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
string_handler.h
Go to the documentation of this file.
1#ifndef PYTHON_FRONTEND_STRING_HANDLER_H
2#define PYTHON_FRONTEND_STRING_HANDLER_H
3
4#include <util/irep/expr.h>
7#include <util/lang/c_types.h>
10#include <nlohmann/json.hpp>
11#include <optional>
12#include <string>
13#include <unordered_map>
14#include <vector>
15
16// Forward declarations
18class type_handler;
19class string_builder;
20
36{
37public:
46 python_converter &converter,
47 contextt &symbol_table,
49 string_builder *str_builder);
50
52 {
53 string_builder_ = sb;
54 }
55
56 // String size and conversion operations
57
63 BigInt get_string_size(const exprt &expr);
64
70 exprt convert_to_string(const exprt &expr);
71
87 static std::string fstring_repr_of_constant(const nlohmann::json &operand);
88
92 const nlohmann::json &value,
93 int conversion,
94 const exprt &operand,
95 const locationt &location);
96
100 exprt build_repr(const exprt &value, const locationt &location);
101
103 exprt format_fstring_part(const nlohmann::json &value);
104
106
108 exprt build_nondet_string(const locationt &location);
109
111 static int nondet_str_buffer_size();
112
118 std::string extract_string_from_array_operands(const exprt &array_expr) const;
119
124 void ensure_string_array(exprt &expr);
125
132
133 // Format string operations
134
140 std::string process_format_spec(const nlohmann::json &format_spec);
141
148 exprt
149 apply_format_specification(const exprt &expr, const std::string &format);
150
153 exprt format_runtime_value(const exprt &expr, const std::string &format);
154
160 exprt get_fstring_expr(const nlohmann::json &element);
161
162 // String concatenation operations
163
173 const exprt &lhs,
174 const exprt &rhs,
175 const nlohmann::json &left,
176 const nlohmann::json &right);
177
187 exprt &lhs,
188 exprt &rhs,
189 const nlohmann::json &left,
190 const nlohmann::json &right);
191
192 // String comparison operations
193
204 const std::string &op,
205 exprt &lhs,
206 exprt &rhs,
207 const nlohmann::json &element);
208
216 exprt
217 handle_single_char_comparison(const std::string &op, exprt &lhs, exprt &rhs);
218
229 const std::string &op,
230 const exprt &lhs_char_value,
231 const exprt &rhs_char_value,
232 const exprt &lhs_source,
233 const exprt &rhs_source) const;
234
242
254 const std::string &op,
255 exprt &lhs,
256 exprt &rhs,
257 const nlohmann::json &left,
258 const nlohmann::json &right,
259 const nlohmann::json &element);
260
261 // String joining operations
262
272 exprt handle_str_join(const nlohmann::json &call_json);
274 const exprt &separator,
275 const nlohmann::json &call_json);
276
280 const nlohmann::json &elements,
281 std::vector<exprt> &elem_exprs);
282
290 exprt handle_string_attribute_call(const nlohmann::json &call_json);
291
298 const exprt &receiver,
299 const std::string &method,
300 const nlohmann::json &call_json);
301
310 const nlohmann::json &call_json,
311 const exprt &arg_expr);
312 exprt char_array_type_length(const exprt &arg_expr) const;
313
314 // String method operations
315
324 const exprt &string_obj,
325 const exprt &prefix_arg,
326 const locationt &location);
327
336 const exprt &string_obj,
337 const exprt &suffix_arg,
338 const locationt &location);
339
347 const exprt &string_obj,
348 const nlohmann::json &args,
349 python_converter &converter,
350 const locationt &location,
351 bool is_suffix);
352
359 const exprt &string_obj,
360 const exprt &affix_tuple,
361 const locationt &location,
362 bool is_suffix);
363
370 exprt
371 handle_string_isdigit(const exprt &string_obj, const locationt &location);
372
379 exprt
380 handle_string_isalpha(const exprt &string_obj, const locationt &location);
381
388 exprt handle_string_isspace(const exprt &str_expr, const locationt &location);
389
396 exprt handle_char_isspace(const exprt &char_expr, const locationt &location);
397
406 const exprt &str_expr,
407 const exprt &chars_arg,
408 const locationt &location);
409
418 const exprt &str_expr,
419 const exprt &chars_arg,
420 const locationt &location);
421
430 const exprt &str_expr,
431 const exprt &chars_arg,
432 const locationt &location);
433
442 exprt &lhs,
443 exprt &rhs,
444 const nlohmann::json &element);
445
453 exprt
454 handle_string_islower(const exprt &string_obj, const locationt &location);
455
462 exprt handle_string_lower(const exprt &string_obj, const locationt &location);
463
470 exprt handle_string_upper(const exprt &string_obj, const locationt &location);
480 const exprt &string_obj,
481 const exprt &find_arg,
482 const locationt &location);
483
494 const exprt &string_obj,
495 const exprt &find_arg,
496 const exprt &start_arg,
497 const exprt &end_arg,
498 const locationt &location);
499
509 const nlohmann::json &call,
510 const exprt &string_obj,
511 const exprt &find_arg,
512 const locationt &location);
513
525 const nlohmann::json &call,
526 const exprt &string_obj,
527 const exprt &find_arg,
528 const exprt &start_arg,
529 const exprt &end_arg,
530 const locationt &location);
531
541 const exprt &string_obj,
542 const exprt &find_arg,
543 const locationt &location);
544
555 const exprt &string_obj,
556 const exprt &find_arg,
557 const exprt &start_arg,
558 const exprt &end_arg,
559 const locationt &location);
560
571 const nlohmann::json &call,
572 const exprt &string_obj,
573 const exprt &find_arg,
574 const locationt &location);
575
588 const nlohmann::json &call,
589 const exprt &string_obj,
590 const exprt &find_arg,
591 const exprt &start_arg,
592 const exprt &end_arg,
593 const locationt &location);
594
605 const exprt &string_obj,
606 const exprt &old_arg,
607 const exprt &new_arg,
608 const exprt &count_arg,
609 const locationt &location);
610
614 exprt
615 handle_string_capitalize(const exprt &string_obj, const locationt &location);
616
620 exprt handle_string_title(const exprt &string_obj, const locationt &location);
621
625 exprt
626 handle_string_swapcase(const exprt &string_obj, const locationt &location);
627
631 exprt
632 handle_string_casefold(const exprt &string_obj, const locationt &location);
633
638 const exprt &string_obj,
639 const exprt &sub_arg,
640 const exprt &start_arg,
641 const exprt &end_arg,
642 const locationt &location);
643
648 const exprt &string_obj,
649 const exprt &prefix_arg,
650 const locationt &location);
651
656 const exprt &string_obj,
657 const exprt &suffix_arg,
658 const locationt &location);
659
664 const nlohmann::json &call,
665 const exprt &string_obj,
666 const locationt &location,
667 bool keepends = false);
668
673 const nlohmann::json &call,
674 const exprt &string_obj,
675 const locationt &location);
676
681 const exprt &string_obj,
682 const exprt &sep_arg,
683 const locationt &location);
684
691 const exprt &string_obj,
692 const exprt &sep_arg,
693 const locationt &location);
694
701 const exprt &string_obj,
702 const exprt &sep_arg,
703 const locationt &location,
704 bool from_right);
705
710 const exprt &string_obj,
711 [[maybe_unused]] const locationt &location);
712
717 const exprt &string_obj,
718 [[maybe_unused]] const locationt &location);
719
724 const exprt &string_obj,
725 [[maybe_unused]] const locationt &location);
726
731 const exprt &string_obj,
732 [[maybe_unused]] const locationt &location);
733
738 const exprt &string_obj,
739 const exprt &width_arg,
740 const exprt &fill_arg,
741 const locationt &location);
742
747 const exprt &string_obj,
748 const exprt &width_arg,
749 const exprt &fill_arg,
750 const locationt &location);
751
756 const exprt &string_obj,
757 const exprt &width_arg,
758 const exprt &fill_arg,
759 const locationt &location);
760
765 const exprt &string_obj,
766 const exprt &width_arg,
767 const locationt &location);
768
773 const exprt &string_obj,
774 const exprt &tabsize_arg,
775 const locationt &location);
776
781 const nlohmann::json &call,
782 const exprt &string_obj,
783 const locationt &location);
784
792 static bool extract_constant_string(
793 const nlohmann::json &node,
794 python_converter &converter,
795 std::string &out);
796
797 // Utility methods
798
804 bool is_zero_length_array(const exprt &expr);
805
812
821 const exprt &string_obj,
822 const exprt &base_arg,
823 const locationt &location);
824
832 const exprt &string_obj,
833 const locationt &location);
834
842 exprt handle_int_conversion(const exprt &arg, const locationt &location);
843
853 const exprt &arg,
854 const exprt &base,
855 const locationt &location);
856
867 exprt
868 handle_string_to_float(const exprt &string_obj, const locationt &location);
869
877 exprt
878 handle_string_is_float(const exprt &string_obj, const locationt &location);
879
888 exprt
889 handle_chr_conversion(const exprt &codepoint_arg, const locationt &location);
890
901 exprt
902 handle_ord_conversion(const exprt &string_obj, const locationt &location);
903
904private:
905 python_converter &converter_;
906 contextt &symbol_table_;
907 type_handler &type_handler_;
908 string_builder *string_builder_;
909 std::unordered_map<std::string, symbolt *> symbol_cache_;
910 std::unordered_map<std::string, int> assignment_count_cache_;
911 std::unordered_map<std::string, bool> assignment_has_augassign_cache_;
912 std::unordered_map<std::string, nlohmann::json> var_value_cache_;
913 std::string len_cache_scope_id_;
914
915 // Helper methods for internal use
916 bool try_extract_const_string_expr(const exprt &expr, std::string &out);
917
924 exprt make_char_array_expr(
925 const std::vector<unsigned char> &chars,
926 const typet &type);
927
929 exprt char_to_string(const exprt &expr);
930
931 exprt constant_to_string(const exprt &expr);
932
933 exprt build_string_index_result(
934 const nlohmann::json &call,
935 const exprt &find_expr,
936 const locationt &location);
937
950 std::string ensure_string_function_symbol(const std::string &function_name);
951
952 symbolt *find_cached_symbol(const std::string &symbol_id);
953 const symbolt *find_foldable_symbol(const std::string &symbol_id);
954 exprt symbol_to_string(const exprt &expr);
955 symbolt *find_cached_c_function_symbol(const std::string &symbol_id);
956 exprt try_len_fast_path_from_constant_arg(
957 const nlohmann::json &arg_json,
958 const exprt &arg_expr);
959 exprt try_len_fast_path_from_name_arg(const nlohmann::json &arg_json);
960
968 std::string float_to_string(
969 const std::string &float_bits,
970 std::size_t width,
971 int precision);
972
973public:
986 static std::string cpython_float_str(double d);
987};
988
989#endif // PYTHON_FRONTEND_STRING_HANDLER_H
static const twodig_t base
Definition bigint.cpp:28
Definition bigint.hh:58
Definition context.h:57
Definition expr.h:34
Definition location.h:7
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
Helper class for building and manipulating string expressions in Python frontend Handles null-termina...
Definition string_builder.h:20
exprt handle_string_startswith(const exprt &string_obj, const exprt &prefix_arg, const locationt &location)
Handle str.startswith() method.
Definition string_method_handler.cpp:1530
exprt handle_string_isupper(const exprt &string_obj, const locationt &location)
Handle str.isupper() method.
Definition string_method_handler.cpp:3495
exprt build_fstring_conversion(const nlohmann::json &value, int conversion, const exprt &operand, const locationt &location)
The rendered part for an f-string replacement field carrying a !r / !a conversion: the folded repr wh...
Definition string_handler.cpp:704
exprt format_runtime_value(const exprt &expr, const std::string &format)
A spec on a value not folded at conversion time: a fixed-point float through its model,...
Definition string_handler.cpp:1446
static int nondet_str_buffer_size()
The nondet str buffer size: –nondet-str-length plus the NUL.
Definition string_handler.cpp:762
exprt apply_format_specification(const exprt &expr, const std::string &format)
Apply format specification to an expression.
Definition string_handler.cpp:1108
exprt handle_string_rfind_range(const exprt &string_obj, const exprt &find_arg, const exprt &start_arg, const exprt &end_arg, const locationt &location)
Handle str.rfind() with start/end.
Definition string_method_handler.cpp:2558
exprt handle_string_isalpha(const exprt &string_obj, const locationt &location)
Handle str.isalpha() method.
Definition string_method_handler.cpp:1727
exprt build_partition_tuple(const exprt &string_obj, const exprt &sep_arg, const locationt &location, bool from_right)
Shared implementation of partition()/rpartition(): builds the 3-tuple (before, sep,...
Definition string_method_handler.cpp:3341
exprt join_unfoldable_iterable(const exprt &separator, const nlohmann::json &call_json)
Definition string_handler.cpp:3765
exprt handle_string_ljust(const exprt &string_obj, const exprt &width_arg, const exprt &fill_arg, const locationt &location)
Handle str.ljust() method (constant-only support).
Definition string_method_handler.cpp:3644
exprt handle_char_isspace(const exprt &char_expr, const locationt &location)
Handle char.isspace() method for single characters.
Definition string_method_handler.cpp:1787
exprt handle_string_rstrip(const exprt &str_expr, const exprt &chars_arg, const locationt &location)
Handle str.rstrip() method.
Definition string_method_handler.cpp:2151
exprt handle_string_rfind(const exprt &string_obj, const exprt &find_arg, const locationt &location)
Handle str.rfind() method.
Definition string_method_handler.cpp:2533
exprt convert_join_items(const nlohmann::json &elements, std::vector< exprt > &elem_exprs)
Convert a join() literal's elements into elem_exprs.
Definition string_handler.cpp:3740
exprt handle_string_format(const nlohmann::json &call, const exprt &string_obj, const locationt &location)
Handle str.format() method (minimal support, constant-only).
Definition string_method_handler.cpp:3137
static bool extract_constant_string(const nlohmann::json &node, python_converter &converter, std::string &out)
Extract a constant string from the AST node (literal or const var).
Definition string_handler.cpp:2517
exprt handle_string_strip(const exprt &str_expr, const exprt &chars_arg, const locationt &location)
Handle str.strip() method.
Definition string_method_handler.cpp:1989
exprt handle_string_swapcase(const exprt &string_obj, const locationt &location)
Handle str.swapcase() method.
Definition string_method_handler.cpp:2833
exprt handle_string_upper(const exprt &string_obj, const locationt &location)
Handle str.upper() method.
Definition string_method_handler.cpp:2376
exprt handle_ord_conversion(const exprt &string_obj, const locationt &location)
Handle ord() of a runtime string whose value is not known at compile time.
Definition string_handler.cpp:2750
exprt handle_string_center(const exprt &string_obj, const exprt &width_arg, const exprt &fill_arg, const locationt &location)
Handle str.center() method (constant-only support).
Definition string_method_handler.cpp:3590
exprt handle_string_replace(const exprt &string_obj, const exprt &old_arg, const exprt &new_arg, const exprt &count_arg, const locationt &location)
Handle str.replace() method.
Definition string_method_handler.cpp:2621
exprt build_repr(const exprt &value, const locationt &location)
repr() of a runtime value, or nil when its type has no model: a number or bool renders as str() does,...
Definition string_handler.cpp:663
bool is_zero_length_array(const exprt &expr)
Check if an expression is a zero-length array.
Definition string_handler.cpp:1812
exprt build_affix_tuple_match(const exprt &string_obj, const exprt &affix_tuple, const locationt &location, bool is_suffix)
Shared implementation for startswith()/endswith() with a tuple of affixes: True iff the string matche...
Definition string_method_handler.cpp:1455
exprt handle_string_title(const exprt &string_obj, const locationt &location)
Handle str.title() method.
Definition string_method_handler.cpp:2783
exprt handle_string_capitalize(const exprt &string_obj, const locationt &location)
Handle str.capitalize() method.
Definition string_method_handler.cpp:2737
exprt create_char_comparison_expr(const std::string &op, const exprt &lhs_char_value, const exprt &rhs_char_value, const exprt &lhs_source, const exprt &rhs_source) const
Create a character comparison expression.
Definition string_handler.cpp:4007
exprt handle_string_operations(const std::string &op, exprt &lhs, exprt &rhs, const nlohmann::json &left, const nlohmann::json &right, const nlohmann::json &element)
Handle general string operations.
Definition string_handler.cpp:1871
static std::string cpython_float_str(double d)
Render a constant double as CPython's str()/repr() would: the shortest decimal string that reads back...
Definition string_handler.cpp:965
exprt handle_string_count(const exprt &string_obj, const exprt &sub_arg, const exprt &start_arg, const exprt &end_arg, const locationt &location)
Handle str.count() method (constant fold, else runtime model).
Definition string_method_handler.cpp:2904
exprt build_nondet_string_fallback(const locationt &location)
Definition string_handler.cpp:803
exprt handle_string_removesuffix(const exprt &string_obj, const exprt &suffix_arg, const locationt &location)
Handle str.removesuffix() method.
Definition string_method_handler.cpp:3036
exprt handle_string_is_float(const exprt &string_obj, const locationt &location)
Build a call to the __python_str_is_float operational model, returning a bool that is true iff the ru...
Definition string_handler.cpp:2686
exprt build_nondet_string(const locationt &location)
A bounded, NUL-terminated str of nondet content, as nondet_str() gives.
Definition string_handler.cpp:768
exprt try_handle_len_string_fast_path(const nlohmann::json &call_json, const exprt &arg_expr)
Try fast-path folding for len() when argument is string-like.
Definition string_handler.cpp:2768
exprt char_array_type_length(const exprt &arg_expr) const
Definition string_handler.cpp:2840
exprt handle_string_rjust(const exprt &string_obj, const exprt &width_arg, const exprt &fill_arg, const locationt &location)
Handle str.rjust() method (constant-only support).
Definition string_method_handler.cpp:3690
exprt handle_string_isdigit(const exprt &string_obj, const locationt &location)
Handle str.isdigit() method.
Definition string_method_handler.cpp:1685
exprt handle_string_lower(const exprt &string_obj, const locationt &location)
Handle str.lower() method.
Definition string_method_handler.cpp:2339
exprt handle_string_isidentifier(const exprt &string_obj, const locationt &location)
Handle str.isidentifier() method.
Definition string_method_handler.cpp:3562
exprt get_fstring_expr(const nlohmann::json &element)
Convert f-string JSON to expression.
Definition string_handler.cpp:1720
string_handler(python_converter &converter, contextt &symbol_table, type_handler &type_handler, string_builder *str_builder)
Constructs a string_handler.
Definition string_handler.cpp:53
static std::string fstring_repr_of_constant(const nlohmann::json &operand)
Build a sound symbolic fallback for a char * string value when a string handler cannot compile-time-f...
Definition string_handler.cpp:637
exprt handle_string_isalnum(const exprt &string_obj, const locationt &location)
Handle str.isalnum() method.
Definition string_method_handler.cpp:3453
void ensure_string_array(exprt &expr)
Ensure an expression is a null-terminated string array.
Definition string_handler.cpp:1855
exprt handle_string_isspace(const exprt &str_expr, const locationt &location)
Handle str.isspace() method for strings.
Definition string_method_handler.cpp:1765
exprt handle_str_join(const nlohmann::json &call_json)
Handle str.join() method.
Definition string_handler.cpp:3791
exprt handle_string_index(const nlohmann::json &call, const exprt &string_obj, const exprt &find_arg, const locationt &location)
Handle str.index() method.
Definition string_method_handler.cpp:2474
exprt handle_string_index_range(const nlohmann::json &call, const exprt &string_obj, const exprt &find_arg, const exprt &start_arg, const exprt &end_arg, const locationt &location)
Handle str.index() with start/end.
Definition string_method_handler.cpp:2484
exprt handle_startswith_endswith_with_pos(const exprt &string_obj, const nlohmann::json &args, python_converter &converter, const locationt &location, bool is_suffix)
Handle str.startswith/endswith with optional start/end position arguments: s.startswith(prefix,...
Definition string_method_handler.cpp:1395
exprt handle_string_expandtabs(const exprt &string_obj, const exprt &tabsize_arg, const locationt &location)
Handle str.expandtabs() method (constant-only support).
Definition string_method_handler.cpp:3780
exprt handle_int_conversion(const exprt &arg, const locationt &location)
Handle int() builtin with automatic type detection Supports int(x) where x can be: int,...
Definition string_handler.cpp:2596
exprt handle_string_membership(exprt &lhs, exprt &rhs, const nlohmann::json &element)
Handle 'in' operator for strings.
Definition string_handler.cpp:1972
exprt handle_string_lstrip(const exprt &str_expr, const exprt &chars_arg, const locationt &location)
Handle str.lstrip() method.
Definition string_method_handler.cpp:1814
exprt handle_string_concatenation_with_promotion(exprt &lhs, exprt &rhs, const nlohmann::json &left, const nlohmann::json &right)
Handle string concatenation with type promotion.
Definition string_handler.cpp:1913
exprt format_fstring_part(const nlohmann::json &value)
The rendered text of one f-string replacement field.
Definition string_handler.cpp:1687
exprt handle_string_rpartition(const exprt &string_obj, const exprt &sep_arg, const locationt &location)
Handle str.rpartition() method (constant-only support).
Definition string_method_handler.cpp:3333
exprt handle_string_to_float(const exprt &string_obj, const locationt &location)
Convert a runtime string expression to a double via the __python_str_to_float operational model.
Definition string_handler.cpp:2664
exprt handle_string_comparison(const std::string &op, exprt &lhs, exprt &rhs, const nlohmann::json &element)
Handle string comparison operations.
Definition string_handler.cpp:1963
exprt handle_string_casefold(const exprt &string_obj, const locationt &location)
Handle str.casefold() method.
Definition string_method_handler.cpp:2881
exprt handle_string_find(const exprt &string_obj, const exprt &find_arg, const locationt &location)
Handle str.find() method.
Definition string_method_handler.cpp:2413
exprt handle_string_rindex(const nlohmann::json &call, const exprt &string_obj, const exprt &find_arg, const locationt &location)
Handle str.rindex() method (rfind that raises on not-found).
Definition string_method_handler.cpp:2596
exprt handle_string_isnumeric(const exprt &string_obj, const locationt &location)
Handle str.isnumeric() method.
Definition string_method_handler.cpp:3538
exprt handle_string_rindex_range(const nlohmann::json &call, const exprt &string_obj, const exprt &find_arg, const exprt &start_arg, const exprt &end_arg, const locationt &location)
Handle str.rindex() with start/end.
Definition string_method_handler.cpp:2608
exprt handle_string_splitlines(const nlohmann::json &call, const exprt &string_obj, const locationt &location, bool keepends=false)
Handle str.splitlines() method (constant-only support).
Definition string_method_handler.cpp:3068
std::string extract_string_from_array_operands(const exprt &array_expr) const
Extract string content from array operands.
Definition string_handler.cpp:1828
exprt convert_to_string(const exprt &expr)
Convert an expression to a string representation.
Definition string_handler.cpp:1570
exprt handle_string_to_int(const exprt &string_obj, const exprt &base_arg, const locationt &location)
Convert a string to an integer using Python's int() function.
Definition string_handler.cpp:2525
exprt handle_string_repetition(exprt &lhs, exprt &rhs)
Handle string repetition.
Definition string_handler.cpp:1807
std::string process_format_spec(const nlohmann::json &format_spec)
Process format specification for f-strings.
Definition string_handler.cpp:887
exprt handle_string_attribute_call(const nlohmann::json &call_json)
Dispatch and handle string attribute method calls.
Definition string_handler.cpp:3091
exprt handle_string_format_map(const nlohmann::json &call, const exprt &string_obj, const locationt &location)
Handle str.format_map() method (minimal support, constant-only).
Definition string_method_handler.cpp:3827
exprt handle_chr_conversion(const exprt &codepoint_arg, const locationt &location)
Handle chr() builtin function Converts a Unicode code point to its string representation Supports chr...
Definition string_handler.cpp:2707
exprt handle_string_partition(const exprt &string_obj, const exprt &sep_arg, const locationt &location)
Handle str.partition() method (constant-only support).
Definition string_method_handler.cpp:3325
exprt handle_string_endswith(const exprt &string_obj, const exprt &suffix_arg, const locationt &location)
Handle str.endswith() method.
Definition string_method_handler.cpp:1605
void set_string_builder(string_builder *sb)
Definition string_handler.h:51
exprt handle_string_zfill(const exprt &string_obj, const exprt &width_arg, const locationt &location)
Handle str.zfill() method (constant-only support).
Definition string_method_handler.cpp:3736
exprt handle_string_find_range(const exprt &string_obj, const exprt &find_arg, const exprt &start_arg, const exprt &end_arg, const locationt &location)
Handle str.find() with start/end.
Definition string_method_handler.cpp:2438
exprt read_tagged_str_receiver(const exprt &receiver, const std::string &method, const nlohmann::json &call_json)
The str a tagged receiver of str-only method method holds, after raising AttributeError on the paths ...
Definition string_handler.cpp:3061
exprt handle_single_char_comparison(const std::string &op, exprt &lhs, exprt &rhs)
Handle single character comparisons.
Definition string_handler.cpp:4027
exprt ensure_null_terminated_string(exprt &e)
Ensure string is null-terminated.
Definition string_handler.cpp:1958
exprt handle_int_conversion_with_base(const exprt &arg, const exprt &base, const locationt &location)
Handle int() builtin with explicit base Supports int(x, base) where x is a string.
Definition string_handler.cpp:2643
exprt handle_string_concatenation(const exprt &lhs, const exprt &rhs, const nlohmann::json &left, const nlohmann::json &right)
Handle string concatenation.
Definition string_handler.cpp:1798
exprt handle_string_removeprefix(const exprt &string_obj, const exprt &prefix_arg, const locationt &location)
Handle str.removeprefix() method.
Definition string_method_handler.cpp:3008
exprt handle_string_to_int_base10(const exprt &string_obj, const locationt &location)
Convert a string to an integer using base 10 (convenience method).
Definition string_handler.cpp:2588
exprt get_array_base_address(const exprt &arr)
Get base address of array (first element).
Definition string_handler.cpp:1896
exprt handle_string_islower(const exprt &string_obj, const locationt &location)
Handle Python's str.islower() method.
Definition string_method_handler.cpp:2301
BigInt get_string_size(const exprt &expr)
Calculate the size of a string expression.
Definition string_handler.cpp:847
Definition symbol_id.h:6
Definition symbol.h:12
Definition type_handler.h:113
Definition type.h:9
Definition toml.hpp:1531
@ elements
The container's own elements: lists, sets, tuples, and a dict's internal keys/values lists.
Definition element_type_registry.h:24