User Guide
nmodl::symtab::syminfo Namespace Reference

Symbol information More...

Detailed Description

Symbol information

Typedefs

using enum_type = long long
 

Enumerations

enum  DeclarationType : enum_type { DeclarationType::variable, DeclarationType::function }
 kind of symbol More...
 
enum  Scope : enum_type { Scope::local, Scope::global, Scope::neuron, Scope::external }
 scope within a mod file More...
 
enum  Status : enum_type {
  Status::empty = 0, Status::localized = 1LL << 0, Status::globalized = 1LL << 1, Status::inlined = 1LL << 2,
  Status::renamed = 1LL << 3, Status::created = 1LL << 4, Status::from_state = 1LL << 5, Status::thread_safe = 1LL << 6
}
 state during various compiler passes More...
 
enum  VariableType : enum_type { VariableType::scalar, VariableType::array }
 usage of mod file as array or scalar More...
 
enum  Access : enum_type { Access::read = 1LL << 0, Access::write = 1LL << 1 }
 variable usage within a mod file More...
 
enum  NmodlType : enum_type {
  NmodlType::empty = 0, NmodlType::local_var = 1LL << 0, NmodlType::global_var = 1LL << 1, NmodlType::range_var = 1LL << 2,
  NmodlType::param_assign = 1LL << 3, NmodlType::pointer_var = 1LL << 4, NmodlType::bbcore_pointer_var = 1LL << 5, NmodlType::extern_var = 1LL << 6,
  NmodlType::prime_name = 1LL << 7, NmodlType::assigned_definition = 1LL << 8, NmodlType::unit_def = 1LL << 9, NmodlType::read_ion_var = 1LL << 10,
  NmodlType::write_ion_var = 1LL << 11, NmodlType::nonspecific_cur_var = 1LL << 12, NmodlType::electrode_cur_var = 1LL << 13, NmodlType::argument = 1LL << 14,
  NmodlType::function_block = 1LL << 15, NmodlType::procedure_block = 1LL << 16, NmodlType::derivative_block = 1LL << 17, NmodlType::linear_block = 1LL << 18,
  NmodlType::non_linear_block = 1LL << 19, NmodlType::constant_var = 1LL << 20, NmodlType::kinetic_block = 1LL << 21, NmodlType::function_table_block = 1LL << 22,
  NmodlType::factor_def = 1LL << 23, NmodlType::extern_neuron_variable = 1LL << 24, NmodlType::extern_method = 1LL << 25, NmodlType::state_var = 1LL << 26,
  NmodlType::to_solve = 1LL << 27, NmodlType::useion = 1LL << 28, NmodlType::table_statement_var = 1LL << 29, NmodlType::table_assigned_var = 1LL << 30,
  NmodlType::discrete_block = 1LL << 31, NmodlType::define = 1LL << 32, NmodlType::codegen_var = 1LL << 33, NmodlType::random_var = 1LL << 34,
  NmodlType::use_range_ptr_var = 1LL << 35
}
 NMODL variable properties. More...
 

Functions

std::vector< std::string > to_string_vector (const syminfo::NmodlType &obj)
 helper function to convert nmodl properties to string More...
 
std::vector< std::string > to_string_vector (const syminfo::Status &obj)
 helper function to convert symbol status to string More...
 
std::ostream & operator<< (std::ostream &os, const NmodlType &obj)
 
std::ostream & operator<< (std::ostream &os, const Status &obj)
 
template<typename T >
operator~ (T arg)
 
template<typename T >
operator| (T lhs, T rhs)
 
template<typename T >
operator& (T lhs, T rhs)
 
template<typename T >
T & operator|= (T &lhs, T rhs)
 
template<typename T >
T & operator&= (T &lhs, T rhs)
 
bool has_property (const NmodlType &obj, NmodlType property)
 check if any property is set More...
 
bool has_status (const Status &obj, Status state)
 check if any status is set More...
 
template<typename T >
std::string to_string (const T &obj)
 

Typedef Documentation

◆ enum_type

using nmodl::symtab::syminfo::enum_type = typedef long long
Todo:
Error with pybind if std::underlying_typ is used

Definition at line 27 of file symbol_properties.hpp.

Enumeration Type Documentation

◆ Access

variable usage within a mod file

Enumerator
read 

variable is ready only

write 

variable is written only

Definition at line 89 of file symbol_properties.hpp.

◆ DeclarationType

kind of symbol

Enumerator
variable 

variable

function 

function

Definition at line 30 of file symbol_properties.hpp.

◆ NmodlType

NMODL variable properties.

Certain variables/symbols specified in various places in the same mod file. For example, RANGE variable could be in PARAMETER bloc, ASSIGNED block etc. In this case, the symbol in global scope need to have multiple properties. This is also important while code generation. Hence, in addition to AST node pointer, we define NmodlType so that we can set multiple properties. Note that AST pointer is no longer pointing to all pointers. Same applies for ModToken.

These is some redundancy between NmodlType and other enums like syminfo::DeclarationType and syminfo::Scope. But as AST will become more abstract from NMODL (towards C/C++) then other types will be useful.

Todo:
  • Rename param_assign to parameter_var
Enumerator
empty 
local_var 

Local Variable.

global_var 

Global Variable.

range_var 

Range Variable.

param_assign 

Parameter Variable.

pointer_var 

Pointer Type.

bbcore_pointer_var 

Bbcorepointer Type.

extern_var 

Extern Type.

prime_name 

Prime Type.

assigned_definition 

Assigned Definition.

unit_def 

Unit Def.

read_ion_var 

Read Ion.

write_ion_var 

Write Ion.

nonspecific_cur_var 

Non Specific Current.

electrode_cur_var 

Electrode Current.

argument 

Argument Type.

function_block 

Function Type.

procedure_block 

Procedure Type.

derivative_block 

Derivative Block.

linear_block 

Linear Block.

non_linear_block 

NonLinear Block.

constant_var 

constant variable

kinetic_block 

Kinetic Block.

function_table_block 

FunctionTable Block.

factor_def 

factor in unit block

extern_neuron_variable 

neuron variable accessible in mod file

extern_method 

neuron solver methods and math functions

state_var 

state variable

to_solve 

need to solve : used in solve statement

useion 

ion type

table_statement_var 

variable is used in table statement

table_assigned_var 

variable is used in table as assigned

discrete_block 

Discrete Block.

define 

Define variable / macro.

codegen_var 

Codegen specific variable.

random_var 

Randomvar Type.

use_range_ptr_var 

FUNCTION or PROCEDURE needs setdata check.

Definition at line 116 of file symbol_properties.hpp.

◆ Scope

scope within a mod file

Enumerator
local 

local variable

global 

global variable

neuron 

neuron variable

external 

extern variable

Definition at line 39 of file symbol_properties.hpp.

◆ Status

state during various compiler passes

Enumerator
empty 
localized 

converted to local

globalized 

converted to global

inlined 

inlined

renamed 

renamed

created 

created

from_state 

derived from state

thread_safe 

variable marked as thread safe

Definition at line 54 of file symbol_properties.hpp.

◆ VariableType

usage of mod file as array or scalar

Enumerator
scalar 

scalar / single value

array 

vector type

Definition at line 80 of file symbol_properties.hpp.

Function Documentation

◆ has_property()

bool nmodl::symtab::syminfo::has_property ( const NmodlType obj,
NmodlType  property 
)
inline

check if any property is set

Definition at line 260 of file symbol_properties.hpp.

◆ has_status()

bool nmodl::symtab::syminfo::has_status ( const Status obj,
Status  state 
)
inline

check if any status is set

Definition at line 265 of file symbol_properties.hpp.

◆ operator&()

template<typename T >
T nmodl::symtab::syminfo::operator& ( lhs,
rhs 
)
inline

Definition at line 242 of file symbol_properties.hpp.

◆ operator&=()

template<typename T >
T& nmodl::symtab::syminfo::operator&= ( T &  lhs,
rhs 
)
inline

Definition at line 254 of file symbol_properties.hpp.

◆ operator<<() [1/2]

std::ostream & nmodl::symtab::syminfo::operator<< ( std::ostream &  os,
const NmodlType obj 
)

Definition at line 211 of file symbol_properties.cpp.

◆ operator<<() [2/2]

std::ostream & nmodl::symtab::syminfo::operator<< ( std::ostream &  os,
const Status obj 
)

Definition at line 215 of file symbol_properties.cpp.

◆ operator|()

template<typename T >
T nmodl::symtab::syminfo::operator| ( lhs,
rhs 
)
inline

Definition at line 236 of file symbol_properties.hpp.

◆ operator|=()

template<typename T >
T& nmodl::symtab::syminfo::operator|= ( T &  lhs,
rhs 
)
inline

Definition at line 248 of file symbol_properties.hpp.

◆ operator~()

template<typename T >
T nmodl::symtab::syminfo::operator~ ( arg)
inline

Definition at line 230 of file symbol_properties.hpp.

◆ to_string()

template<typename T >
std::string nmodl::symtab::syminfo::to_string ( const T &  obj)

Definition at line 279 of file symbol_properties.hpp.

◆ to_string_vector() [1/2]

std::vector< std::string > nmodl::symtab::syminfo::to_string_vector ( const NmodlType obj)

helper function to convert nmodl properties to string

Definition at line 23 of file symbol_properties.cpp.

◆ to_string_vector() [2/2]

std::vector< std::string > nmodl::symtab::syminfo::to_string_vector ( const Status obj)

helper function to convert symbol status to string

Definition at line 175 of file symbol_properties.cpp.