14 #include "utils/logger.hpp"
21 if (
node.get_statements().empty()) {
25 auto current_symtab =
node.get_symbol_table();
26 if (current_symtab !=
nullptr) {
36 for (
const auto& item:
node.get_statements()) {
53 bool rename_plausible =
false;
57 rename_plausible =
true;
61 rename_plausible =
true;
65 rename_plausible =
true;
67 if (rename_plausible) {
69 if (symbol !=
nullptr) {
72 logger->info(
"could not find {} definition in nmodl",
name);
82 const auto& statement =
node.get_statement();
83 const auto&
text = statement->eval();
87 const auto& tokens =
driver.all_tokens();
89 std::ostringstream oss;
90 for (
const auto& token: tokens) {
93 statement->set(oss.str());
Represents block encapsulating list of statements.
Represents a C code block.
Class that binds all pieces together for parsing C verbatim blocks.
std::shared_ptr< Symbol > lookup_in_scope(const std::string &name) const
check if symbol with given name exist in the current table (including all parents)
const std::string RANGE_PREFIX
prefix used for range variables
std::stack< symtab::SymbolTable * > symtab_stack
symbol tables in nested blocks
symtab::SymbolTable * symtab
non-null symbol table in the scope hierarchy
void visit_statement_block(ast::StatementBlock &node) override
visit node of type ast::StatementBlock
const std::string LOCAL_PREFIX
prefix used for local variable
const std::string ION_PREFIX
prefix used for range variables
std::string rename_variable(const std::string &name)
Rename variable used in verbatim block if defined in NMODL scope.
void visit_verbatim(ast::Verbatim &node) override
Parse verbatim blocks and rename variables used.
encapsulates code generation backend implementations
static Node * node(Object *)
Auto generated AST classes declaration.
Auto generated AST classes declaration.
nmodl::parser::UnitDriver driver
Auto generated AST classes declaration.
Rename variable in verbatim block.