13 #include "utils/logger.hpp"
23 const auto& args =
node.get_arguments();
24 const auto& lhs = args[0];
25 const auto&
rhs = args[1];
33 node.visit_children(*
this);
43 const auto& statements =
node.get_statements();
44 for (
const auto& statement: statements) {
45 auto current_statement = statement;
47 for (
const auto& hit: hits) {
48 const auto& fn_call = std::dynamic_pointer_cast<ast::FunctionCall>(hit);
49 if (fn_call->get_name()->get_node_name() ==
52 logger->info(
"Converting {} to {}",
57 new_statements.push_back(current_statement);
59 node.set_statements(new_statements);
61 node.visit_children(*
this);
Auto generated AST classes declaration.
Represents block encapsulating list of statements.
void visit_statement_block(ast::StatementBlock &node) override
visit node of type ast::StatementBlock
void visit_net_receive_block(ast::NetReceiveBlock &node) override
visit node of type ast::NetReceiveBlock
bool in_net_receive_block
true if we are visiting a NET_RECEIVE block
@ FUNCTION_CALL
type of ast::FunctionCall
std::vector< std::shared_ptr< Statement > > StatementVector
static constexpr char NRN_STATE_DISC_METHOD[]
state_discontinuity function in nmodl
std::shared_ptr< Statement > create_statement(const std::string &code_statement)
Convert given code statement (in string format) to corresponding ast node.
static auto convert_state_discontinuity(const ast::FunctionCall &node)
encapsulates code generation backend implementations
std::vector< std::shared_ptr< const ast::Ast > > collect_nodes(const ast::Ast &node, const std::vector< ast::AstNodeType > &types)
traverse node recursively and collect nodes of given types
std::string to_nmodl(const ast::Ast &node, const std::set< ast::AstNodeType > &exclude_types)
Given AST node, return the NMODL string representation.
static Node * node(Object *)
Visitor used for replacing literal calls to state_discontinuity in a NET_RECEIVE block.
Utility functions for visitors implementation.