User Guide
implicit_argument_visitor.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Blue Brain Project, EPFL.
3  * See the top-level LICENSE file for details.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #pragma once
9 
10 /**
11  * \file
12  * \brief \copybrief nmodl::visitor::ImplicitArgumentVisitor
13  */
14 
15 #include "visitors/ast_visitor.hpp"
16 
17 #include <string>
18 
19 
20 namespace nmodl {
21 namespace visitor {
22 
23 /**
24  * \addtogroup visitor_classes
25  * \{
26  */
27 
28 /**
29  * \class ImplicitArgumentVisitor
30  * \brief %Visitor for adding implicit arguments to [Core]NEURON functions.
31  *
32  * This visitor is used to add implicit arguments to functions (nrn_ghk, ...)
33  * that have historially been used in MOD files with "fewer" arguments and
34  * relied on global state, but which now need "more" arguments to be passed so
35  * that they can be pure functions.
36  */
38  explicit ImplicitArgumentVisitor(const std::string& simulator = "coreneuron")
39  : simulator(simulator) {}
40 
41  void visit_function_call(ast::FunctionCall& node) override;
42 
43  private:
44  std::string simulator;
45 };
46 
47 /** \} */ // end of visitor_classes
48 
49 } // namespace visitor
50 } // namespace nmodl
nmodl
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
nmodl::visitor::ImplicitArgumentVisitor::ImplicitArgumentVisitor
ImplicitArgumentVisitor(const std::string &simulator="coreneuron")
Definition: implicit_argument_visitor.hpp:38
nmodl::ast::FunctionCall
TODO.
Definition: function_call.hpp:38
nmodl::visitor::AstVisitor
Concrete visitor for all AST classes.
Definition: ast_visitor.hpp:37
nmodl::visitor::ImplicitArgumentVisitor::simulator
std::string simulator
Definition: implicit_argument_visitor.hpp:44
nmodl::visitor::ImplicitArgumentVisitor::visit_function_call
void visit_function_call(ast::FunctionCall &node) override
visit node of type ast::FunctionCall
Definition: implicit_argument_visitor.cpp:18
nmodl::visitor::ImplicitArgumentVisitor
Visitor for adding implicit arguments to [Core]NEURON functions.
Definition: implicit_argument_visitor.hpp:37
ast_visitor.hpp
Concrete visitor for all AST classes.