User Guide
statement.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 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include "ast/ast_decl.hpp"
23 #include "ast/node.hpp"
24 
25 namespace nmodl::ast {
26 
27 /**
28  * \addtogroup ast_class
29  * \ingroup ast
30  * \{
31  */
32 
33 /**
34  * \brief TODO
35  *
36  *
37 */
38 class Statement : public Node {
39 
40  public:
41  /// \name Ctor & dtor
42  /// \{
43  virtual ~Statement() = default;
44  /// \}
45 
46  /**
47  * \brief Check if the ast node is an instance of ast::Statement
48  * \return true as object is of type ast::Statement
49  */
50  bool is_statement () const noexcept override {
51  return true;
52  }
53 
54  /**
55  * \brief Return a copy of the current node
56  *
57  * Recursively make a new copy/clone of the current node including
58  * all members and return a pointer to the node. This is used for
59  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
60  * ast.
61  *
62  * \return pointer to the clone/copy of the current node
63  */
64  // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
65  virtual Statement* clone() const override {
66  return new Statement(*this);
67  }
68  // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
69 
70  /// \name Getters
71  /// \{
72 
73  /**
74  * \brief Return type (ast::AstNodeType) of ast node
75  *
76  * Every node in the ast has a type defined in ast::AstNodeType and this
77  * function is used to retrieve the same.
78  *
79  * \return ast node type i.e. ast::AstNodeType::STATEMENT
80  *
81  * \sa Ast::get_node_type_name
82  */
83  virtual AstNodeType get_node_type() const noexcept override {
85  }
86 
87  /**
88  * \brief Return type (ast::AstNodeType) of ast node as std::string
89  *
90  * Every node in the ast has a type defined in ast::AstNodeType.
91  * This type name can be returned as a std::string for printing
92  * node to text/json form.
93  *
94  * \return name of the node type as a string i.e. "Statement"
95  *
96  * \sa Ast::get_node_name
97  */
98  virtual std::string get_node_type_name() const noexcept override {
99  return "Statement";
100  }
101 
102 
103  /**
104  * \brief Get std::shared_ptr from `this` pointer of the current ast node
105  */
106  virtual std::shared_ptr<Ast> get_shared_ptr() override {
107  return std::static_pointer_cast<Statement>(shared_from_this());
108  }
109 
110  /**
111  * \brief Get std::shared_ptr from `this` pointer of the current ast node
112  */
113  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
114  return std::static_pointer_cast<const Statement>(shared_from_this());
115  }
116 
117  /// \}
118 
119 
120 
121  /// \name Visitor
122  /// \{
123  /**
124  * \brief visit children i.e. member variables of current node using provided visitor
125  *
126  * Different nodes in the AST have different members (i.e. children). This method
127  * recursively visits children using provided visitor.
128  *
129  * \param v Concrete visitor that will be used to recursively visit children
130  *
131  * \sa Ast::visit_children for example.
132  */
133  virtual void visit_children(visitor::Visitor& v) override;
134 
135  /**
136  * \brief visit children i.e. member variables of current node using provided visitor
137  *
138  * Different nodes in the AST have different members (i.e. children). This method
139  * recursively visits children using provided visitor.
140  *
141  * \param v Concrete constant visitor that will be used to recursively visit children
142  *
143  * \sa Ast::visit_children for example.
144  */
145  virtual void visit_children(visitor::ConstVisitor& v) const override;
146 
147  /**
148  * \brief accept (or visit) the current AST node using provided visitor
149  *
150  * Instead of visiting children of AST node, like Ast::visit_children,
151  * accept allows to visit the current node itself using provided concrete
152  * visitor.
153  *
154  * \param v Concrete visitor that will be used to recursively visit node
155  *
156  * \sa Ast::accept for example.
157  */
158  virtual void accept(visitor::Visitor& v) override;
159 
160  /**
161  * \copydoc accept(visitor::Visitor&)
162  */
163  virtual void accept(visitor::ConstVisitor& v) const override;
164  /// \}
165 
166 };
167 
168 /** \} */ // end of ast_class
169 
170 
171 } // namespace nmodl::ast
nmodl::visitor::ConstVisitor
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:298
nmodl::ast::Node
Base class for all AST node.
Definition: node.hpp:40
nmodl::ast::Statement::~Statement
virtual ~Statement()=default
node.hpp
Auto generated AST classes declaration.
ast_decl.hpp
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::ast
Abstract Syntax Tree (AST) related implementations.
Definition: ast_common.hpp:29
nmodl::ast::Statement::visit_children
virtual void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:344
nmodl::ast::Statement::accept
virtual void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:350
nmodl::ast::AstNodeType
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:164
nmodl::ast::Statement::get_node_type
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: statement.hpp:83
nmodl::visitor::Visitor
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
nmodl::ast::Statement::is_statement
bool is_statement() const noexcept override
Check if the ast node is an instance of ast::Statement.
Definition: statement.hpp:50
nmodl::ast::Statement::get_node_type_name
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: statement.hpp:98
nmodl::ast::Statement::get_shared_ptr
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: statement.hpp:113
nmodl::ast::Statement
TODO.
Definition: statement.hpp:38
nmodl::ast::AstNodeType::STATEMENT
@ STATEMENT
type of ast::Statement
nmodl::ast::Statement::clone
virtual Statement * clone() const override
Return a copy of the current node.
Definition: statement.hpp:65
nmodl::ast::Statement::get_shared_ptr
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: statement.hpp:106