![Logo](logo.png) |
User Guide
|
Go to the documentation of this file.
17 #include <unordered_map>
46 std::shared_ptr<ast::Program>
ast;
78 const std::string& old_name,
79 std::string new_var_name_or_prefix,
97 void set(
const std::string& old_name, std::string new_name) {
bool add_prefix
add prefix to variable name
Represents a C code block.
Concrete constant visitor for all AST classes.
encapsulates code generation backend implementations
void visit_name(const ast::Name &node) override
rename matching variable
RenameVisitor(const std::string &old_name, std::string new_name)
void visit_prime_name(const ast::PrimeName &node) override
Prime name has member order which is an integer.
void enable_verbatim(bool state) noexcept
RenameVisitor(std::shared_ptr< ast::Program > ast, const std::string &old_name, std::string new_var_name_or_prefix, bool add_prefix, bool add_random_suffix)
bool rename_verbatim
rename verbatim blocks as well
std::string new_var_name
new name
bool add_random_suffix
add random suffix
std::unordered_map< std::string, std::string > renamed_variables
Map that keeps the renamed variables to keep the same random suffix when a variable is renamed across...
Represents a prime variable (for ODE)
Blindly rename given variable to new name
void set(const std::string &old_name, std::string new_name)
std::string new_var_name_prefix
variable prefix
std::string new_name_generator(const std::string &old_name)
Check if variable is already renamed and use the same naming otherwise add the new_name to the rename...
std::regex var_name_regex
regex for searching which variables to replace
void visit_verbatim(const ast::Verbatim &node) override
Parse verbatim blocks and rename variable if it is used.
std::shared_ptr< ast::Program > ast
ast::Ast* node
Concrete visitor for all AST classes.