User Guide
nmodl::details Namespace Reference

details of lexer tokens More...

Detailed Description

details of lexer tokens

Classes

class  MethodInfo
 Information about integration method. More...
 

Functions

bool needs_neuron_thread_first_arg (const std::string &token)
 Checks if token is one of the functions coming from NEURON/CoreNEURON and needs passing NrnThread* as first argument (typical name of variable nt) More...
 
TokenType keyword_type (const std::string &name)
 Return token type for the keyword. More...
 

Variables

const static std::map< std::string, TokenTypekeywords
 Keywords from NMODL language. More...
 
const static std::map< std::string, MethodInfomethods
 Integration methods available in the NMODL. More...
 
const static std::vector< std::string > extern_definitions
 
const static std::vector< std::string > need_nt = {"at_time"}
 
static const std::vector< std::string > NEURON_VARIABLES
 Variables from NEURON that are directly used in NMODL. More...
 

Function Documentation

◆ keyword_type()

TokenType nmodl::details::keyword_type ( const std::string &  name)

Return token type for the keyword.

Definition at line 252 of file token_mapping.cpp.

◆ needs_neuron_thread_first_arg()

bool nmodl::details::needs_neuron_thread_first_arg ( const std::string &  token)

Checks if token is one of the functions coming from NEURON/CoreNEURON and needs passing NrnThread* as first argument (typical name of variable nt)

Parameters
tokenName of function
Returns
True or false depending if the function needs NrnThread* argument

Definition at line 235 of file token_mapping.cpp.

Variable Documentation

◆ extern_definitions

const static std::vector<std::string> nmodl::details::extern_definitions
static

Definition at line 158 of file token_mapping.cpp.

◆ keywords

const static std::map<std::string, TokenType> nmodl::details::keywords
static

Keywords from NMODL language.

Keywords are defined with key-value pair where key is name from scanner and value is token type used in parser.

Todo:
Some keywords have different token names, e.g. TITLE keyword has MODEL as a keyword. These token names are used in multiple context and hence we are keeping original names. Once we finish code generation part then we change this.

Definition at line 36 of file token_mapping.cpp.

◆ methods

const static std::map<std::string, MethodInfo> nmodl::details::methods
static
Initial value:
= {{"runge", MethodInfo(DERF | KINF, 0)},
{"euler", MethodInfo(DERF | KINF, 0)},
{"newton", MethodInfo(NLINF, 0)},
{"simeq", MethodInfo(LINF, 0)},
{"_advance", MethodInfo(KINF, 0)},
{"sparse", MethodInfo(KINF, 0)},
{"derivimplicit", MethodInfo(DERF, 0)},
{"cnexp", MethodInfo(DERF, 0)},
{"after_cvode", MethodInfo(0, 0)},
{"cvode_t", MethodInfo(0, 0)},
{"cvode_t_v", MethodInfo(0, 0)}}

Integration methods available in the NMODL.

Different integration methods are available in NMODL and they are used with different block types in NMODL. This variable provide list of method names, which blocks they can be used with and whether it is usable with variable timestep.

Todo:
MethodInfo::subtype should be changed from integer flag to proper type

Definition at line 146 of file token_mapping.cpp.

◆ need_nt

const static std::vector<std::string> nmodl::details::need_nt = {"at_time"}
static

Definition at line 226 of file token_mapping.cpp.

◆ NEURON_VARIABLES

const std::vector<std::string> nmodl::details::NEURON_VARIABLES
static
Initial value:
=
{"t", "dt", "celsius", "v", "diam", "area", "pi", "secondorder"}

Variables from NEURON that are directly used in NMODL.

NEURON exposes certain variable that can be directly used in NMODLvar. The passes like scope checker needs to know if certain variable is undefined and hence these needs to be inserted into symbol table

Definition at line 247 of file token_mapping.cpp.

LINF
#define LINF
Definition: modl.h:25
NLINF
#define NLINF
Definition: modl.h:26
DERF
#define DERF
bit masks for block types where integration method are used
Definition: modl.h:23
KINF
#define KINF
Definition: modl.h:24