7#include <nlohmann/json.hpp>
90 const nlohmann::json &element,
91 const nlohmann::json &type_node,
111 const nlohmann::json &element,
114 const std::function<
void(
code_assertt &)> &attach_assert_message);
131 const nlohmann::json &element,
132 const exprt &func_call_expr,
135 const std::function<
void(
code_assertt &)> &attach_assert_message);
162 build_builtin_exception(
const nlohmann::json &exc,
const typet &type)
const;
166 bool raises_instance_variable(
167 const nlohmann::json &exc,
168 const std::string &exc_name)
const;
174 nlohmann::json inject_finally_before_escapes(
175 const nlohmann::json &body,
176 const nlohmann::json &finalbody,
181 void emit_finally_then_escape(
182 const nlohmann::json &stmt,
183 const nlohmann::json &finalbody,
184 nlohmann::json &out);
187 unsigned finally_spill_count_ = 0;
189 exprt make_finally_rethrow_handler(
const nlohmann::json &element);
191 void emit_else_clause(
192 const nlohmann::json &element,
194 const exprt &no_raise,
205 const exprt &func_call_expr,
206 const exprt &lhs_var,
Definition std_code.h:243
A `switch' instruction */ class code_switcht : public codet { public: inline code_switcht() : codet("...
Definition std_code.h:574
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
python_exception_handler(python_converter &converter, type_handler &type_handler)
Definition python_exception_handler.cpp:25
exprt gen_exception_raise(const std::string &exc, const std::string &message) const
Build a cpp-throw side-effect expression for a named Python exception.
Definition python_exception_handler.cpp:882
void handle_list_assertion(const nlohmann::json &element, const exprt &test, code_blockt &block, const std::function< void(code_assertt &)> &attach_assert_message)
Emit a truthiness assertion on a list value.
Definition python_exception_handler.cpp:758
static bool escape_in_nested_cleanup_children(const nlohmann::json &node, bool in_loop)
escape_in_nested_cleanup_scope's walk over a statement's child bodies.
Definition python_exception_handler.cpp:337
static bool escape_in_nested_cleanup_scope(const nlohmann::json &node, bool in_loop)
True if an escaping return/break/continue sits inside a nested try or with, whose own cleanup must ru...
Definition python_exception_handler.cpp:356
void emit_catch_block(const nlohmann::json &element, const nlohmann::json &type_node, codet &block)
Definition python_exception_handler.cpp:615
void handle_function_call_assertion(const nlohmann::json &element, const exprt &func_call_expr, bool is_negated, code_blockt &block, const std::function< void(code_assertt &)> &attach_assert_message)
Emit an assertion whose condition depends on a function-call result.
Definition python_exception_handler.cpp:818
void get_except_handler_statement(const nlohmann::json &element, codet &block)
Convert a Python except-handler clause.
Definition python_exception_handler.cpp:733
void get_try_statement(const nlohmann::json &element, codet &block)
Convert a Python try/except block.
Definition python_exception_handler.cpp:36
void get_raise_statement(const nlohmann::json &element, codet &block)
Convert a Python raise statement.
Definition python_exception_handler.cpp:477
static bool body_has_escaping_control_flow(const nlohmann::json &node, bool in_loop)
True if node contains a return/break/continue that would transfer control out of an enclosing try (us...
Definition python_exception_handler.cpp:388
Definition type_handler.h:113