1#ifndef ESBMC_PYTHON_TUPLE_HANDLER_H
2#define ESBMC_PYTHON_TUPLE_HANDLER_H
7#include <nlohmann/json.hpp>
54 const nlohmann::json &slice,
55 const nlohmann::json &element);
72 const nlohmann::json &ast_node,
73 const nlohmann::json &target,
92 const nlohmann::json &ast_node,
108 const nlohmann::json &element);
149 codet &target_block);
157 std::string build_tuple_tag(
const std::vector<typet> &element_types)
const;
168 exprt pad_string_element(
const exprt &elem)
const;
171 size_t starred_target_index(
const nlohmann::json &targets)
const;
176 const nlohmann::json &name_node,
178 codet &target_block);
180 typet unpack_target_type(
const exprt &rhs,
const typet &member_type)
const;
183 void assign_unpacked_element(
185 const exprt &member_access,
187 codet &target_block);
191 void assign_starred_elements(
192 const nlohmann::json &ast_node,
193 const nlohmann::json &star_value,
197 codet &target_block);
201 exprt copy_str_to_member(
205 codet &target_block);
208 typet tuple_member_type_from_annotation(
const nlohmann::json &node);
Definition std_types.h:397
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
Definition std_types.h:232
exprt handle_tuple_membership(const exprt &lhs, const exprt &rhs, bool invert, const nlohmann::json &element)
Handle tuple membership test (e.g., x in tuple).
Definition tuple_handler.cpp:949
tuple_handler(python_converter &converter, type_handler &type_handler)
Construct a new tuple handler.
Definition tuple_handler.cpp:18
void handle_tuple_unpacking(const nlohmann::json &ast_node, const nlohmann::json &target, exprt &rhs, codet &target_block)
Handle tuple unpacking assignments.
Definition tuple_handler.cpp:627
struct_typet create_tuple_struct_type(const std::vector< typet > &element_types) const
Create a tuple struct type from element types.
Definition tuple_handler.cpp:36
typet get_tuple_type_from_annotation(const nlohmann::json &annotation_node)
Get tuple type from annotation (e.g., tuple[int, str]).
Definition tuple_handler.cpp:917
exprt prepare_rhs_for_unpacking(const nlohmann::json &ast_node, exprt &rhs, codet &target_block)
Prepare RHS for unpacking (handle function calls).
Definition tuple_handler.cpp:574
bool is_tuple_type(const typet &type) const
Check if a type represents a tuple.
Definition tuple_handler.cpp:193
exprt get_tuple_expr(const nlohmann::json &element)
Create a tuple expression from AST elements.
Definition tuple_handler.cpp:102
exprt handle_tuple_subscript(const exprt &array, const nlohmann::json &slice, const nlohmann::json &element)
Handle tuple subscripting (e.g., t[0]).
Definition tuple_handler.cpp:323
static constexpr size_t tuple_str_member_size
Fixed byte width of string tuple members (content + NUL padding).
Definition tuple_handler.h:29
exprt get_tuple_element(const exprt &array, const struct_typet &tuple_type, size_t idx) const
Obtain an addressable expression for tuple element idx.
Definition tuple_handler.cpp:202
exprt coerce_to_tuple_type(const exprt &value, const typet &target, const locationt &loc, codet &target_block)
Convert tuple value to the annotation-built tuple type target.
Definition tuple_handler.cpp:287
Definition type_handler.h:113
int count
Definition cuda.h:51