User Guide
|
Rename variable in verbatim block. More...
Rename variable in verbatim block.
Verbatim blocks in NMODL use different names for local and range variables:
xx
then translated name of variable in C file is _lxx
xx
then translated name of the variable is _p_xx
This naming convention is based on NEURON code generation convention. As part of this pass, we revert such usages of the variable to original names. We do this only if variable is present in symbol table.
Definition at line 47 of file verbatim_var_rename_visitor.hpp.
#include <verbatim_var_rename_visitor.hpp>
Private Member Functions | |
std::string | rename_variable (const std::string &name) |
Rename variable used in verbatim block if defined in NMODL scope. More... | |
Private Attributes | |
symtab::SymbolTable * | symtab = nullptr |
non-null symbol table in the scope hierarchy More... | |
std::stack< symtab::SymbolTable * > | symtab_stack |
symbol tables in nested blocks More... | |
const std::string | LOCAL_PREFIX = "_l" |
prefix used for local variable More... | |
const std::string | RANGE_PREFIX = "_p_" |
prefix used for range variables More... | |
const std::string | ION_PREFIX = "_ion_" |
prefix used for range variables More... | |
|
default |
|
private |
Rename variable used in verbatim block if defined in NMODL scope.
Check if variable is candidate for renaming and check if it is defined in the nmodl blocks. If so, return "original" name of the variable.
Definition at line 52 of file verbatim_var_rename_visitor.cpp.
|
overridevirtual |
visit node of type ast::StatementBlock
go back to previous block in hierarchy
Implements nmodl::visitor::Visitor.
Definition at line 20 of file verbatim_var_rename_visitor.cpp.
|
overridevirtual |
Parse verbatim blocks and rename variables used.
Implements nmodl::visitor::Visitor.
Definition at line 81 of file verbatim_var_rename_visitor.cpp.
|
private |
prefix used for range variables
Definition at line 62 of file verbatim_var_rename_visitor.hpp.
|
private |
prefix used for local variable
Definition at line 56 of file verbatim_var_rename_visitor.hpp.
|
private |
prefix used for range variables
Definition at line 59 of file verbatim_var_rename_visitor.hpp.
|
private |
non-null symbol table in the scope hierarchy
Definition at line 50 of file verbatim_var_rename_visitor.hpp.
|
private |
symbol tables in nested blocks
Definition at line 53 of file verbatim_var_rename_visitor.hpp.