User Guide
codegen_transform_visitor.cpp
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 #include <memory>
9 
10 #include "ast/ast_decl.hpp"
11 #include "ast/function_block.hpp"
12 #include "ast/string.hpp"
13 #include "ast/table_statement.hpp"
16 
17 namespace nmodl {
18 using namespace ast;
19 
21  auto table_statements = collect_nodes(node, {AstNodeType::TABLE_STATEMENT});
22  for (auto t: table_statements) {
23  auto t_ = std::dynamic_pointer_cast<TableStatement>(t);
24  t_->set_table_vars(
25  {std::make_shared<Name>(std::make_shared<String>(node.get_node_name()))});
26  }
27 }
28 } // namespace nmodl
nmodl::CodegenTransformVisitor::visit_function_block
void visit_function_block(ast::FunctionBlock &node) override
visit node of type ast::FunctionBlock
Definition: codegen_transform_visitor.cpp:20
nmodl::ast::FunctionBlock
TODO.
Definition: function_block.hpp:39
ast_decl.hpp
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
string.hpp
Auto generated AST classes declaration.
visitor_utils.hpp
Utility functions for visitors implementation.
codegen_transform_visitor.hpp
nmodl::collect_nodes
std::vector< std::shared_ptr< const ast::Ast > > collect_nodes(const ast::Ast &node, const std::vector< ast::AstNodeType > &types)
traverse node recursively and collect nodes of given types
Definition: visitor_utils.cpp:206
function_block.hpp
Auto generated AST classes declaration.
nmodl::ast::FunctionBlock::get_node_name
std::string get_node_name() const override
Return name of the node.
Definition: ast.cpp:3967
table_statement.hpp
Auto generated AST classes declaration.
nmodl::ast::AstNodeType::TABLE_STATEMENT
@ TABLE_STATEMENT
type of ast::TableStatement