6 #ifndef SRC_BPP_INCLUDE_BPP_CODEGEN_H_
7 #define SRC_BPP_INCLUDE_BPP_CODEGEN_H_
13 #include <antlr4-runtime.h>
16 #include "../antlr/BashppLexer.h"
17 #include "../internal_error.h"
22 class bash_while_condition;
55 const std::string& code_to_run,
56 bool in_while_condition,
57 std::shared_ptr<bash_while_condition> current_while_condition,
58 std::shared_ptr<bpp::bpp_program> program
62 std::shared_ptr<bpp_object>
object,
63 const std::string& object_ref,
64 std::shared_ptr<bpp::bpp_program> program
68 const std::string& reference_code,
69 const std::string& method_name,
70 std::shared_ptr<bpp_class> assumed_class,
71 bool force_static_reference,
72 std::shared_ptr<bpp::bpp_program> program
76 const std::string& reference_code,
77 const std::string& class_name,
78 std::shared_ptr<bpp::bpp_program> program
82 const std::string& new_address,
83 std::shared_ptr<bpp::bpp_class> new_class
88 std::shared_ptr<bpp::bpp_entity>
entity;
96 antlr4::tree::TerminalNode*
token =
nullptr;
99 std::optional<reference_error>
error;
103 std::shared_ptr<bpp::bpp_code_entity> context,
104 std::deque<antlr4::tree::TerminalNode*> identifiers,
105 std::shared_ptr<bpp::bpp_class> current_class,
106 std::shared_ptr<bpp::bpp_program> program
Definition: bash_case.cpp:8
code_segment generate_supershell_code(const std::string &code_to_run, bool in_while_condition, std::shared_ptr< bash_while_condition > current_while_condition, std::shared_ptr< bpp::bpp_program > program)
Generates a supershell code segment for executing a bash command.
Definition: bpp_codegen.cpp:27
code_segment generate_dynamic_cast_code(const std::string &reference_code, const std::string &class_name, std::shared_ptr< bpp::bpp_program > program)
Generates a code segment for performing a dynamic cast.
Definition: bpp_codegen.cpp:170
entity_reference resolve_reference(std::shared_ptr< bpp::bpp_code_entity > context, std::deque< antlr4::tree::TerminalNode * > identifiers, std::shared_ptr< bpp::bpp_class > current_class, std::shared_ptr< bpp::bpp_program > program)
Resolves a reference to an entity in a particular context.
Definition: bpp_codegen.cpp:275
code_segment generate_delete_code(std::shared_ptr< bpp::bpp_object > object, const std::string &object_ref, std::shared_ptr< bpp::bpp_program > program)
Generates a code segment for deleting an object.
Definition: bpp_codegen.cpp:75
code_segment generate_method_call_code(const std::string &reference_code, const std::string &method_name, std::shared_ptr< bpp::bpp_class > assumed_class, bool force_static_reference, std::shared_ptr< bpp::bpp_program > program)
Generates a code segment for calling a method.
Definition: bpp_codegen.cpp:113
code_segment inline_new(const std::string &new_address, std::shared_ptr< bpp::bpp_class > new_class)
Generates a code segment to INLINE class's "new" function within a method.
Definition: bpp_codegen.cpp:211
A struct to hold (compiled) code segments.
Definition: bpp_codegen.h:39
std::string full_code() const
Return the full code segment as a single string.
Definition: bpp_codegen.h:49
std::string post_code
Definition: bpp_codegen.h:42
std::string code
Definition: bpp_codegen.h:41
std::string pre_code
Definition: bpp_codegen.h:40
Definition: bpp_codegen.h:94
std::string message
Definition: bpp_codegen.h:95
antlr4::tree::TerminalNode * token
Definition: bpp_codegen.h:96
Definition: bpp_codegen.h:87
bool created_first_temporary_variable
Definition: bpp_codegen.h:90
std::shared_ptr< bpp::bpp_class > class_containing_the_method
Definition: bpp_codegen.h:92
std::shared_ptr< bpp::bpp_entity > entity
Definition: bpp_codegen.h:88
bool created_second_temporary_variable
Definition: bpp_codegen.h:91
code_segment reference_code
Definition: bpp_codegen.h:89
std::optional< reference_error > error
Definition: bpp_codegen.h:99