![]() |
User Guide
|
Represent symbol in symbol table. More...
Represent symbol in symbol table.
Symbol table generator pass visit the AST and insert symbol for each node into symtab::SymbolTable. Symbol could appear multiple times in a block or different global blocks. NmodlType object has all nmodl properties information.
Definition at line 55 of file symbol.hpp.
#include <symbol.hpp>
Public Member Functions | |
void | read () noexcept |
increment read count More... | |
void | write () noexcept |
increment write count More... | |
bool | is_external_variable () const noexcept |
Check if symbol represent an external variable. More... | |
bool | has_any_property (syminfo::NmodlType new_properties) const noexcept |
check if symbol has any of the given property More... | |
bool | has_all_properties (syminfo::NmodlType new_properties) const noexcept |
check if symbol has all of the given properties More... | |
bool | has_any_status (syminfo::Status new_status) const noexcept |
check if symbol has any of the status More... | |
bool | has_all_status (syminfo::Status new_status) const noexcept |
check if symbol has all of the status More... | |
void | add_properties (syminfo::NmodlType new_properties) noexcept |
add new properties to symbol More... | |
void | add_property (syminfo::NmodlType property) noexcept |
add new property to symbol More... | |
void | remove_property (syminfo::NmodlType property) |
remove property from symbol More... | |
void | mark_inlined () noexcept |
mark symbol as inlined (in case of procedure/function) More... | |
void | mark_created () noexcept |
mark symbol as newly created (in case of new variable) More... | |
void | mark_renamed () noexcept |
void | mark_localized () noexcept |
mark symbol as localized (e.g. from RANGE to LOCAL conversion) More... | |
void | mark_thread_safe () noexcept |
void | created_from_state () noexcept |
mark symbol as newly created variable for the STATE variable this is used with legacy euler/derivimplicit solver where DState variables are created More... | |
bool | is_array () const noexcept |
bool | is_variable () const noexcept |
check if symbol is a variable in nmodl More... | |
std::string | to_string () const |
bool | is_writable () const noexcept |
Ctor & dtor | |
Symbol ()=delete | |
Symbol (std::string name) | |
Symbol (std::string name, ast::Ast *node) | |
Symbol (std::string name, ModToken token) | |
Symbol (std::string name, ast::Ast *node, ModToken token) | |
Setter | |
void | set_scope (const std::string &s) |
void | set_id (int i) noexcept |
void | set_name (const std::string &new_name) |
Set new name for the symbol. More... | |
void | set_order (int new_order) noexcept |
Set order in case of prime/state variable. More... | |
void | set_definition_order (int order) noexcept |
void | set_value (double val) |
void | set_as_array (int len) noexcept |
void | set_num_values (int n) noexcept |
void | set_original_name (const std::string &new_name) |
Getter | |
int | get_length () const noexcept |
int | get_num_values () const noexcept |
const std::string & | get_original_name () const noexcept |
const std::shared_ptr< double > & | get_value () const noexcept |
const std::string & | get_name () const noexcept |
int | get_id () const noexcept |
const std::string & | get_scope () const noexcept |
const syminfo::NmodlType & | get_properties () const noexcept |
const syminfo::Status & | get_status () const noexcept |
void | add_node (ast::Ast *node) noexcept |
const std::vector< ast::Ast * > & | get_nodes () const noexcept |
std::vector< ast::Ast * > | get_nodes_by_type (std::initializer_list< ast::AstNodeType > l) const noexcept |
const ModToken & | get_token () const noexcept |
int | get_read_count () const noexcept |
int | get_write_count () const noexcept |
int | get_definition_order () const noexcept |
Private Attributes | |
std::string | name |
name of the symbol More... | |
std::string | renamed_from |
original name of the symbol if renamed More... | |
int | id = 0 |
unique id or index position when symbol is inserted into specific table More... | |
std::vector< ast::Ast * > | nodes {} |
All given AST nodes for this symbol. More... | |
ModToken | token {} |
token associated with symbol (from node) More... | |
syminfo::NmodlType | properties {syminfo::NmodlType::empty} |
properties of symbol as a result of usage across whole mod file More... | |
syminfo::Status | status {syminfo::Status::empty} |
status of symbol after processing through various passes More... | |
std::string | scope |
scope of the symbol (nmodl block name where it appears) More... | |
int | order = 0 |
order in case of state / prime variable More... | |
int | definition_order = -1 |
order in which symbol appears in the mod file Different variables appear in different blocks (NEURON, PARAMETER, STATE) and accordingly they appear in the data array (in NEURON). More... | |
std::shared_ptr< double > | value |
associated value in case of parameters, constant variable More... | |
bool | array = false |
true if symbol represent array variable More... | |
int | length = 1 |
dimension/length in case of array variable More... | |
int | num_values = 0 |
number of values that variable can take in case of table variable More... | |
int | read_count = 0 |
number of times symbol is read More... | |
int | write_count = 0 |
number of times symbol is written More... | |
|
delete |
|
inlineexplicit |
Definition at line 114 of file symbol.hpp.
|
inline |
Definition at line 117 of file symbol.hpp.
|
inline |
Definition at line 122 of file symbol.hpp.
Definition at line 126 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 243 of file symbol.hpp.
|
inlinenoexcept |
add new properties to symbol
Definition at line 309 of file symbol.hpp.
|
inlinenoexcept |
add new property to symbol
Definition at line 314 of file symbol.hpp.
|
inlinenoexcept |
mark symbol as newly created variable for the STATE variable this is used with legacy euler/derivimplicit solver where DState variables are created
Definition at line 349 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 266 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 227 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 207 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 223 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 247 of file symbol.hpp.
|
noexcept |
Definition at line 52 of file symbol.cpp.
|
inlinenoexcept |
Definition at line 211 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 215 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 235 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 258 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 231 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 239 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 254 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 219 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 262 of file symbol.hpp.
|
inlinenoexcept |
check if symbol has all of the given properties
Definition at line 294 of file symbol.hpp.
|
inlinenoexcept |
check if symbol has all of the status
Definition at line 304 of file symbol.hpp.
|
inlinenoexcept |
check if symbol has any of the given property
Definition at line 289 of file symbol.hpp.
|
inlinenoexcept |
check if symbol has any of the status
Definition at line 299 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 354 of file symbol.hpp.
|
inlinenoexcept |
Check if symbol represent an external variable.
External variables are the variables that are defined in NEURON and available in mod file.
Definition at line 283 of file symbol.hpp.
|
noexcept |
check if symbol is a variable in nmodl
Definition at line 19 of file symbol.cpp.
|
inlinenoexcept |
Definition at line 363 of file symbol.hpp.
|
inlinenoexcept |
mark symbol as newly created (in case of new variable)
Definition at line 329 of file symbol.hpp.
|
inlinenoexcept |
mark symbol as inlined (in case of procedure/function)
Definition at line 324 of file symbol.hpp.
|
inlinenoexcept |
mark symbol as localized (e.g. from RANGE to LOCAL conversion)
Definition at line 338 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 333 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 342 of file symbol.hpp.
|
inlinenoexcept |
increment read count
Definition at line 135 of file symbol.hpp.
|
inline |
remove property from symbol
Definition at line 319 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 189 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 181 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 151 of file symbol.hpp.
|
inline |
Set new name for the symbol.
If symbol is already renamed, do not rename it again as we want to keep track of original name and not intermediate renames
Definition at line 162 of file symbol.hpp.
|
inlinenoexcept |
Definition at line 194 of file symbol.hpp.
|
inlinenoexcept |
Set order in case of prime/state variable.
Prime variable will appear in different block and could have multiple derivative orders. We have to store highest order.
Definition at line 175 of file symbol.hpp.
|
inline |
Definition at line 198 of file symbol.hpp.
|
inline |
Definition at line 147 of file symbol.hpp.
|
inline |
Definition at line 185 of file symbol.hpp.
std::string nmodl::symtab::Symbol::to_string | ( | ) | const |
Definition at line 41 of file symbol.cpp.
|
inlinenoexcept |
increment write count
Definition at line 140 of file symbol.hpp.
|
private |
true if symbol represent array variable
Definition at line 94 of file symbol.hpp.
|
private |
order in which symbol appears in the mod file Different variables appear in different blocks (NEURON, PARAMETER, STATE) and accordingly they appear in the data array (in NEURON).
This order is based on appearance in the mod file.
Definition at line 88 of file symbol.hpp.
|
private |
unique id or index position when symbol is inserted into specific table
Definition at line 63 of file symbol.hpp.
|
private |
dimension/length in case of array variable
Definition at line 97 of file symbol.hpp.
|
private |
name of the symbol
Definition at line 57 of file symbol.hpp.
|
private |
All given AST nodes for this symbol.
Variable can appear multiple times in the mod file.
Definition at line 67 of file symbol.hpp.
|
private |
number of values that variable can take in case of table variable
Definition at line 100 of file symbol.hpp.
|
private |
order in case of state / prime variable
Definition at line 82 of file symbol.hpp.
|
private |
properties of symbol as a result of usage across whole mod file
Definition at line 73 of file symbol.hpp.
|
private |
number of times symbol is read
Definition at line 103 of file symbol.hpp.
|
private |
original name of the symbol if renamed
Definition at line 60 of file symbol.hpp.
|
private |
scope of the symbol (nmodl block name where it appears)
Definition at line 79 of file symbol.hpp.
|
private |
status of symbol after processing through various passes
Definition at line 76 of file symbol.hpp.
|
private |
token associated with symbol (from node)
Definition at line 70 of file symbol.hpp.
|
private |
associated value in case of parameters, constant variable
Definition at line 91 of file symbol.hpp.
|
private |
number of times symbol is written
Definition at line 106 of file symbol.hpp.