diff -ru ast.orig/after_block.hpp ast/after_block.hpp --- ast.orig/after_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/after_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -54,31 +52,21 @@ class AfterBlock : public Block { private: /// Block to be called after - std::shared_ptr bablock; + std::shared_ptr bablock; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit AfterBlock(BABlock* bablock); - explicit AfterBlock(std::shared_ptr bablock); + explicit AfterBlock(const std::shared_ptr& bablock); AfterBlock(const AfterBlock& obj); - - - virtual ~AfterBlock() = default; - + virtual ~AfterBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::AfterBlock * \return true as object is of type ast::AfterBlock @@ -95,7 +83,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) AfterBlock* clone() const override { @@ -164,92 +152,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref AfterBlock.bablock - */ - std::shared_ptr get_bablock() const noexcept { - return bablock; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref AfterBlock.bablock + */ + const std::shared_ptr& get_bablock() const noexcept { + return bablock; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref AfterBlock.bablock (rvalue reference) + */ + void set_bablock(std::shared_ptr&& bablock); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref AfterBlock.bablock (rvalue reference) - */ - void set_bablock(std::shared_ptr&& bablock); - - /** - * \brief Setter for member variable \ref AfterBlock.bablock - */ - void set_bablock(const std::shared_ptr& bablock); - + /** + * \brief Setter for member variable \ref AfterBlock.bablock + */ + void set_bablock(const std::shared_ptr& bablock); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -291,11 +263,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -307,7 +276,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/argument.hpp ast/argument.hpp --- ast.orig/argument.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/argument.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -51,31 +49,21 @@ class Argument : public Identifier { private: /// Name of the argument - std::shared_ptr name; + std::shared_ptr name; /// Unit of the argument - std::shared_ptr unit; + std::shared_ptr unit; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Argument(Identifier* name, Unit* unit); - explicit Argument(std::shared_ptr name, std::shared_ptr unit); + explicit Argument(const std::shared_ptr& name, const std::shared_ptr& unit); Argument(const Argument& obj); - - - virtual ~Argument() = default; - + virtual ~Argument() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Argument * \return true as object is of type ast::Argument @@ -92,7 +80,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Argument* clone() const override { @@ -147,101 +135,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref Argument.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref Argument.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Argument.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref Argument.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Argument.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref Argument.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Argument.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref Argument.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Argument.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref Argument.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref Argument.unit - */ - void set_unit(const std::shared_ptr& unit); - + /** + * \brief Setter for member variable \ref Argument.unit + */ + void set_unit(const std::shared_ptr& unit); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -283,11 +252,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -299,7 +265,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/assigned_block.hpp ast/assigned_block.hpp --- ast.orig/assigned_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/assigned_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/assigned_definition.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -57,30 +55,20 @@ class AssignedBlock : public Block { private: /// Vector of assigned variables - AssignedDefinitionVector definitions; + AssignedDefinitionVector definitions; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit AssignedBlock(AssignedDefinitionVector definitions); + explicit AssignedBlock(const AssignedDefinitionVector& definitions); AssignedBlock(const AssignedBlock& obj); - - - virtual ~AssignedBlock() = default; - + virtual ~AssignedBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::AssignedBlock * \return true as object is of type ast::AssignedBlock @@ -97,7 +85,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) AssignedBlock* clone() const override { @@ -166,140 +154,124 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - -/** - * \brief Add member to definitions by raw pointer - */ -void emplace_back_assigned_definition(AssignedDefinition *n); - -/** - * \brief Add member to definitions by shared_ptr - */ -void emplace_back_assigned_definition(std::shared_ptr n); - -/** - * \brief Erase member to definitions - */ -AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first); - -/** - * \brief Erase members to definitions - */ -AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first, AssignedDefinitionVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to definitions - * - * loosely following the cpp reference of remove_if - */ -size_t erase_assigned_definition(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + /** + * \brief Add member to definitions by raw pointer + */ + void emplace_back_assigned_definition(AssignedDefinition *n); -/** - * \brief Insert member to definitions - */ -AssignedDefinitionVector::const_iterator insert_assigned_definition(AssignedDefinitionVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to definitions by shared_ptr + */ + void emplace_back_assigned_definition(std::shared_ptr n); -/** - * \brief Insert members to definitions - */ -template -void insert_assigned_definition(AssignedDefinitionVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to definitions + */ + AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first); -/** - * \brief Reset member to definitions - */ -void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, AssignedDefinition* n); + /** + * \brief Erase members to definitions + */ + AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first, AssignedDefinitionVector::const_iterator last); -/** - * \brief Reset member to definitions - */ -void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to definitions + * + * loosely following the cpp reference of remove_if + */ + size_t erase_assigned_definition(std::unordered_set& to_be_erased); + /** + * \brief Insert member to definitions + */ + AssignedDefinitionVector::const_iterator insert_assigned_definition(AssignedDefinitionVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to definitions + */ + template + void insert_assigned_definition(AssignedDefinitionVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref AssignedBlock.definitions - */ - const AssignedDefinitionVector& get_definitions() const noexcept { - return definitions; - } - + /** + * \brief Reset member to definitions + */ + void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, AssignedDefinition* n); + /** + * \brief Reset member to definitions + */ + void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref AssignedBlock.definitions + */ + const AssignedDefinitionVector& get_definitions() const noexcept { + return definitions; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref AssignedBlock.definitions (rvalue reference) + */ + void set_definitions(AssignedDefinitionVector&& definitions); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref AssignedBlock.definitions (rvalue reference) - */ - void set_definitions(AssignedDefinitionVector&& definitions); - - /** - * \brief Setter for member variable \ref AssignedBlock.definitions - */ - void set_definitions(const AssignedDefinitionVector& definitions); - + /** + * \brief Setter for member variable \ref AssignedBlock.definitions + */ + void set_definitions(const AssignedDefinitionVector& definitions); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -341,11 +313,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -357,7 +326,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/assigned_definition.hpp ast/assigned_definition.hpp --- ast.orig/assigned_definition.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/assigned_definition.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,41 +39,31 @@ class AssignedDefinition : public Statement { private: /// Name of the variable - std::shared_ptr name; + std::shared_ptr name; /// Length in case of array - std::shared_ptr length; + std::shared_ptr length; /// TODO - std::shared_ptr from; + std::shared_ptr from; /// TODO - std::shared_ptr to; + std::shared_ptr to; /// TODO - std::shared_ptr start; + std::shared_ptr start; /// TODO - std::shared_ptr unit; + std::shared_ptr unit; /// TODO - std::shared_ptr abstol; + std::shared_ptr abstol; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit AssignedDefinition(Identifier* name, Integer* length, Number* from, Number* to, Number* start, Unit* unit, Double* abstol); - explicit AssignedDefinition(std::shared_ptr name, std::shared_ptr length, std::shared_ptr from, std::shared_ptr to, std::shared_ptr start, std::shared_ptr unit, std::shared_ptr abstol); + explicit AssignedDefinition(const std::shared_ptr& name, const std::shared_ptr& length, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& start, const std::shared_ptr& unit, const std::shared_ptr& abstol); AssignedDefinition(const AssignedDefinition& obj); - - - virtual ~AssignedDefinition() = default; - + virtual ~AssignedDefinition() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::AssignedDefinition * \return true as object is of type ast::AssignedDefinition @@ -92,7 +80,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) AssignedDefinition* clone() const override { @@ -147,221 +135,182 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref AssignedDefinition.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.length + */ + const std::shared_ptr& get_length() const noexcept { + return length; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.from + */ + const std::shared_ptr& get_from() const noexcept { + return from; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.to + */ + const std::shared_ptr& get_to() const noexcept { + return to; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.start + */ + const std::shared_ptr& get_start() const noexcept { + return start; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } + + + + /** + * \brief Getter for member variable \ref AssignedDefinition.abstol + */ + const std::shared_ptr& get_abstol() const noexcept { + return abstol; + } + /// \} + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref AssignedDefinition.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref AssignedDefinition.name + */ + void set_name(const std::shared_ptr& name); - + + /** + * \brief Setter for member variable \ref AssignedDefinition.length (rvalue reference) + */ + void set_length(std::shared_ptr&& length); - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; + /** + * \brief Setter for member variable \ref AssignedDefinition.length + */ + void set_length(const std::shared_ptr& length); + + + /** + * \brief Setter for member variable \ref AssignedDefinition.from (rvalue reference) + */ + void set_from(std::shared_ptr&& from); - - /** - * \brief Getter for member variable \ref AssignedDefinition.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.length - */ - std::shared_ptr get_length() const noexcept { - return length; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.from - */ - std::shared_ptr get_from() const noexcept { - return from; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.to - */ - std::shared_ptr get_to() const noexcept { - return to; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.start - */ - std::shared_ptr get_start() const noexcept { - return start; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - - - - - - /** - * \brief Getter for member variable \ref AssignedDefinition.abstol - */ - std::shared_ptr get_abstol() const noexcept { - return abstol; - } - + /** + * \brief Setter for member variable \ref AssignedDefinition.from + */ + void set_from(const std::shared_ptr& from); + + /** + * \brief Setter for member variable \ref AssignedDefinition.to (rvalue reference) + */ + void set_to(std::shared_ptr&& to); - /// \} + /** + * \brief Setter for member variable \ref AssignedDefinition.to + */ + void set_to(const std::shared_ptr& to); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref AssignedDefinition.start (rvalue reference) + */ + void set_start(std::shared_ptr&& start); + /** + * \brief Setter for member variable \ref AssignedDefinition.start + */ + void set_start(const std::shared_ptr& start); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref AssignedDefinition.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); + /** + * \brief Setter for member variable \ref AssignedDefinition.unit + */ + void set_unit(const std::shared_ptr& unit); + + /** + * \brief Setter for member variable \ref AssignedDefinition.abstol (rvalue reference) + */ + void set_abstol(std::shared_ptr&& abstol); - - /** - * \brief Setter for member variable \ref AssignedDefinition.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref AssignedDefinition.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.length (rvalue reference) - */ - void set_length(std::shared_ptr&& length); - - /** - * \brief Setter for member variable \ref AssignedDefinition.length - */ - void set_length(const std::shared_ptr& length); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.from (rvalue reference) - */ - void set_from(std::shared_ptr&& from); - - /** - * \brief Setter for member variable \ref AssignedDefinition.from - */ - void set_from(const std::shared_ptr& from); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.to (rvalue reference) - */ - void set_to(std::shared_ptr&& to); - - /** - * \brief Setter for member variable \ref AssignedDefinition.to - */ - void set_to(const std::shared_ptr& to); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.start (rvalue reference) - */ - void set_start(std::shared_ptr&& start); - - /** - * \brief Setter for member variable \ref AssignedDefinition.start - */ - void set_start(const std::shared_ptr& start); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref AssignedDefinition.unit - */ - void set_unit(const std::shared_ptr& unit); - - - /** - * \brief Setter for member variable \ref AssignedDefinition.abstol (rvalue reference) - */ - void set_abstol(std::shared_ptr&& abstol); - - /** - * \brief Setter for member variable \ref AssignedDefinition.abstol - */ - void set_abstol(const std::shared_ptr& abstol); - + /** + * \brief Setter for member variable \ref AssignedDefinition.abstol + */ + void set_abstol(const std::shared_ptr& abstol); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -403,11 +352,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -419,7 +365,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/ast.cpp ast/ast.cpp --- ast.orig/ast.cpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/ast.cpp 2023-09-26 13:11:35.000000000 +0200 @@ -30,7 +30,7 @@ throw std::logic_error("get_node_name() not implemented"); } -std::shared_ptr Ast::get_statement_block() const { +const std::shared_ptr& Ast::get_statement_block() const { throw std::runtime_error("get_statement_block not implemented"); } @@ -542,7 +542,7 @@ : value(value), macro(macro) { set_parent_in_children(); } - Integer::Integer(int value, std::shared_ptr macro) + Integer::Integer(int value, const std::shared_ptr& macro) : value(value), macro(macro) { set_parent_in_children(); } @@ -814,7 +814,7 @@ : value(value) { set_parent_in_children(); } - Name::Name(std::shared_ptr value) + Name::Name(const std::shared_ptr& value) : value(value) { set_parent_in_children(); } @@ -912,7 +912,7 @@ : value(value), order(order) { set_parent_in_children(); } - PrimeName::PrimeName(std::shared_ptr value, std::shared_ptr order) + PrimeName::PrimeName(const std::shared_ptr& value, const std::shared_ptr& order) : value(value), order(order) { set_parent_in_children(); } @@ -1032,7 +1032,7 @@ : name(name), length(length) { set_parent_in_children(); } - IndexedName::IndexedName(std::shared_ptr name, std::shared_ptr length) + IndexedName::IndexedName(const std::shared_ptr& name, const std::shared_ptr& length) : name(name), length(length) { set_parent_in_children(); } @@ -1169,7 +1169,7 @@ : name(name), at(at), index(index) { set_parent_in_children(); } - VarName::VarName(std::shared_ptr name, std::shared_ptr at, std::shared_ptr index) + VarName::VarName(const std::shared_ptr& name, const std::shared_ptr& at, const std::shared_ptr& index) : name(name), at(at), index(index) { set_parent_in_children(); } @@ -1318,7 +1318,7 @@ : name(name), unit(unit) { set_parent_in_children(); } - Argument::Argument(std::shared_ptr name, std::shared_ptr unit) + Argument::Argument(const std::shared_ptr& name, const std::shared_ptr& unit) : name(name), unit(unit) { set_parent_in_children(); } @@ -1442,7 +1442,7 @@ : value(value), name(name) { set_parent_in_children(); } - ReactVarName::ReactVarName(std::shared_ptr value, std::shared_ptr name) + ReactVarName::ReactVarName(const std::shared_ptr& value, const std::shared_ptr& name) : value(value), name(name) { set_parent_in_children(); } @@ -1553,7 +1553,7 @@ : name(name) { set_parent_in_children(); } - ReadIonVar::ReadIonVar(std::shared_ptr name) + ReadIonVar::ReadIonVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -1639,7 +1639,7 @@ : name(name) { set_parent_in_children(); } - WriteIonVar::WriteIonVar(std::shared_ptr name) + WriteIonVar::WriteIonVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -1725,7 +1725,7 @@ : name(name) { set_parent_in_children(); } - NonspecificCurVar::NonspecificCurVar(std::shared_ptr name) + NonspecificCurVar::NonspecificCurVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -1811,7 +1811,7 @@ : name(name) { set_parent_in_children(); } - ElectrodeCurVar::ElectrodeCurVar(std::shared_ptr name) + ElectrodeCurVar::ElectrodeCurVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -1897,7 +1897,7 @@ : name(name) { set_parent_in_children(); } - RangeVar::RangeVar(std::shared_ptr name) + RangeVar::RangeVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -1983,7 +1983,7 @@ : name(name) { set_parent_in_children(); } - GlobalVar::GlobalVar(std::shared_ptr name) + GlobalVar::GlobalVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -2069,7 +2069,7 @@ : name(name) { set_parent_in_children(); } - PointerVar::PointerVar(std::shared_ptr name) + PointerVar::PointerVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -2155,7 +2155,7 @@ : name(name) { set_parent_in_children(); } - BbcorePointerVar::BbcorePointerVar(std::shared_ptr name) + BbcorePointerVar::BbcorePointerVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -2241,7 +2241,7 @@ : name(name) { set_parent_in_children(); } - ExternVar::ExternVar(std::shared_ptr name) + ExternVar::ExternVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -2325,7 +2325,7 @@ } - ParamBlock::ParamBlock(ParamAssignVector statements) + ParamBlock::ParamBlock(const ParamAssignVector& statements) : statements(statements) { set_parent_in_children(); } @@ -2411,7 +2411,7 @@ } - IndependentBlock::IndependentBlock(NameVector variables) + IndependentBlock::IndependentBlock(const NameVector& variables) : variables(variables) { set_parent_in_children(); } @@ -2582,7 +2582,7 @@ } - AssignedBlock::AssignedBlock(AssignedDefinitionVector definitions) + AssignedBlock::AssignedBlock(const AssignedDefinitionVector& definitions) : definitions(definitions) { set_parent_in_children(); } @@ -2668,7 +2668,7 @@ } - StateBlock::StateBlock(AssignedDefinitionVector definitions) + StateBlock::StateBlock(const AssignedDefinitionVector& definitions) : definitions(definitions) { set_parent_in_children(); } @@ -2754,7 +2754,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - InitialBlock::InitialBlock(std::shared_ptr statement_block) + InitialBlock::InitialBlock(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -2838,7 +2838,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - ConstructorBlock::ConstructorBlock(std::shared_ptr statement_block) + ConstructorBlock::ConstructorBlock(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -2922,7 +2922,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - DestructorBlock::DestructorBlock(std::shared_ptr statement_block) + DestructorBlock::DestructorBlock(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -3091,7 +3091,7 @@ } - StatementBlock::StatementBlock(StatementVector statements) + StatementBlock::StatementBlock(const StatementVector& statements) : statements(statements) { set_parent_in_children(); } @@ -3188,7 +3188,7 @@ : name(name), statement_block(statement_block) { set_parent_in_children(); } - DerivativeBlock::DerivativeBlock(std::shared_ptr name, std::shared_ptr statement_block) + DerivativeBlock::DerivativeBlock(const std::shared_ptr& name, const std::shared_ptr& statement_block) : name(name), statement_block(statement_block) { set_parent_in_children(); } @@ -3317,11 +3317,11 @@ } - LinearBlock::LinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block) + LinearBlock::LinearBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } - LinearBlock::LinearBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block) + LinearBlock::LinearBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } @@ -3476,11 +3476,11 @@ } - NonLinearBlock::NonLinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block) + NonLinearBlock::NonLinearBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } - NonLinearBlock::NonLinearBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block) + NonLinearBlock::NonLinearBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } @@ -3626,7 +3626,7 @@ : name(name), statement_block(statement_block) { set_parent_in_children(); } - DiscreteBlock::DiscreteBlock(std::shared_ptr name, std::shared_ptr statement_block) + DiscreteBlock::DiscreteBlock(const std::shared_ptr& name, const std::shared_ptr& statement_block) : name(name), statement_block(statement_block) { set_parent_in_children(); } @@ -3759,11 +3759,11 @@ } - FunctionTableBlock::FunctionTableBlock(Name* name, ArgumentVector parameters, Unit* unit) + FunctionTableBlock::FunctionTableBlock(Name* name, const ArgumentVector& parameters, Unit* unit) : name(name), parameters(parameters), unit(unit) { set_parent_in_children(); } - FunctionTableBlock::FunctionTableBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit) + FunctionTableBlock::FunctionTableBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit) : name(name), parameters(parameters), unit(unit) { set_parent_in_children(); } @@ -3931,11 +3931,11 @@ } - FunctionBlock::FunctionBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block) + FunctionBlock::FunctionBlock(Name* name, const ArgumentVector& parameters, Unit* unit, StatementBlock* statement_block) : name(name), parameters(parameters), unit(unit), statement_block(statement_block) { set_parent_in_children(); } - FunctionBlock::FunctionBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit, std::shared_ptr statement_block) + FunctionBlock::FunctionBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit, const std::shared_ptr& statement_block) : name(name), parameters(parameters), unit(unit), statement_block(statement_block) { set_parent_in_children(); } @@ -4128,11 +4128,11 @@ } - ProcedureBlock::ProcedureBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block) + ProcedureBlock::ProcedureBlock(Name* name, const ArgumentVector& parameters, Unit* unit, StatementBlock* statement_block) : name(name), parameters(parameters), unit(unit), statement_block(statement_block) { set_parent_in_children(); } - ProcedureBlock::ProcedureBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit, std::shared_ptr statement_block) + ProcedureBlock::ProcedureBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit, const std::shared_ptr& statement_block) : name(name), parameters(parameters), unit(unit), statement_block(statement_block) { set_parent_in_children(); } @@ -4301,11 +4301,11 @@ } - NetReceiveBlock::NetReceiveBlock(ArgumentVector parameters, StatementBlock* statement_block) + NetReceiveBlock::NetReceiveBlock(const ArgumentVector& parameters, StatementBlock* statement_block) : parameters(parameters), statement_block(statement_block) { set_parent_in_children(); } - NetReceiveBlock::NetReceiveBlock(const ArgumentVector& parameters, std::shared_ptr statement_block) + NetReceiveBlock::NetReceiveBlock(const ArgumentVector& parameters, const std::shared_ptr& statement_block) : parameters(parameters), statement_block(statement_block) { set_parent_in_children(); } @@ -4441,7 +4441,7 @@ : block_name(block_name), method(method), steadystate(steadystate) { set_parent_in_children(); } - SolveBlock::SolveBlock(std::shared_ptr block_name, std::shared_ptr method, std::shared_ptr steadystate) + SolveBlock::SolveBlock(const std::shared_ptr& block_name, const std::shared_ptr& method, const std::shared_ptr& steadystate) : block_name(block_name), method(method), steadystate(steadystate) { set_parent_in_children(); } @@ -4575,7 +4575,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - BreakpointBlock::BreakpointBlock(std::shared_ptr statement_block) + BreakpointBlock::BreakpointBlock(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -4659,7 +4659,7 @@ : bablock(bablock) { set_parent_in_children(); } - BeforeBlock::BeforeBlock(std::shared_ptr bablock) + BeforeBlock::BeforeBlock(const std::shared_ptr& bablock) : bablock(bablock) { set_parent_in_children(); } @@ -4743,7 +4743,7 @@ : bablock(bablock) { set_parent_in_children(); } - AfterBlock::AfterBlock(std::shared_ptr bablock) + AfterBlock::AfterBlock(const std::shared_ptr& bablock) : bablock(bablock) { set_parent_in_children(); } @@ -4836,7 +4836,7 @@ : type(type), statement_block(statement_block) { set_parent_in_children(); } - BABlock::BABlock(std::shared_ptr type, std::shared_ptr statement_block) + BABlock::BABlock(const std::shared_ptr& type, const std::shared_ptr& statement_block) : type(type), statement_block(statement_block) { set_parent_in_children(); } @@ -4954,11 +4954,11 @@ } - ForNetcon::ForNetcon(ArgumentVector parameters, StatementBlock* statement_block) + ForNetcon::ForNetcon(const ArgumentVector& parameters, StatementBlock* statement_block) : parameters(parameters), statement_block(statement_block) { set_parent_in_children(); } - ForNetcon::ForNetcon(const ArgumentVector& parameters, std::shared_ptr statement_block) + ForNetcon::ForNetcon(const ArgumentVector& parameters, const std::shared_ptr& statement_block) : parameters(parameters), statement_block(statement_block) { set_parent_in_children(); } @@ -5088,11 +5088,11 @@ } - KineticBlock::KineticBlock(Name* name, NameVector solvefor, StatementBlock* statement_block) + KineticBlock::KineticBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } - KineticBlock::KineticBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block) + KineticBlock::KineticBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block) : name(name), solvefor(solvefor), statement_block(statement_block) { set_parent_in_children(); } @@ -5227,7 +5227,7 @@ } - UnitBlock::UnitBlock(ExpressionVector definitions) + UnitBlock::UnitBlock(const ExpressionVector& definitions) : definitions(definitions) { set_parent_in_children(); } @@ -5313,7 +5313,7 @@ } - ConstantBlock::ConstantBlock(ConstantStatementVector statements) + ConstantBlock::ConstantBlock(const ConstantStatementVector& statements) : statements(statements) { set_parent_in_children(); } @@ -5399,7 +5399,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - NeuronBlock::NeuronBlock(std::shared_ptr statement_block) + NeuronBlock::NeuronBlock(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -5485,7 +5485,7 @@ : name(name) { set_parent_in_children(); } - Unit::Unit(std::shared_ptr name) + Unit::Unit(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -5582,7 +5582,7 @@ : value(value), unit(unit) { set_parent_in_children(); } - DoubleUnit::DoubleUnit(std::shared_ptr value, std::shared_ptr unit) + DoubleUnit::DoubleUnit(const std::shared_ptr& value, const std::shared_ptr& unit) : value(value), unit(unit) { set_parent_in_children(); } @@ -5693,7 +5693,7 @@ : name(name) { set_parent_in_children(); } - LocalVar::LocalVar(std::shared_ptr name) + LocalVar::LocalVar(const std::shared_ptr& name) : name(name) { set_parent_in_children(); } @@ -5786,7 +5786,7 @@ : min(min), max(max) { set_parent_in_children(); } - Limits::Limits(std::shared_ptr min, std::shared_ptr max) + Limits::Limits(const std::shared_ptr& min, const std::shared_ptr& max) : min(min), max(max) { set_parent_in_children(); } @@ -5904,7 +5904,7 @@ : min(min), max(max) { set_parent_in_children(); } - NumberRange::NumberRange(std::shared_ptr min, std::shared_ptr max) + NumberRange::NumberRange(const std::shared_ptr& min, const std::shared_ptr& max) : min(min), max(max) { set_parent_in_children(); } @@ -6037,7 +6037,7 @@ : name(name), value(value), unit(unit) { set_parent_in_children(); } - ConstantVar::ConstantVar(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit) + ConstantVar::ConstantVar(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit) : name(name), value(value), unit(unit) { set_parent_in_children(); } @@ -6348,7 +6348,7 @@ : expression(expression) { set_parent_in_children(); } - ParenExpression::ParenExpression(std::shared_ptr expression) + ParenExpression::ParenExpression(const std::shared_ptr& expression) : expression(expression) { set_parent_in_children(); } @@ -6450,7 +6450,7 @@ : lhs(lhs), op(op), rhs(rhs) { set_parent_in_children(); } - BinaryExpression::BinaryExpression(std::shared_ptr lhs, const BinaryOperator& op, std::shared_ptr rhs) + BinaryExpression::BinaryExpression(const std::shared_ptr& lhs, const BinaryOperator& op, const std::shared_ptr& rhs) : lhs(lhs), op(op), rhs(rhs) { set_parent_in_children(); } @@ -6571,7 +6571,7 @@ : expression(expression) { set_parent_in_children(); } - DiffEqExpression::DiffEqExpression(std::shared_ptr expression) + DiffEqExpression::DiffEqExpression(const std::shared_ptr& expression) : expression(expression) { set_parent_in_children(); } @@ -6664,7 +6664,7 @@ : op(op), expression(expression) { set_parent_in_children(); } - UnaryExpression::UnaryExpression(const UnaryOperator& op, std::shared_ptr expression) + UnaryExpression::UnaryExpression(const UnaryOperator& op, const std::shared_ptr& expression) : op(op), expression(expression) { set_parent_in_children(); } @@ -6769,7 +6769,7 @@ : lhs(lhs), rhs(rhs) { set_parent_in_children(); } - NonLinEquation::NonLinEquation(std::shared_ptr lhs, std::shared_ptr rhs) + NonLinEquation::NonLinEquation(const std::shared_ptr& lhs, const std::shared_ptr& rhs) : lhs(lhs), rhs(rhs) { set_parent_in_children(); } @@ -6887,7 +6887,7 @@ : left_linxpression(left_linxpression), linxpression(linxpression) { set_parent_in_children(); } - LinEquation::LinEquation(std::shared_ptr left_linxpression, std::shared_ptr linxpression) + LinEquation::LinEquation(const std::shared_ptr& left_linxpression, const std::shared_ptr& linxpression) : left_linxpression(left_linxpression), linxpression(linxpression) { set_parent_in_children(); } @@ -7007,11 +7007,11 @@ } - FunctionCall::FunctionCall(Name* name, ExpressionVector arguments) + FunctionCall::FunctionCall(Name* name, const ExpressionVector& arguments) : name(name), arguments(arguments) { set_parent_in_children(); } - FunctionCall::FunctionCall(std::shared_ptr name, const ExpressionVector& arguments) + FunctionCall::FunctionCall(const std::shared_ptr& name, const ExpressionVector& arguments) : name(name), arguments(arguments) { set_parent_in_children(); } @@ -7130,7 +7130,7 @@ : expression(expression), value(value) { set_parent_in_children(); } - Watch::Watch(std::shared_ptr expression, std::shared_ptr value) + Watch::Watch(const std::shared_ptr& expression, const std::shared_ptr& value) : expression(expression), value(value) { set_parent_in_children(); } @@ -7309,7 +7309,7 @@ : unit1(unit1), unit2(unit2) { set_parent_in_children(); } - UnitDef::UnitDef(std::shared_ptr unit1, std::shared_ptr unit2) + UnitDef::UnitDef(const std::shared_ptr& unit1, const std::shared_ptr& unit2) : unit1(unit1), unit2(unit2) { set_parent_in_children(); } @@ -7468,7 +7468,7 @@ : name(name), value(value), unit1(unit1), gt(gt), unit2(unit2) { set_parent_in_children(); } - FactorDef::FactorDef(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit1, std::shared_ptr gt, std::shared_ptr unit2) + FactorDef::FactorDef(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit1, const std::shared_ptr& gt, const std::shared_ptr& unit2) : name(name), value(value), unit1(unit1), gt(gt), unit2(unit2) { set_parent_in_children(); } @@ -7661,7 +7661,7 @@ : type(type), value(value) { set_parent_in_children(); } - Valence::Valence(std::shared_ptr type, std::shared_ptr value) + Valence::Valence(const std::shared_ptr& type, const std::shared_ptr& value) : type(type), value(value) { set_parent_in_children(); } @@ -7914,7 +7914,7 @@ } - LocalListStatement::LocalListStatement(LocalVarVector variables) + LocalListStatement::LocalListStatement(const LocalVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -8000,7 +8000,7 @@ : title(title) { set_parent_in_children(); } - Model::Model(std::shared_ptr title) + Model::Model(const std::shared_ptr& title) : title(title) { set_parent_in_children(); } @@ -8095,7 +8095,7 @@ : name(name), value(value) { set_parent_in_children(); } - Define::Define(std::shared_ptr name, std::shared_ptr value) + Define::Define(const std::shared_ptr& name, const std::shared_ptr& value) : name(name), value(value) { set_parent_in_children(); } @@ -8213,11 +8213,11 @@ } - Include::Include(String* filename, NodeVector blocks) + Include::Include(String* filename, const NodeVector& blocks) : filename(filename), blocks(blocks) { set_parent_in_children(); } - Include::Include(std::shared_ptr filename, const NodeVector& blocks) + Include::Include(const std::shared_ptr& filename, const NodeVector& blocks) : filename(filename), blocks(blocks) { set_parent_in_children(); } @@ -8368,7 +8368,7 @@ : name(name), value(value), unit(unit), limit(limit) { set_parent_in_children(); } - ParamAssign::ParamAssign(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit, std::shared_ptr limit) + ParamAssign::ParamAssign(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit, const std::shared_ptr& limit) : name(name), value(value), unit(unit), limit(limit) { set_parent_in_children(); } @@ -8607,7 +8607,7 @@ : name(name), length(length), from(from), to(to), start(start), unit(unit), abstol(abstol) { set_parent_in_children(); } - AssignedDefinition::AssignedDefinition(std::shared_ptr name, std::shared_ptr length, std::shared_ptr from, std::shared_ptr to, std::shared_ptr start, std::shared_ptr unit, std::shared_ptr abstol) + AssignedDefinition::AssignedDefinition(const std::shared_ptr& name, const std::shared_ptr& length, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& start, const std::shared_ptr& unit, const std::shared_ptr& abstol) : name(name), length(length), from(from), to(to), start(start), unit(unit), abstol(abstol) { set_parent_in_children(); } @@ -8854,7 +8854,7 @@ : conductance(conductance), ion(ion) { set_parent_in_children(); } - ConductanceHint::ConductanceHint(std::shared_ptr conductance, std::shared_ptr ion) + ConductanceHint::ConductanceHint(const std::shared_ptr& conductance, const std::shared_ptr& ion) : conductance(conductance), ion(ion) { set_parent_in_children(); } @@ -8963,7 +8963,7 @@ : expression(expression) { set_parent_in_children(); } - ExpressionStatement::ExpressionStatement(std::shared_ptr expression) + ExpressionStatement::ExpressionStatement(const std::shared_ptr& expression) : expression(expression) { set_parent_in_children(); } @@ -9047,7 +9047,7 @@ : expression(expression) { set_parent_in_children(); } - ProtectStatement::ProtectStatement(std::shared_ptr expression) + ProtectStatement::ProtectStatement(const std::shared_ptr& expression) : expression(expression) { set_parent_in_children(); } @@ -9173,7 +9173,7 @@ : name(name), from(from), to(to), increment(increment), statement_block(statement_block) { set_parent_in_children(); } - FromStatement::FromStatement(std::shared_ptr name, std::shared_ptr from, std::shared_ptr to, std::shared_ptr increment, std::shared_ptr statement_block) + FromStatement::FromStatement(const std::shared_ptr& name, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& increment, const std::shared_ptr& statement_block) : name(name), from(from), to(to), increment(increment), statement_block(statement_block) { set_parent_in_children(); } @@ -9366,7 +9366,7 @@ : condition(condition), statement_block(statement_block) { set_parent_in_children(); } - WhileStatement::WhileStatement(std::shared_ptr condition, std::shared_ptr statement_block) + WhileStatement::WhileStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block) : condition(condition), statement_block(statement_block) { set_parent_in_children(); } @@ -9506,11 +9506,11 @@ } - IfStatement::IfStatement(Expression* condition, StatementBlock* statement_block, ElseIfStatementVector elseifs, ElseStatement* elses) + IfStatement::IfStatement(Expression* condition, StatementBlock* statement_block, const ElseIfStatementVector& elseifs, ElseStatement* elses) : condition(condition), statement_block(statement_block), elseifs(elseifs), elses(elses) { set_parent_in_children(); } - IfStatement::IfStatement(std::shared_ptr condition, std::shared_ptr statement_block, const ElseIfStatementVector& elseifs, std::shared_ptr elses) + IfStatement::IfStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block, const ElseIfStatementVector& elseifs, const std::shared_ptr& elses) : condition(condition), statement_block(statement_block), elseifs(elseifs), elses(elses) { set_parent_in_children(); } @@ -9679,7 +9679,7 @@ : condition(condition), statement_block(statement_block) { set_parent_in_children(); } - ElseIfStatement::ElseIfStatement(std::shared_ptr condition, std::shared_ptr statement_block) + ElseIfStatement::ElseIfStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block) : condition(condition), statement_block(statement_block) { set_parent_in_children(); } @@ -9788,7 +9788,7 @@ : statement_block(statement_block) { set_parent_in_children(); } - ElseStatement::ElseStatement(std::shared_ptr statement_block) + ElseStatement::ElseStatement(const std::shared_ptr& statement_block) : statement_block(statement_block) { set_parent_in_children(); } @@ -9957,7 +9957,7 @@ } - WatchStatement::WatchStatement(WatchVector statements) + WatchStatement::WatchStatement(const WatchVector& statements) : statements(statements) { set_parent_in_children(); } @@ -10096,7 +10096,7 @@ : react(react), expr(expr) { set_parent_in_children(); } - Conserve::Conserve(std::shared_ptr react, std::shared_ptr expr) + Conserve::Conserve(const std::shared_ptr& react, const std::shared_ptr& expr) : react(react), expr(expr) { set_parent_in_children(); } @@ -10227,11 +10227,11 @@ } - Compartment::Compartment(Name* name, Expression* expression, NameVector names) + Compartment::Compartment(Name* name, Expression* expression, const NameVector& names) : name(name), expression(expression), names(names) { set_parent_in_children(); } - Compartment::Compartment(std::shared_ptr name, std::shared_ptr expression, const NameVector& names) + Compartment::Compartment(const std::shared_ptr& name, const std::shared_ptr& expression, const NameVector& names) : name(name), expression(expression), names(names) { set_parent_in_children(); } @@ -10388,11 +10388,11 @@ } - LonDifuse::LonDifuse(Name* name, Expression* expression, NameVector names) + LonDifuse::LonDifuse(Name* name, Expression* expression, const NameVector& names) : name(name), expression(expression), names(names) { set_parent_in_children(); } - LonDifuse::LonDifuse(std::shared_ptr name, std::shared_ptr expression, const NameVector& names) + LonDifuse::LonDifuse(const std::shared_ptr& name, const std::shared_ptr& expression, const NameVector& names) : name(name), expression(expression), names(names) { set_parent_in_children(); } @@ -10571,7 +10571,7 @@ : reaction1(reaction1), op(op), reaction2(reaction2), expression1(expression1), expression2(expression2) { set_parent_in_children(); } - ReactionStatement::ReactionStatement(std::shared_ptr reaction1, const ReactionOperator& op, std::shared_ptr reaction2, std::shared_ptr expression1, std::shared_ptr expression2) + ReactionStatement::ReactionStatement(const std::shared_ptr& reaction1, const ReactionOperator& op, const std::shared_ptr& reaction2, const std::shared_ptr& expression1, const std::shared_ptr& expression2) : reaction1(reaction1), op(op), reaction2(reaction2), expression1(expression1), expression2(expression2) { set_parent_in_children(); } @@ -10751,7 +10751,7 @@ : name(name), byname(byname) { set_parent_in_children(); } - LagStatement::LagStatement(std::shared_ptr name, std::shared_ptr byname) + LagStatement::LagStatement(const std::shared_ptr& name, const std::shared_ptr& byname) : name(name), byname(byname) { set_parent_in_children(); } @@ -10860,7 +10860,7 @@ : constant(constant) { set_parent_in_children(); } - ConstantStatement::ConstantStatement(std::shared_ptr constant) + ConstantStatement::ConstantStatement(const std::shared_ptr& constant) : constant(constant) { set_parent_in_children(); } @@ -10984,11 +10984,11 @@ } - TableStatement::TableStatement(NameVector table_vars, NameVector depend_vars, Expression* from, Expression* to, Integer* with) + TableStatement::TableStatement(const NameVector& table_vars, const NameVector& depend_vars, Expression* from, Expression* to, Integer* with) : table_vars(table_vars), depend_vars(depend_vars), from(from), to(to), with(with) { set_parent_in_children(); } - TableStatement::TableStatement(const NameVector& table_vars, const NameVector& depend_vars, std::shared_ptr from, std::shared_ptr to, std::shared_ptr with) + TableStatement::TableStatement(const NameVector& table_vars, const NameVector& depend_vars, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& with) : table_vars(table_vars), depend_vars(depend_vars), from(from), to(to), with(with) { set_parent_in_children(); } @@ -11185,7 +11185,7 @@ : type(type), name(name) { set_parent_in_children(); } - Suffix::Suffix(std::shared_ptr type, std::shared_ptr name) + Suffix::Suffix(const std::shared_ptr& type, const std::shared_ptr& name) : type(type), name(name) { set_parent_in_children(); } @@ -11344,11 +11344,11 @@ } - Useion::Useion(Name* name, ReadIonVarVector readlist, WriteIonVarVector writelist, Valence* valence, String* ontology_id) + Useion::Useion(Name* name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, Valence* valence, String* ontology_id) : name(name), readlist(readlist), writelist(writelist), valence(valence), ontology_id(ontology_id) { set_parent_in_children(); } - Useion::Useion(std::shared_ptr name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, std::shared_ptr valence, std::shared_ptr ontology_id) + Useion::Useion(const std::shared_ptr& name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, const std::shared_ptr& valence, const std::shared_ptr& ontology_id) : name(name), readlist(readlist), writelist(writelist), valence(valence), ontology_id(ontology_id) { set_parent_in_children(); } @@ -11534,7 +11534,7 @@ } - Nonspecific::Nonspecific(NonspecificCurVarVector currents) + Nonspecific::Nonspecific(const NonspecificCurVarVector& currents) : currents(currents) { set_parent_in_children(); } @@ -11620,7 +11620,7 @@ } - ElectrodeCurrent::ElectrodeCurrent(ElectrodeCurVarVector currents) + ElectrodeCurrent::ElectrodeCurrent(const ElectrodeCurVarVector& currents) : currents(currents) { set_parent_in_children(); } @@ -11706,7 +11706,7 @@ } - Range::Range(RangeVarVector variables) + Range::Range(const RangeVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -11877,7 +11877,7 @@ } - Global::Global(GlobalVarVector variables) + Global::Global(const GlobalVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -11963,7 +11963,7 @@ } - Pointer::Pointer(PointerVarVector variables) + Pointer::Pointer(const PointerVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -12049,7 +12049,7 @@ } - BbcorePointer::BbcorePointer(BbcorePointerVarVector variables) + BbcorePointer::BbcorePointer(const BbcorePointerVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -12135,7 +12135,7 @@ } - External::External(ExternVarVector variables) + External::External(const ExternVarVector& variables) : variables(variables) { set_parent_in_children(); } @@ -12243,7 +12243,7 @@ : statement(statement) { set_parent_in_children(); } - Verbatim::Verbatim(std::shared_ptr statement) + Verbatim::Verbatim(const std::shared_ptr& statement) : statement(statement) { set_parent_in_children(); } @@ -12327,7 +12327,7 @@ : statement(statement) { set_parent_in_children(); } - LineComment::LineComment(std::shared_ptr statement) + LineComment::LineComment(const std::shared_ptr& statement) : statement(statement) { set_parent_in_children(); } @@ -12411,7 +12411,7 @@ : statement(statement) { set_parent_in_children(); } - BlockComment::BlockComment(std::shared_ptr statement) + BlockComment::BlockComment(const std::shared_ptr& statement) : statement(statement) { set_parent_in_children(); } @@ -12495,7 +12495,7 @@ : ontology_id(ontology_id) { set_parent_in_children(); } - OntologyStatement::OntologyStatement(std::shared_ptr ontology_id) + OntologyStatement::OntologyStatement(const std::shared_ptr& ontology_id) : ontology_id(ontology_id) { set_parent_in_children(); } @@ -12664,7 +12664,7 @@ } - Program::Program(NodeVector blocks) + Program::Program(const NodeVector& blocks) : blocks(blocks) { set_parent_in_children(); } @@ -12750,7 +12750,7 @@ } - NrnStateBlock::NrnStateBlock(StatementVector solve_statements) + NrnStateBlock::NrnStateBlock(const StatementVector& solve_statements) : solve_statements(solve_statements) { set_parent_in_children(); } @@ -12890,7 +12890,7 @@ : n_state_vars(n_state_vars), variable_block(variable_block), initialize_block(initialize_block), setup_x_block(setup_x_block), functor_block(functor_block), update_states_block(update_states_block), finalize_block(finalize_block) { set_parent_in_children(); } - EigenNewtonSolverBlock::EigenNewtonSolverBlock(std::shared_ptr n_state_vars, std::shared_ptr variable_block, std::shared_ptr initialize_block, std::shared_ptr setup_x_block, std::shared_ptr functor_block, std::shared_ptr update_states_block, std::shared_ptr finalize_block) + EigenNewtonSolverBlock::EigenNewtonSolverBlock(const std::shared_ptr& n_state_vars, const std::shared_ptr& variable_block, const std::shared_ptr& initialize_block, const std::shared_ptr& setup_x_block, const std::shared_ptr& functor_block, const std::shared_ptr& update_states_block, const std::shared_ptr& finalize_block) : n_state_vars(n_state_vars), variable_block(variable_block), initialize_block(initialize_block), setup_x_block(setup_x_block), functor_block(functor_block), update_states_block(update_states_block), finalize_block(finalize_block) { set_parent_in_children(); } @@ -13169,7 +13169,7 @@ : n_state_vars(n_state_vars), variable_block(variable_block), initialize_block(initialize_block), setup_x_block(setup_x_block), update_states_block(update_states_block), finalize_block(finalize_block) { set_parent_in_children(); } - EigenLinearSolverBlock::EigenLinearSolverBlock(std::shared_ptr n_state_vars, std::shared_ptr variable_block, std::shared_ptr initialize_block, std::shared_ptr setup_x_block, std::shared_ptr update_states_block, std::shared_ptr finalize_block) + EigenLinearSolverBlock::EigenLinearSolverBlock(const std::shared_ptr& n_state_vars, const std::shared_ptr& variable_block, const std::shared_ptr& initialize_block, const std::shared_ptr& setup_x_block, const std::shared_ptr& update_states_block, const std::shared_ptr& finalize_block) : n_state_vars(n_state_vars), variable_block(variable_block), initialize_block(initialize_block), setup_x_block(setup_x_block), update_states_block(update_states_block), finalize_block(finalize_block) { set_parent_in_children(); } @@ -13378,7 +13378,7 @@ : expression(expression) { set_parent_in_children(); } - WrappedExpression::WrappedExpression(std::shared_ptr expression) + WrappedExpression::WrappedExpression(const std::shared_ptr& expression) : expression(expression) { set_parent_in_children(); } @@ -13462,7 +13462,7 @@ : node_to_solve(node_to_solve) { set_parent_in_children(); } - DerivimplicitCallback::DerivimplicitCallback(std::shared_ptr node_to_solve) + DerivimplicitCallback::DerivimplicitCallback(const std::shared_ptr& node_to_solve) : node_to_solve(node_to_solve) { set_parent_in_children(); } @@ -13555,7 +13555,7 @@ : solve_block(solve_block), node_to_solve(node_to_solve) { set_parent_in_children(); } - SolutionExpression::SolutionExpression(std::shared_ptr solve_block, std::shared_ptr node_to_solve) + SolutionExpression::SolutionExpression(const std::shared_ptr& solve_block, const std::shared_ptr& node_to_solve) : solve_block(solve_block), node_to_solve(node_to_solve) { set_parent_in_children(); } @@ -13664,7 +13664,7 @@ : value(value) { set_parent_in_children(); } - UpdateDt::UpdateDt(std::shared_ptr value) + UpdateDt::UpdateDt(const std::shared_ptr& value) : value(value) { set_parent_in_children(); } diff -ru ast.orig/ast.hpp ast/ast.hpp --- ast.orig/ast.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/ast.hpp 2023-09-26 12:38:56.000000000 +0200 @@ -50,10 +50,10 @@ */ /** - * @defgroup ast_class AST Classes - * @ingroup ast - * @brief Classes for implementing Abstract Syntax Tree (AST) - * @{ + * \defgroup ast_class AST Classes + * \ingroup ast + * \brief Classes for implementing Abstract Syntax Tree (AST) + * \{ */ /** @@ -122,7 +122,7 @@ * This type name can be returned as a std::string for printing * ast to text/json form. * - * @return name of the node type as a string + * \return name of the node type as a string * * \sa Ast::get_node_name */ @@ -273,7 +273,7 @@ * * \sa ast::StatementBlock */ - virtual std::shared_ptr get_statement_block() const; + virtual const std::shared_ptr& get_statement_block() const; /** * \brief Set symbol table for the AST node diff -ru ast.orig/ba_block.hpp ast/ba_block.hpp --- ast.orig/ba_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/ba_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -43,33 +41,23 @@ class BABlock : public Block { private: /// Type of NMODL block - std::shared_ptr type; + std::shared_ptr type; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit BABlock(BABlockType* type, StatementBlock* statement_block); - explicit BABlock(std::shared_ptr type, std::shared_ptr statement_block); + explicit BABlock(const std::shared_ptr& type, const std::shared_ptr& statement_block); BABlock(const BABlock& obj); - - - virtual ~BABlock() = default; - + virtual ~BABlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BABlock * \return true as object is of type ast::BABlock @@ -86,7 +74,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BABlock* clone() const override { @@ -141,116 +129,96 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref BABlock.type - */ - std::shared_ptr get_type() const noexcept { - return type; - } - - - - - - - - /** - * \brief Getter for member variable \ref BABlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref BABlock.type + */ + const std::shared_ptr& get_type() const noexcept { + return type; + } + + + + /** + * \brief Getter for member variable \ref BABlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref BABlock.type (rvalue reference) + */ + void set_type(std::shared_ptr&& type); + /** + * \brief Setter for member variable \ref BABlock.type + */ + void set_type(const std::shared_ptr& type); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BABlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref BABlock.type (rvalue reference) - */ - void set_type(std::shared_ptr&& type); - - /** - * \brief Setter for member variable \ref BABlock.type - */ - void set_type(const std::shared_ptr& type); - - - /** - * \brief Setter for member variable \ref BABlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref BABlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref BABlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -292,11 +260,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -308,7 +273,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/ba_block_type.hpp ast/ba_block_type.hpp --- ast.orig/ba_block_type.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/ba_block_type.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -45,28 +43,18 @@ class BABlockType : public Expression { private: /// block type - BAType value; + BAType value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit BABlockType(BAType value); BABlockType(const BABlockType& obj); - - - virtual ~BABlockType() = default; - + virtual ~BABlockType() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BABlockType * \return true as object is of type ast::BABlockType @@ -83,7 +71,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BABlockType* clone() const override { @@ -138,60 +126,45 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref BABlockType.value - */ - BAType get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref BABlockType.value + */ + BAType get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref BABlockType.value - */ - void set_value(BAType value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BABlockType.value + */ + void set_value(BAType value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -233,10 +206,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return enum value in string form * @@ -248,7 +219,6 @@ return BATypeNames[value]; } - private: /** * \brief Set this object as parent for all the children @@ -260,7 +230,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/bbcore_pointer.hpp ast/bbcore_pointer.hpp --- ast.orig/bbcore_pointer.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/bbcore_pointer.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/bbcore_pointer_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -50,28 +48,18 @@ class BbcorePointer : public Statement { private: /// Vector of bbcore pointer variables - BbcorePointerVarVector variables; + BbcorePointerVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit BbcorePointer(BbcorePointerVarVector variables); + explicit BbcorePointer(const BbcorePointerVarVector& variables); BbcorePointer(const BbcorePointer& obj); - - - virtual ~BbcorePointer() = default; - + virtual ~BbcorePointer() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BbcorePointer * \return true as object is of type ast::BbcorePointer @@ -88,7 +76,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BbcorePointer* clone() const override { @@ -157,65 +145,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref BbcorePointer.variables - */ - const BbcorePointerVarVector& get_variables() const noexcept { - return variables; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref BbcorePointer.variables + */ + const BbcorePointerVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BbcorePointer.variables (rvalue reference) + */ + void set_variables(BbcorePointerVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref BbcorePointer.variables (rvalue reference) - */ - void set_variables(BbcorePointerVarVector&& variables); - - /** - * \brief Setter for member variable \ref BbcorePointer.variables - */ - void set_variables(const BbcorePointerVarVector& variables); - + /** + * \brief Setter for member variable \ref BbcorePointer.variables + */ + void set_variables(const BbcorePointerVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -257,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -273,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/bbcore_pointer_var.hpp ast/bbcore_pointer_var.hpp --- ast.orig/bbcore_pointer_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/bbcore_pointer_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,29 +40,19 @@ class BbcorePointerVar : public Identifier { private: /// Variable name - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit BbcorePointerVar(Name* name); - explicit BbcorePointerVar(std::shared_ptr name); + explicit BbcorePointerVar(const std::shared_ptr& name); BbcorePointerVar(const BbcorePointerVar& obj); - - - virtual ~BbcorePointerVar() = default; - + virtual ~BbcorePointerVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BbcorePointerVar * \return true as object is of type ast::BbcorePointerVar @@ -81,7 +69,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BbcorePointerVar* clone() const override { @@ -136,77 +124,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref BbcorePointerVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref BbcorePointerVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BbcorePointerVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref BbcorePointerVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref BbcorePointerVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref BbcorePointerVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -248,11 +221,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -264,7 +234,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/before_block.hpp ast/before_block.hpp --- ast.orig/before_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/before_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class BeforeBlock : public Block { private: /// Block to be called before - std::shared_ptr bablock; + std::shared_ptr bablock; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit BeforeBlock(BABlock* bablock); - explicit BeforeBlock(std::shared_ptr bablock); + explicit BeforeBlock(const std::shared_ptr& bablock); BeforeBlock(const BeforeBlock& obj); - - - virtual ~BeforeBlock() = default; - + virtual ~BeforeBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BeforeBlock * \return true as object is of type ast::BeforeBlock @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BeforeBlock* clone() const override { @@ -151,92 +139,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref BeforeBlock.bablock - */ - std::shared_ptr get_bablock() const noexcept { - return bablock; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref BeforeBlock.bablock + */ + const std::shared_ptr& get_bablock() const noexcept { + return bablock; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref BeforeBlock.bablock (rvalue reference) + */ + void set_bablock(std::shared_ptr&& bablock); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref BeforeBlock.bablock (rvalue reference) - */ - void set_bablock(std::shared_ptr&& bablock); - - /** - * \brief Setter for member variable \ref BeforeBlock.bablock - */ - void set_bablock(const std::shared_ptr& bablock); - + /** + * \brief Setter for member variable \ref BeforeBlock.bablock + */ + void set_bablock(const std::shared_ptr& bablock); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -278,11 +250,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -294,7 +263,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/binary_expression.hpp ast/binary_expression.hpp --- ast.orig/binary_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/binary_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/binary_operator.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -55,33 +53,23 @@ class BinaryExpression : public Expression { private: /// LHS of the binary expression - std::shared_ptr lhs; + std::shared_ptr lhs; /// Operator - BinaryOperator op; + BinaryOperator op; /// RHS of the binary expression - std::shared_ptr rhs; + std::shared_ptr rhs; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit BinaryExpression(Expression* lhs, const BinaryOperator& op, Expression* rhs); - explicit BinaryExpression(std::shared_ptr lhs, const BinaryOperator& op, std::shared_ptr rhs); + explicit BinaryExpression(const std::shared_ptr& lhs, const BinaryOperator& op, const std::shared_ptr& rhs); BinaryExpression(const BinaryExpression& obj); - - - virtual ~BinaryExpression() = default; - + virtual ~BinaryExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BinaryExpression * \return true as object is of type ast::BinaryExpression @@ -98,7 +86,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BinaryExpression* clone() const override { @@ -153,113 +141,90 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref BinaryExpression.lhs - */ - std::shared_ptr get_lhs() const noexcept { - return lhs; - } - - - - - - - - /** - * \brief Getter for member variable \ref BinaryExpression.op - */ - const BinaryOperator& get_op() const noexcept { - return op; - } - - - - - - - - /** - * \brief Getter for member variable \ref BinaryExpression.rhs - */ - std::shared_ptr get_rhs() const noexcept { - return rhs; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref BinaryExpression.lhs + */ + const std::shared_ptr& get_lhs() const noexcept { + return lhs; + } + + + + /** + * \brief Getter for member variable \ref BinaryExpression.op + */ + const BinaryOperator& get_op() const noexcept { + return op; + } + + + + /** + * \brief Getter for member variable \ref BinaryExpression.rhs + */ + const std::shared_ptr& get_rhs() const noexcept { + return rhs; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BinaryExpression.lhs (rvalue reference) + */ + void set_lhs(std::shared_ptr&& lhs); + /** + * \brief Setter for member variable \ref BinaryExpression.lhs + */ + void set_lhs(const std::shared_ptr& lhs); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BinaryExpression.op (rvalue reference) + */ + void set_op(BinaryOperator&& op); + /** + * \brief Setter for member variable \ref BinaryExpression.op + */ + void set_op(const BinaryOperator& op); + + /** + * \brief Setter for member variable \ref BinaryExpression.rhs (rvalue reference) + */ + void set_rhs(std::shared_ptr&& rhs); - - /** - * \brief Setter for member variable \ref BinaryExpression.lhs (rvalue reference) - */ - void set_lhs(std::shared_ptr&& lhs); - - /** - * \brief Setter for member variable \ref BinaryExpression.lhs - */ - void set_lhs(const std::shared_ptr& lhs); - - - /** - * \brief Setter for member variable \ref BinaryExpression.op (rvalue reference) - */ - void set_op(BinaryOperator&& op); - - /** - * \brief Setter for member variable \ref BinaryExpression.op - */ - void set_op(const BinaryOperator& op); - - - /** - * \brief Setter for member variable \ref BinaryExpression.rhs (rvalue reference) - */ - void set_rhs(std::shared_ptr&& rhs); - - /** - * \brief Setter for member variable \ref BinaryExpression.rhs - */ - void set_rhs(const std::shared_ptr& rhs); - + /** + * \brief Setter for member variable \ref BinaryExpression.rhs + */ + void set_rhs(const std::shared_ptr& rhs); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -301,11 +266,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -317,7 +279,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/binary_operator.hpp ast/binary_operator.hpp --- ast.orig/binary_operator.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/binary_operator.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class BinaryOperator : public Expression { private: /// Operator - BinaryOp value; + BinaryOp value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit BinaryOperator(BinaryOp value); BinaryOperator(const BinaryOperator& obj); - BinaryOperator() = default; - - virtual ~BinaryOperator() = default; - + virtual ~BinaryOperator() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BinaryOperator * \return true as object is of type ast::BinaryOperator @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BinaryOperator* clone() const override { @@ -135,60 +123,45 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref BinaryOperator.value - */ - BinaryOp get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref BinaryOperator.value + */ + BinaryOp get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref BinaryOperator.value - */ - void set_value(BinaryOp value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BinaryOperator.value + */ + void set_value(BinaryOp value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -230,10 +203,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return enum value in string form * @@ -245,7 +216,6 @@ return BinaryOpNames[value]; } - private: /** * \brief Set this object as parent for all the children @@ -257,7 +227,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/block.hpp ast/block.hpp --- ast.orig/block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/block.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -44,26 +42,16 @@ class Block : public Expression { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Block() = default; - + virtual ~Block() = default; /// \} - /// \name Not implemented /// \{ - virtual const ArgumentVector& get_parameters() const { throw std::runtime_error("get_parameters not implemented"); } - - /// \} - /** * \brief Check if the ast node is an instance of ast::Block * \return true as object is of type ast::Block @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Block* clone() const override { @@ -135,23 +123,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -193,14 +170,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/block_comment.hpp ast/block_comment.hpp --- ast.orig/block_comment.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/block_comment.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class BlockComment : public Statement { private: /// comment text - std::shared_ptr statement; + std::shared_ptr statement; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit BlockComment(String* statement); - explicit BlockComment(std::shared_ptr statement); + explicit BlockComment(const std::shared_ptr& statement); BlockComment(const BlockComment& obj); - - - virtual ~BlockComment() = default; - + virtual ~BlockComment() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BlockComment * \return true as object is of type ast::BlockComment @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BlockComment* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref BlockComment.statement - */ - std::shared_ptr get_statement() const noexcept { - return statement; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref BlockComment.statement + */ + const std::shared_ptr& get_statement() const noexcept { + return statement; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref BlockComment.statement (rvalue reference) + */ + void set_statement(std::shared_ptr&& statement); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref BlockComment.statement (rvalue reference) - */ - void set_statement(std::shared_ptr&& statement); - - /** - * \brief Setter for member variable \ref BlockComment.statement - */ - void set_statement(const std::shared_ptr& statement); - + /** + * \brief Setter for member variable \ref BlockComment.statement + */ + void set_statement(const std::shared_ptr& statement); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/boolean.hpp ast/boolean.hpp --- ast.orig/boolean.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/boolean.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/number.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -45,28 +43,18 @@ class Boolean : public Number { private: /// Value of boolean - int value; + int value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Boolean(int value); Boolean(const Boolean& obj); - - - virtual ~Boolean() = default; - + virtual ~Boolean() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Boolean * \return true as object is of type ast::Boolean @@ -83,7 +71,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Boolean* clone() const override { @@ -138,67 +126,52 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Boolean.value - */ - int get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Boolean.value + */ + int get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - /** - * \brief Set new value to the current ast node - * \sa Boolean::eval - */ - void set(bool _value) { - value = _value; - } - - - /** - * \brief Setter for member variable \ref Boolean.value - */ - void set_value(int value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set new value to the current ast node + * \sa Boolean::eval + */ + void set(bool _value) { + value = _value; + } + + /** + * \brief Setter for member variable \ref Boolean.value + */ + void set_value(int value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -240,7 +213,6 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} /** @@ -260,7 +232,6 @@ double to_double() override { return value; } - /** * \brief Return value of the ast node * @@ -273,7 +244,6 @@ bool eval() const { return value; } - private: /** * \brief Set this object as parent for all the children @@ -285,7 +255,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/breakpoint_block.hpp ast/breakpoint_block.hpp --- ast.orig/breakpoint_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/breakpoint_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,31 +54,21 @@ class BreakpointBlock : public Block { private: /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit BreakpointBlock(StatementBlock* statement_block); - explicit BreakpointBlock(std::shared_ptr statement_block); + explicit BreakpointBlock(const std::shared_ptr& statement_block); BreakpointBlock(const BreakpointBlock& obj); - - - virtual ~BreakpointBlock() = default; - + virtual ~BreakpointBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::BreakpointBlock * \return true as object is of type ast::BreakpointBlock @@ -97,7 +85,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) BreakpointBlock* clone() const override { @@ -166,92 +154,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref BreakpointBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref BreakpointBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref BreakpointBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref BreakpointBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref BreakpointBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref BreakpointBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -293,11 +265,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -309,7 +278,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/compartment.hpp ast/compartment.hpp --- ast.orig/compartment.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/compartment.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/name.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,33 +40,23 @@ class Compartment : public Statement { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// TODO - NameVector names; + NameVector names; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Compartment(Name* name, Expression* expression, NameVector names); - explicit Compartment(std::shared_ptr name, std::shared_ptr expression, const NameVector& names); + explicit Compartment(Name* name, Expression* expression, const NameVector& names); + explicit Compartment(const std::shared_ptr& name, const std::shared_ptr& expression, const NameVector& names); Compartment(const Compartment& obj); - - - virtual ~Compartment() = default; - + virtual ~Compartment() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Compartment * \return true as object is of type ast::Compartment @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Compartment* clone() const override { @@ -154,113 +142,90 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Compartment.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref Compartment.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - - - - - - /** - * \brief Getter for member variable \ref Compartment.names - */ - const NameVector& get_names() const noexcept { - return names; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Compartment.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref Compartment.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } + + + + /** + * \brief Getter for member variable \ref Compartment.names + */ + const NameVector& get_names() const noexcept { + return names; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Compartment.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref Compartment.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Compartment.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); + /** + * \brief Setter for member variable \ref Compartment.expression + */ + void set_expression(const std::shared_ptr& expression); + + /** + * \brief Setter for member variable \ref Compartment.names (rvalue reference) + */ + void set_names(NameVector&& names); - - /** - * \brief Setter for member variable \ref Compartment.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Compartment.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref Compartment.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref Compartment.expression - */ - void set_expression(const std::shared_ptr& expression); - - - /** - * \brief Setter for member variable \ref Compartment.names (rvalue reference) - */ - void set_names(NameVector&& names); - - /** - * \brief Setter for member variable \ref Compartment.names - */ - void set_names(const NameVector& names); - + /** + * \brief Setter for member variable \ref Compartment.names + */ + void set_names(const NameVector& names); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -302,11 +267,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -318,7 +280,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/conductance_hint.hpp ast/conductance_hint.hpp --- ast.orig/conductance_hint.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/conductance_hint.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -49,31 +47,21 @@ class ConductanceHint : public Statement { private: /// Conductance variable - std::shared_ptr conductance; + std::shared_ptr conductance; /// Ion name - std::shared_ptr ion; + std::shared_ptr ion; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ConductanceHint(Name* conductance, Name* ion); - explicit ConductanceHint(std::shared_ptr conductance, std::shared_ptr ion); + explicit ConductanceHint(const std::shared_ptr& conductance, const std::shared_ptr& ion); ConductanceHint(const ConductanceHint& obj); - - - virtual ~ConductanceHint() = default; - + virtual ~ConductanceHint() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ConductanceHint * \return true as object is of type ast::ConductanceHint @@ -90,7 +78,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ConductanceHint* clone() const override { @@ -159,89 +147,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ConductanceHint.conductance - */ - std::shared_ptr get_conductance() const noexcept { - return conductance; - } - - - - - - - - /** - * \brief Getter for member variable \ref ConductanceHint.ion - */ - std::shared_ptr get_ion() const noexcept { - return ion; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ConductanceHint.conductance + */ + const std::shared_ptr& get_conductance() const noexcept { + return conductance; + } + + + + /** + * \brief Getter for member variable \ref ConductanceHint.ion + */ + const std::shared_ptr& get_ion() const noexcept { + return ion; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ConductanceHint.conductance (rvalue reference) + */ + void set_conductance(std::shared_ptr&& conductance); + /** + * \brief Setter for member variable \ref ConductanceHint.conductance + */ + void set_conductance(const std::shared_ptr& conductance); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref ConductanceHint.ion (rvalue reference) + */ + void set_ion(std::shared_ptr&& ion); - - /** - * \brief Setter for member variable \ref ConductanceHint.conductance (rvalue reference) - */ - void set_conductance(std::shared_ptr&& conductance); - - /** - * \brief Setter for member variable \ref ConductanceHint.conductance - */ - void set_conductance(const std::shared_ptr& conductance); - - - /** - * \brief Setter for member variable \ref ConductanceHint.ion (rvalue reference) - */ - void set_ion(std::shared_ptr&& ion); - - /** - * \brief Setter for member variable \ref ConductanceHint.ion - */ - void set_ion(const std::shared_ptr& ion); - + /** + * \brief Setter for member variable \ref ConductanceHint.ion + */ + void set_ion(const std::shared_ptr& ion); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -283,11 +252,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -299,7 +265,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/conserve.hpp ast/conserve.hpp --- ast.orig/conserve.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/conserve.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Conserve : public Statement { private: /// TODO - std::shared_ptr react; + std::shared_ptr react; /// TODO - std::shared_ptr expr; + std::shared_ptr expr; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Conserve(Expression* react, Expression* expr); - explicit Conserve(std::shared_ptr react, std::shared_ptr expr); + explicit Conserve(const std::shared_ptr& react, const std::shared_ptr& expr); Conserve(const Conserve& obj); - - - virtual ~Conserve() = default; - + virtual ~Conserve() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Conserve * \return true as object is of type ast::Conserve @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Conserve* clone() const override { @@ -151,89 +139,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Conserve.react - */ - std::shared_ptr get_react() const noexcept { - return react; - } - - - - - - - - /** - * \brief Getter for member variable \ref Conserve.expr - */ - std::shared_ptr get_expr() const noexcept { - return expr; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Conserve.react + */ + const std::shared_ptr& get_react() const noexcept { + return react; + } + + + + /** + * \brief Getter for member variable \ref Conserve.expr + */ + const std::shared_ptr& get_expr() const noexcept { + return expr; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Conserve.react (rvalue reference) + */ + void set_react(std::shared_ptr&& react); + /** + * \brief Setter for member variable \ref Conserve.react + */ + void set_react(const std::shared_ptr& react); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Conserve.expr (rvalue reference) + */ + void set_expr(std::shared_ptr&& expr); - - /** - * \brief Setter for member variable \ref Conserve.react (rvalue reference) - */ - void set_react(std::shared_ptr&& react); - - /** - * \brief Setter for member variable \ref Conserve.react - */ - void set_react(const std::shared_ptr& react); - - - /** - * \brief Setter for member variable \ref Conserve.expr (rvalue reference) - */ - void set_expr(std::shared_ptr&& expr); - - /** - * \brief Setter for member variable \ref Conserve.expr - */ - void set_expr(const std::shared_ptr& expr); - + /** + * \brief Setter for member variable \ref Conserve.expr + */ + void set_expr(const std::shared_ptr& expr); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,11 +244,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -291,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/constant_block.hpp ast/constant_block.hpp --- ast.orig/constant_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/constant_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/constant_statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -53,30 +51,20 @@ class ConstantBlock : public Block { private: /// Vector of constant statements - ConstantStatementVector statements; + ConstantStatementVector statements; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit ConstantBlock(ConstantStatementVector statements); + explicit ConstantBlock(const ConstantStatementVector& statements); ConstantBlock(const ConstantBlock& obj); - - - virtual ~ConstantBlock() = default; - + virtual ~ConstantBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ConstantBlock * \return true as object is of type ast::ConstantBlock @@ -93,7 +81,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ConstantBlock* clone() const override { @@ -162,92 +150,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref ConstantBlock.statements - */ - const ConstantStatementVector& get_statements() const noexcept { - return statements; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref ConstantBlock.statements + */ + const ConstantStatementVector& get_statements() const noexcept { + return statements; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref ConstantBlock.statements (rvalue reference) + */ + void set_statements(ConstantStatementVector&& statements); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref ConstantBlock.statements (rvalue reference) - */ - void set_statements(ConstantStatementVector&& statements); - - /** - * \brief Setter for member variable \ref ConstantBlock.statements - */ - void set_statements(const ConstantStatementVector& statements); - + /** + * \brief Setter for member variable \ref ConstantBlock.statements + */ + void set_statements(const ConstantStatementVector& statements); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -289,11 +261,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -305,7 +274,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/constant_statement.hpp ast/constant_statement.hpp --- ast.orig/constant_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/constant_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -43,29 +41,19 @@ class ConstantStatement : public Statement { private: /// single constant variable - std::shared_ptr constant; + std::shared_ptr constant; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ConstantStatement(ConstantVar* constant); - explicit ConstantStatement(std::shared_ptr constant); + explicit ConstantStatement(const std::shared_ptr& constant); ConstantStatement(const ConstantStatement& obj); - - - virtual ~ConstantStatement() = default; - + virtual ~ConstantStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ConstantStatement * \return true as object is of type ast::ConstantStatement @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ConstantStatement* clone() const override { @@ -137,65 +125,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ConstantStatement.constant - */ - std::shared_ptr get_constant() const noexcept { - return constant; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ConstantStatement.constant + */ + const std::shared_ptr& get_constant() const noexcept { + return constant; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ConstantStatement.constant (rvalue reference) + */ + void set_constant(std::shared_ptr&& constant); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ConstantStatement.constant (rvalue reference) - */ - void set_constant(std::shared_ptr&& constant); - - /** - * \brief Setter for member variable \ref ConstantStatement.constant - */ - void set_constant(const std::shared_ptr& constant); - + /** + * \brief Setter for member variable \ref ConstantStatement.constant + */ + void set_constant(const std::shared_ptr& constant); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -237,11 +210,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -253,7 +223,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/constant_var.hpp ast/constant_var.hpp --- ast.orig/constant_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/constant_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,33 +39,23 @@ class ConstantVar : public Expression { private: /// Name of the variable - std::shared_ptr name; + std::shared_ptr name; /// Value of the constant - std::shared_ptr value; + std::shared_ptr value; /// Unit for the variable - std::shared_ptr unit; + std::shared_ptr unit; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ConstantVar(Name* name, Number* value, Unit* unit); - explicit ConstantVar(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit); + explicit ConstantVar(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit); ConstantVar(const ConstantVar& obj); - - - virtual ~ConstantVar() = default; - + virtual ~ConstantVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ConstantVar * \return true as object is of type ast::ConstantVar @@ -84,7 +72,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ConstantVar* clone() const override { @@ -139,125 +127,102 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ConstantVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref ConstantVar.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref ConstantVar.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ConstantVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref ConstantVar.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref ConstantVar.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ConstantVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref ConstantVar.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ConstantVar.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); + /** + * \brief Setter for member variable \ref ConstantVar.value + */ + void set_value(const std::shared_ptr& value); + + /** + * \brief Setter for member variable \ref ConstantVar.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref ConstantVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ConstantVar.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref ConstantVar.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref ConstantVar.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref ConstantVar.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref ConstantVar.unit - */ - void set_unit(const std::shared_ptr& unit); - + /** + * \brief Setter for member variable \ref ConstantVar.unit + */ + void set_unit(const std::shared_ptr& unit); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -299,11 +264,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -315,7 +277,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/constructor_block.hpp ast/constructor_block.hpp --- ast.orig/constructor_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/constructor_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -54,31 +52,21 @@ class ConstructorBlock : public Block { private: /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit ConstructorBlock(StatementBlock* statement_block); - explicit ConstructorBlock(std::shared_ptr statement_block); + explicit ConstructorBlock(const std::shared_ptr& statement_block); ConstructorBlock(const ConstructorBlock& obj); - - - virtual ~ConstructorBlock() = default; - + virtual ~ConstructorBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ConstructorBlock * \return true as object is of type ast::ConstructorBlock @@ -95,7 +83,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ConstructorBlock* clone() const override { @@ -164,92 +152,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref ConstructorBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref ConstructorBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref ConstructorBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref ConstructorBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ConstructorBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref ConstructorBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -291,11 +263,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -307,7 +276,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/define.hpp ast/define.hpp --- ast.orig/define.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/define.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Define : public Statement { private: /// Name of the macro - std::shared_ptr name; + std::shared_ptr name; /// Value of the macro - std::shared_ptr value; + std::shared_ptr value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Define(Name* name, Integer* value); - explicit Define(std::shared_ptr name, std::shared_ptr value); + explicit Define(const std::shared_ptr& name, const std::shared_ptr& value); Define(const Define& obj); - - - virtual ~Define() = default; - + virtual ~Define() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Define * \return true as object is of type ast::Define @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Define* clone() const override { @@ -151,101 +139,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref Define.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref Define.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Define.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref Define.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Define.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref Define.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Define.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Define.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Define.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref Define.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Define.value - */ - void set_value(const std::shared_ptr& value); - + /** + * \brief Setter for member variable \ref Define.value + */ + void set_value(const std::shared_ptr& value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -287,11 +256,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -303,7 +269,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/derivative_block.hpp ast/derivative_block.hpp --- ast.orig/derivative_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/derivative_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -52,33 +50,23 @@ class DerivativeBlock : public Block { private: /// Name of the derivative block - std::shared_ptr name; + std::shared_ptr name; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit DerivativeBlock(Name* name, StatementBlock* statement_block); - explicit DerivativeBlock(std::shared_ptr name, std::shared_ptr statement_block); + explicit DerivativeBlock(const std::shared_ptr& name, const std::shared_ptr& statement_block); DerivativeBlock(const DerivativeBlock& obj); - - - virtual ~DerivativeBlock() = default; - + virtual ~DerivativeBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DerivativeBlock * \return true as object is of type ast::DerivativeBlock @@ -95,7 +83,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DerivativeBlock* clone() const override { @@ -164,128 +152,108 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref DerivativeBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref DerivativeBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref DerivativeBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref DerivativeBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref DerivativeBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref DerivativeBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - + + /** + * \brief Setter for member variable \ref DerivativeBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref DerivativeBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref DerivativeBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref DerivativeBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref DerivativeBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref DerivativeBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -327,11 +295,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -343,7 +308,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/derivimplicit_callback.hpp ast/derivimplicit_callback.hpp --- ast.orig/derivimplicit_callback.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/derivimplicit_callback.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class DerivimplicitCallback : public Expression { private: /// Block to be solved (typically derivative) - std::shared_ptr node_to_solve; + std::shared_ptr node_to_solve; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit DerivimplicitCallback(Block* node_to_solve); - explicit DerivimplicitCallback(std::shared_ptr node_to_solve); + explicit DerivimplicitCallback(const std::shared_ptr& node_to_solve); DerivimplicitCallback(const DerivimplicitCallback& obj); - - - virtual ~DerivimplicitCallback() = default; - + virtual ~DerivimplicitCallback() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DerivimplicitCallback * \return true as object is of type ast::DerivimplicitCallback @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DerivimplicitCallback* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref DerivimplicitCallback.node_to_solve - */ - std::shared_ptr get_node_to_solve() const noexcept { - return node_to_solve; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref DerivimplicitCallback.node_to_solve + */ + const std::shared_ptr& get_node_to_solve() const noexcept { + return node_to_solve; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve (rvalue reference) + */ + void set_node_to_solve(std::shared_ptr&& node_to_solve); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve (rvalue reference) - */ - void set_node_to_solve(std::shared_ptr&& node_to_solve); - - /** - * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve - */ - void set_node_to_solve(const std::shared_ptr& node_to_solve); - + /** + * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve + */ + void set_node_to_solve(const std::shared_ptr& node_to_solve); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/destructor_block.hpp ast/destructor_block.hpp --- ast.orig/destructor_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/destructor_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,31 +54,21 @@ class DestructorBlock : public Block { private: /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit DestructorBlock(StatementBlock* statement_block); - explicit DestructorBlock(std::shared_ptr statement_block); + explicit DestructorBlock(const std::shared_ptr& statement_block); DestructorBlock(const DestructorBlock& obj); - - - virtual ~DestructorBlock() = default; - + virtual ~DestructorBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DestructorBlock * \return true as object is of type ast::DestructorBlock @@ -97,7 +85,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DestructorBlock* clone() const override { @@ -166,92 +154,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref DestructorBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref DestructorBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref DestructorBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref DestructorBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref DestructorBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref DestructorBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -293,11 +265,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -309,7 +278,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/diff_eq_expression.hpp ast/diff_eq_expression.hpp --- ast.orig/diff_eq_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/diff_eq_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class DiffEqExpression : public Expression { private: /// Differential Expression - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit DiffEqExpression(BinaryExpression* expression); - explicit DiffEqExpression(std::shared_ptr expression); + explicit DiffEqExpression(const std::shared_ptr& expression); DiffEqExpression(const DiffEqExpression& obj); - - - virtual ~DiffEqExpression() = default; - + virtual ~DiffEqExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DiffEqExpression * \return true as object is of type ast::DiffEqExpression @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DiffEqExpression* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref DiffEqExpression.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref DiffEqExpression.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref DiffEqExpression.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref DiffEqExpression.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref DiffEqExpression.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref DiffEqExpression.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/discrete_block.hpp ast/discrete_block.hpp --- ast.orig/discrete_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/discrete_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,33 +39,23 @@ class DiscreteBlock : public Block { private: /// Name of the discrete block - std::shared_ptr name; + std::shared_ptr name; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit DiscreteBlock(Name* name, StatementBlock* statement_block); - explicit DiscreteBlock(std::shared_ptr name, std::shared_ptr statement_block); + explicit DiscreteBlock(const std::shared_ptr& name, const std::shared_ptr& statement_block); DiscreteBlock(const DiscreteBlock& obj); - - - virtual ~DiscreteBlock() = default; - + virtual ~DiscreteBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DiscreteBlock * \return true as object is of type ast::DiscreteBlock @@ -84,7 +72,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DiscreteBlock* clone() const override { @@ -153,128 +141,108 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref DiscreteBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref DiscreteBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref DiscreteBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref DiscreteBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref DiscreteBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref DiscreteBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - + + /** + * \brief Setter for member variable \ref DiscreteBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref DiscreteBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref DiscreteBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref DiscreteBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref DiscreteBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref DiscreteBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -316,11 +284,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -332,7 +297,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/double.hpp ast/double.hpp --- ast.orig/double.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/double.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/number.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,29 +54,19 @@ class Double : public Number { private: /// Value of double - std::string value; + std::string value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Double(const std::string& value); Double(const Double& obj); - Double() = default; - - virtual ~Double() = default; - + virtual ~Double() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Double * \return true as object is of type ast::Double @@ -95,7 +83,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Double* clone() const override { @@ -150,67 +138,52 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Double.value - */ - const std::string& get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Double.value + */ + const std::string& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - /** - * \brief Set new value to the current ast node - * \sa Double::eval - */ - void set(std::string _value) { - value = _value; - } - - - /** - * \brief Setter for member variable \ref Double.value - */ - void set_value(std::string value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set new value to the current ast node + * \sa Double::eval + */ + void set(std::string _value) { + value = _value; + } + + /** + * \brief Setter for member variable \ref Double.value + */ + void set_value(std::string value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -252,7 +225,6 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} /** @@ -272,7 +244,6 @@ double to_double() override { return std::stod(value); } - /** * \brief Return value of the ast node * @@ -285,7 +256,6 @@ std::string eval() const { return value; } - private: /** * \brief Set this object as parent for all the children @@ -297,7 +267,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/double_unit.hpp ast/double_unit.hpp --- ast.orig/double_unit.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/double_unit.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class DoubleUnit : public Expression { private: /// TODO - std::shared_ptr value; + std::shared_ptr value; /// TODO - std::shared_ptr unit; + std::shared_ptr unit; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit DoubleUnit(Double* value, Unit* unit); - explicit DoubleUnit(std::shared_ptr value, std::shared_ptr unit); + explicit DoubleUnit(const std::shared_ptr& value, const std::shared_ptr& unit); DoubleUnit(const DoubleUnit& obj); - - - virtual ~DoubleUnit() = default; - + virtual ~DoubleUnit() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::DoubleUnit * \return true as object is of type ast::DoubleUnit @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) DoubleUnit* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref DoubleUnit.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref DoubleUnit.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref DoubleUnit.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref DoubleUnit.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref DoubleUnit.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); + /** + * \brief Setter for member variable \ref DoubleUnit.value + */ + void set_value(const std::shared_ptr& value); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref DoubleUnit.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref DoubleUnit.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref DoubleUnit.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref DoubleUnit.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref DoubleUnit.unit - */ - void set_unit(const std::shared_ptr& unit); - + /** + * \brief Setter for member variable \ref DoubleUnit.unit + */ + void set_unit(const std::shared_ptr& unit); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/eigen_linear_solver_block.hpp ast/eigen_linear_solver_block.hpp --- ast.orig/eigen_linear_solver_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/eigen_linear_solver_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,41 +39,31 @@ class EigenLinearSolverBlock : public Block { private: /// number of state vars used in solve - std::shared_ptr n_state_vars; + std::shared_ptr n_state_vars; /// Statements to be declared in the functor - std::shared_ptr variable_block; + std::shared_ptr variable_block; /// Statement block to be executed before calling linear solver - std::shared_ptr initialize_block; + std::shared_ptr initialize_block; /// update X from states - std::shared_ptr setup_x_block; + std::shared_ptr setup_x_block; /// update back states from X - std::shared_ptr update_states_block; + std::shared_ptr update_states_block; /// Statement block to be executed after calling linear solver - std::shared_ptr finalize_block; + std::shared_ptr finalize_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit EigenLinearSolverBlock(Integer* n_state_vars, StatementBlock* variable_block, StatementBlock* initialize_block, StatementBlock* setup_x_block, StatementBlock* update_states_block, StatementBlock* finalize_block); - explicit EigenLinearSolverBlock(std::shared_ptr n_state_vars, std::shared_ptr variable_block, std::shared_ptr initialize_block, std::shared_ptr setup_x_block, std::shared_ptr update_states_block, std::shared_ptr finalize_block); + explicit EigenLinearSolverBlock(const std::shared_ptr& n_state_vars, const std::shared_ptr& variable_block, const std::shared_ptr& initialize_block, const std::shared_ptr& setup_x_block, const std::shared_ptr& update_states_block, const std::shared_ptr& finalize_block); EigenLinearSolverBlock(const EigenLinearSolverBlock& obj); - - - virtual ~EigenLinearSolverBlock() = default; - + virtual ~EigenLinearSolverBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::EigenLinearSolverBlock * \return true as object is of type ast::EigenLinearSolverBlock @@ -92,7 +80,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) EigenLinearSolverBlock* clone() const override { @@ -161,212 +149,176 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.n_state_vars + */ + const std::shared_ptr& get_n_state_vars() const noexcept { + return n_state_vars; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.variable_block + */ + const std::shared_ptr& get_variable_block() const noexcept { + return variable_block; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.initialize_block + */ + const std::shared_ptr& get_initialize_block() const noexcept { + return initialize_block; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.setup_x_block + */ + const std::shared_ptr& get_setup_x_block() const noexcept { + return setup_x_block; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.update_states_block + */ + const std::shared_ptr& get_update_states_block() const noexcept { + return update_states_block; + } + + + + /** + * \brief Getter for member variable \ref EigenLinearSolverBlock.finalize_block + */ + const std::shared_ptr& get_finalize_block() const noexcept { + return finalize_block; + } + /// \} + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars (rvalue reference) + */ + void set_n_state_vars(std::shared_ptr&& n_state_vars); - + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars + */ + void set_n_state_vars(const std::shared_ptr& n_state_vars); - + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block (rvalue reference) + */ + void set_variable_block(std::shared_ptr&& variable_block); - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.n_state_vars - */ - std::shared_ptr get_n_state_vars() const noexcept { - return n_state_vars; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.variable_block - */ - std::shared_ptr get_variable_block() const noexcept { - return variable_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.initialize_block - */ - std::shared_ptr get_initialize_block() const noexcept { - return initialize_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.setup_x_block - */ - std::shared_ptr get_setup_x_block() const noexcept { - return setup_x_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.update_states_block - */ - std::shared_ptr get_update_states_block() const noexcept { - return update_states_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenLinearSolverBlock.finalize_block - */ - std::shared_ptr get_finalize_block() const noexcept { - return finalize_block; - } - + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block + */ + void set_variable_block(const std::shared_ptr& variable_block); + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block (rvalue reference) + */ + void set_initialize_block(std::shared_ptr&& initialize_block); - /// \} + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block + */ + void set_initialize_block(const std::shared_ptr& initialize_block); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block (rvalue reference) + */ + void set_setup_x_block(std::shared_ptr&& setup_x_block); + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block + */ + void set_setup_x_block(const std::shared_ptr& setup_x_block); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block (rvalue reference) + */ + void set_update_states_block(std::shared_ptr&& update_states_block); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block + */ + void set_update_states_block(const std::shared_ptr& update_states_block); + + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block (rvalue reference) + */ + void set_finalize_block(std::shared_ptr&& finalize_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars (rvalue reference) - */ - void set_n_state_vars(std::shared_ptr&& n_state_vars); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars - */ - void set_n_state_vars(const std::shared_ptr& n_state_vars); - - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block (rvalue reference) - */ - void set_variable_block(std::shared_ptr&& variable_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block - */ - void set_variable_block(const std::shared_ptr& variable_block); - - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block (rvalue reference) - */ - void set_initialize_block(std::shared_ptr&& initialize_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block - */ - void set_initialize_block(const std::shared_ptr& initialize_block); - - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block (rvalue reference) - */ - void set_setup_x_block(std::shared_ptr&& setup_x_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block - */ - void set_setup_x_block(const std::shared_ptr& setup_x_block); - - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block (rvalue reference) - */ - void set_update_states_block(std::shared_ptr&& update_states_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block - */ - void set_update_states_block(const std::shared_ptr& update_states_block); - - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block (rvalue reference) - */ - void set_finalize_block(std::shared_ptr&& finalize_block); - - /** - * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block - */ - void set_finalize_block(const std::shared_ptr& finalize_block); - + /** + * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block + */ + void set_finalize_block(const std::shared_ptr& finalize_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -408,11 +360,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -424,7 +373,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/eigen_newton_solver_block.hpp ast/eigen_newton_solver_block.hpp --- ast.orig/eigen_newton_solver_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/eigen_newton_solver_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,43 +39,33 @@ class EigenNewtonSolverBlock : public Block { private: /// number of state vars used in solve - std::shared_ptr n_state_vars; + std::shared_ptr n_state_vars; /// Statements to be declared in the functor - std::shared_ptr variable_block; + std::shared_ptr variable_block; /// Statement block to be executed before calling newton solver - std::shared_ptr initialize_block; + std::shared_ptr initialize_block; /// update X from states - std::shared_ptr setup_x_block; + std::shared_ptr setup_x_block; /// odes as functor for eigen - std::shared_ptr functor_block; + std::shared_ptr functor_block; /// update back states from X - std::shared_ptr update_states_block; + std::shared_ptr update_states_block; /// Statement block to be executed after calling newton solver - std::shared_ptr finalize_block; + std::shared_ptr finalize_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit EigenNewtonSolverBlock(Integer* n_state_vars, StatementBlock* variable_block, StatementBlock* initialize_block, StatementBlock* setup_x_block, StatementBlock* functor_block, StatementBlock* update_states_block, StatementBlock* finalize_block); - explicit EigenNewtonSolverBlock(std::shared_ptr n_state_vars, std::shared_ptr variable_block, std::shared_ptr initialize_block, std::shared_ptr setup_x_block, std::shared_ptr functor_block, std::shared_ptr update_states_block, std::shared_ptr finalize_block); + explicit EigenNewtonSolverBlock(const std::shared_ptr& n_state_vars, const std::shared_ptr& variable_block, const std::shared_ptr& initialize_block, const std::shared_ptr& setup_x_block, const std::shared_ptr& functor_block, const std::shared_ptr& update_states_block, const std::shared_ptr& finalize_block); EigenNewtonSolverBlock(const EigenNewtonSolverBlock& obj); - - - virtual ~EigenNewtonSolverBlock() = default; - + virtual ~EigenNewtonSolverBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::EigenNewtonSolverBlock * \return true as object is of type ast::EigenNewtonSolverBlock @@ -94,7 +82,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) EigenNewtonSolverBlock* clone() const override { @@ -163,236 +151,196 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.n_state_vars + */ + const std::shared_ptr& get_n_state_vars() const noexcept { + return n_state_vars; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.variable_block + */ + const std::shared_ptr& get_variable_block() const noexcept { + return variable_block; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.initialize_block + */ + const std::shared_ptr& get_initialize_block() const noexcept { + return initialize_block; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.setup_x_block + */ + const std::shared_ptr& get_setup_x_block() const noexcept { + return setup_x_block; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.functor_block + */ + const std::shared_ptr& get_functor_block() const noexcept { + return functor_block; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.update_states_block + */ + const std::shared_ptr& get_update_states_block() const noexcept { + return update_states_block; + } + + + + /** + * \brief Getter for member variable \ref EigenNewtonSolverBlock.finalize_block + */ + const std::shared_ptr& get_finalize_block() const noexcept { + return finalize_block; + } + /// \} - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars (rvalue reference) + */ + void set_n_state_vars(std::shared_ptr&& n_state_vars); + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars + */ + void set_n_state_vars(const std::shared_ptr& n_state_vars); + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block (rvalue reference) + */ + void set_variable_block(std::shared_ptr&& variable_block); - + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block + */ + void set_variable_block(const std::shared_ptr& variable_block); - + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block (rvalue reference) + */ + void set_initialize_block(std::shared_ptr&& initialize_block); - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.n_state_vars - */ - std::shared_ptr get_n_state_vars() const noexcept { - return n_state_vars; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.variable_block - */ - std::shared_ptr get_variable_block() const noexcept { - return variable_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.initialize_block - */ - std::shared_ptr get_initialize_block() const noexcept { - return initialize_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.setup_x_block - */ - std::shared_ptr get_setup_x_block() const noexcept { - return setup_x_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.functor_block - */ - std::shared_ptr get_functor_block() const noexcept { - return functor_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.update_states_block - */ - std::shared_ptr get_update_states_block() const noexcept { - return update_states_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref EigenNewtonSolverBlock.finalize_block - */ - std::shared_ptr get_finalize_block() const noexcept { - return finalize_block; - } - + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block + */ + void set_initialize_block(const std::shared_ptr& initialize_block); + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block (rvalue reference) + */ + void set_setup_x_block(std::shared_ptr&& setup_x_block); - /// \} + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block + */ + void set_setup_x_block(const std::shared_ptr& setup_x_block); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block (rvalue reference) + */ + void set_functor_block(std::shared_ptr&& functor_block); + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block + */ + void set_functor_block(const std::shared_ptr& functor_block); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block (rvalue reference) + */ + void set_update_states_block(std::shared_ptr&& update_states_block); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block + */ + void set_update_states_block(const std::shared_ptr& update_states_block); + + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block (rvalue reference) + */ + void set_finalize_block(std::shared_ptr&& finalize_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars (rvalue reference) - */ - void set_n_state_vars(std::shared_ptr&& n_state_vars); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars - */ - void set_n_state_vars(const std::shared_ptr& n_state_vars); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block (rvalue reference) - */ - void set_variable_block(std::shared_ptr&& variable_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block - */ - void set_variable_block(const std::shared_ptr& variable_block); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block (rvalue reference) - */ - void set_initialize_block(std::shared_ptr&& initialize_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block - */ - void set_initialize_block(const std::shared_ptr& initialize_block); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block (rvalue reference) - */ - void set_setup_x_block(std::shared_ptr&& setup_x_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block - */ - void set_setup_x_block(const std::shared_ptr& setup_x_block); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block (rvalue reference) - */ - void set_functor_block(std::shared_ptr&& functor_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block - */ - void set_functor_block(const std::shared_ptr& functor_block); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block (rvalue reference) - */ - void set_update_states_block(std::shared_ptr&& update_states_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block - */ - void set_update_states_block(const std::shared_ptr& update_states_block); - - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block (rvalue reference) - */ - void set_finalize_block(std::shared_ptr&& finalize_block); - - /** - * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block - */ - void set_finalize_block(const std::shared_ptr& finalize_block); - + /** + * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block + */ + void set_finalize_block(const std::shared_ptr& finalize_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -434,11 +382,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -450,7 +395,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/electrode_cur_var.hpp ast/electrode_cur_var.hpp --- ast.orig/electrode_cur_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/electrode_cur_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ElectrodeCurVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ElectrodeCurVar(Name* name); - explicit ElectrodeCurVar(std::shared_ptr name); + explicit ElectrodeCurVar(const std::shared_ptr& name); ElectrodeCurVar(const ElectrodeCurVar& obj); - - - virtual ~ElectrodeCurVar() = default; - + virtual ~ElectrodeCurVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ElectrodeCurVar * \return true as object is of type ast::ElectrodeCurVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ElectrodeCurVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ElectrodeCurVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ElectrodeCurVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ElectrodeCurVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ElectrodeCurVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ElectrodeCurVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref ElectrodeCurVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/electrode_current.hpp ast/electrode_current.hpp --- ast.orig/electrode_current.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/electrode_current.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/electrode_cur_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class ElectrodeCurrent : public Statement { private: /// Vector of electrode current variables - ElectrodeCurVarVector currents; + ElectrodeCurVarVector currents; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit ElectrodeCurrent(ElectrodeCurVarVector currents); + explicit ElectrodeCurrent(const ElectrodeCurVarVector& currents); ElectrodeCurrent(const ElectrodeCurrent& obj); - - - virtual ~ElectrodeCurrent() = default; - + virtual ~ElectrodeCurrent() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ElectrodeCurrent * \return true as object is of type ast::ElectrodeCurrent @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ElectrodeCurrent* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ElectrodeCurrent.currents - */ - const ElectrodeCurVarVector& get_currents() const noexcept { - return currents; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ElectrodeCurrent.currents + */ + const ElectrodeCurVarVector& get_currents() const noexcept { + return currents; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ElectrodeCurrent.currents (rvalue reference) + */ + void set_currents(ElectrodeCurVarVector&& currents); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ElectrodeCurrent.currents (rvalue reference) - */ - void set_currents(ElectrodeCurVarVector&& currents); - - /** - * \brief Setter for member variable \ref ElectrodeCurrent.currents - */ - void set_currents(const ElectrodeCurVarVector& currents); - + /** + * \brief Setter for member variable \ref ElectrodeCurrent.currents + */ + void set_currents(const ElectrodeCurVarVector& currents); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/else_if_statement.hpp ast/else_if_statement.hpp --- ast.orig/else_if_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/else_if_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class ElseIfStatement : public Statement { private: /// TODO - std::shared_ptr condition; + std::shared_ptr condition; /// TODO - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ElseIfStatement(Expression* condition, StatementBlock* statement_block); - explicit ElseIfStatement(std::shared_ptr condition, std::shared_ptr statement_block); + explicit ElseIfStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block); ElseIfStatement(const ElseIfStatement& obj); - - - virtual ~ElseIfStatement() = default; - + virtual ~ElseIfStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ElseIfStatement * \return true as object is of type ast::ElseIfStatement @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ElseIfStatement* clone() const override { @@ -151,89 +139,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ElseIfStatement.condition - */ - std::shared_ptr get_condition() const noexcept { - return condition; - } - - - - - - - - /** - * \brief Getter for member variable \ref ElseIfStatement.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ElseIfStatement.condition + */ + const std::shared_ptr& get_condition() const noexcept { + return condition; + } + + + + /** + * \brief Getter for member variable \ref ElseIfStatement.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ElseIfStatement.condition (rvalue reference) + */ + void set_condition(std::shared_ptr&& condition); + /** + * \brief Setter for member variable \ref ElseIfStatement.condition + */ + void set_condition(const std::shared_ptr& condition); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref ElseIfStatement.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ElseIfStatement.condition (rvalue reference) - */ - void set_condition(std::shared_ptr&& condition); - - /** - * \brief Setter for member variable \ref ElseIfStatement.condition - */ - void set_condition(const std::shared_ptr& condition); - - - /** - * \brief Setter for member variable \ref ElseIfStatement.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ElseIfStatement.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref ElseIfStatement.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,11 +244,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -291,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/else_statement.hpp ast/else_statement.hpp --- ast.orig/else_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/else_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ElseStatement : public Statement { private: /// TODO - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ElseStatement(StatementBlock* statement_block); - explicit ElseStatement(std::shared_ptr statement_block); + explicit ElseStatement(const std::shared_ptr& statement_block); ElseStatement(const ElseStatement& obj); - - - virtual ~ElseStatement() = default; - + virtual ~ElseStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ElseStatement * \return true as object is of type ast::ElseStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ElseStatement* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ElseStatement.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ElseStatement.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ElseStatement.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ElseStatement.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ElseStatement.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref ElseStatement.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/expression.hpp ast/expression.hpp --- ast.orig/expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/expression.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/node.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -46,21 +44,11 @@ class Expression : public Node { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Expression() = default; - + virtual ~Expression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Expression * \return true as object is of type ast::Expression @@ -77,7 +65,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Expression* clone() const override { @@ -132,23 +120,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -190,14 +167,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/expression_statement.hpp ast/expression_statement.hpp --- ast.orig/expression_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/expression_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ExpressionStatement : public Statement { private: /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ExpressionStatement(Expression* expression); - explicit ExpressionStatement(std::shared_ptr expression); + explicit ExpressionStatement(const std::shared_ptr& expression); ExpressionStatement(const ExpressionStatement& obj); - - - virtual ~ExpressionStatement() = default; - + virtual ~ExpressionStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ExpressionStatement * \return true as object is of type ast::ExpressionStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ExpressionStatement* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ExpressionStatement.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ExpressionStatement.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ExpressionStatement.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ExpressionStatement.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref ExpressionStatement.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref ExpressionStatement.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/extern_var.hpp ast/extern_var.hpp --- ast.orig/extern_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/extern_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ExternVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ExternVar(Name* name); - explicit ExternVar(std::shared_ptr name); + explicit ExternVar(const std::shared_ptr& name); ExternVar(const ExternVar& obj); - - - virtual ~ExternVar() = default; - + virtual ~ExternVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ExternVar * \return true as object is of type ast::ExternVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ExternVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ExternVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ExternVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ExternVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ExternVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ExternVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref ExternVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/external.hpp ast/external.hpp --- ast.orig/external.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/external.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/extern_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class External : public Statement { private: /// Vector of external variables - ExternVarVector variables; + ExternVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit External(ExternVarVector variables); + explicit External(const ExternVarVector& variables); External(const External& obj); - - - virtual ~External() = default; - + virtual ~External() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::External * \return true as object is of type ast::External @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) External* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref External.variables - */ - const ExternVarVector& get_variables() const noexcept { - return variables; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref External.variables + */ + const ExternVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref External.variables (rvalue reference) + */ + void set_variables(ExternVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref External.variables (rvalue reference) - */ - void set_variables(ExternVarVector&& variables); - - /** - * \brief Setter for member variable \ref External.variables - */ - void set_variables(const ExternVarVector& variables); - + /** + * \brief Setter for member variable \ref External.variables + */ + void set_variables(const ExternVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/factor_def.hpp ast/factor_def.hpp --- ast.orig/factor_def.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/factor_def.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,38 +39,28 @@ class FactorDef : public Expression { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - std::shared_ptr value; + std::shared_ptr value; /// TODO - std::shared_ptr unit1; + std::shared_ptr unit1; /// Todo: Michael : rename variable gt as well - std::shared_ptr gt; + std::shared_ptr gt; /// TODO - std::shared_ptr unit2; + std::shared_ptr unit2; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit FactorDef(Name* name, Double* value, Unit* unit1, Boolean* gt, Unit* unit2); - explicit FactorDef(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit1, std::shared_ptr gt, std::shared_ptr unit2); + explicit FactorDef(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit1, const std::shared_ptr& gt, const std::shared_ptr& unit2); FactorDef(const FactorDef& obj); - FactorDef() = default; - - virtual ~FactorDef() = default; - + virtual ~FactorDef() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::FactorDef * \return true as object is of type ast::FactorDef @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) FactorDef* clone() const override { @@ -144,173 +132,142 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref FactorDef.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref FactorDef.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref FactorDef.unit1 + */ + const std::shared_ptr& get_unit1() const noexcept { + return unit1; + } + + + + /** + * \brief Getter for member variable \ref FactorDef.gt + */ + const std::shared_ptr& get_gt() const noexcept { + return gt; + } + + + + /** + * \brief Getter for member variable \ref FactorDef.unit2 + */ + const std::shared_ptr& get_unit2() const noexcept { + return unit2; + } + /// \} - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FactorDef.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Getter for member variable \ref FactorDef.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref FactorDef.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref FactorDef.unit1 - */ - std::shared_ptr get_unit1() const noexcept { - return unit1; - } - - - - - - - - /** - * \brief Getter for member variable \ref FactorDef.gt - */ - std::shared_ptr get_gt() const noexcept { - return gt; - } - - - - - - - - /** - * \brief Getter for member variable \ref FactorDef.unit2 - */ - std::shared_ptr get_unit2() const noexcept { - return unit2; - } - + /** + * \brief Setter for member variable \ref FactorDef.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref FactorDef.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - /// \} + /** + * \brief Setter for member variable \ref FactorDef.value + */ + void set_value(const std::shared_ptr& value); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref FactorDef.unit1 (rvalue reference) + */ + void set_unit1(std::shared_ptr&& unit1); + /** + * \brief Setter for member variable \ref FactorDef.unit1 + */ + void set_unit1(const std::shared_ptr& unit1); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FactorDef.gt (rvalue reference) + */ + void set_gt(std::shared_ptr&& gt); + /** + * \brief Setter for member variable \ref FactorDef.gt + */ + void set_gt(const std::shared_ptr& gt); + + /** + * \brief Setter for member variable \ref FactorDef.unit2 (rvalue reference) + */ + void set_unit2(std::shared_ptr&& unit2); - - /** - * \brief Setter for member variable \ref FactorDef.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref FactorDef.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref FactorDef.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref FactorDef.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref FactorDef.unit1 (rvalue reference) - */ - void set_unit1(std::shared_ptr&& unit1); - - /** - * \brief Setter for member variable \ref FactorDef.unit1 - */ - void set_unit1(const std::shared_ptr& unit1); - - - /** - * \brief Setter for member variable \ref FactorDef.gt (rvalue reference) - */ - void set_gt(std::shared_ptr&& gt); - - /** - * \brief Setter for member variable \ref FactorDef.gt - */ - void set_gt(const std::shared_ptr& gt); - - - /** - * \brief Setter for member variable \ref FactorDef.unit2 (rvalue reference) - */ - void set_unit2(std::shared_ptr&& unit2); - - /** - * \brief Setter for member variable \ref FactorDef.unit2 - */ - void set_unit2(const std::shared_ptr& unit2); - + /** + * \brief Setter for member variable \ref FactorDef.unit2 + */ + void set_unit2(const std::shared_ptr& unit2); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -352,11 +309,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -368,7 +322,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/float.hpp ast/float.hpp --- ast.orig/float.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/float.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/number.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -47,28 +45,18 @@ class Float : public Number { private: /// Value of float - std::string value; + std::string value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Float(const std::string& value); Float(const Float& obj); - - - virtual ~Float() = default; - + virtual ~Float() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Float * \return true as object is of type ast::Float @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Float* clone() const override { @@ -140,67 +128,52 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Float.value - */ - const std::string& get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Float.value + */ + const std::string& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - /** - * \brief Set new value to the current ast node - * \sa Float::eval - */ - void set(std::string _value) { - value = _value; - } - - - /** - * \brief Setter for member variable \ref Float.value - */ - void set_value(std::string value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set new value to the current ast node + * \sa Float::eval + */ + void set(std::string _value) { + value = _value; + } + + /** + * \brief Setter for member variable \ref Float.value + */ + void set_value(std::string value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -242,7 +215,6 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} /** @@ -262,7 +234,6 @@ double to_double() override { return std::stod(value); } - /** * \brief Return value of the ast node * @@ -275,7 +246,6 @@ std::string eval() const { return value; } - private: /** * \brief Set this object as parent for all the children @@ -287,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/for_netcon.hpp ast/for_netcon.hpp --- ast.orig/for_netcon.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/for_netcon.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/argument.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,33 +40,23 @@ class ForNetcon : public Block { private: /// Arguments to the for netcon block - ArgumentVector parameters; + ArgumentVector parameters; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit ForNetcon(ArgumentVector parameters, StatementBlock* statement_block); - explicit ForNetcon(const ArgumentVector& parameters, std::shared_ptr statement_block); + explicit ForNetcon(const ArgumentVector& parameters, StatementBlock* statement_block); + explicit ForNetcon(const ArgumentVector& parameters, const std::shared_ptr& statement_block); ForNetcon(const ForNetcon& obj); - - - virtual ~ForNetcon() = default; - + virtual ~ForNetcon() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ForNetcon * \return true as object is of type ast::ForNetcon @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ForNetcon* clone() const override { @@ -154,116 +142,96 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref ForNetcon.parameters - */ - const ArgumentVector& get_parameters() const noexcept override { - return parameters; - } - - - - - - - - /** - * \brief Getter for member variable \ref ForNetcon.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref ForNetcon.parameters + */ + const ArgumentVector& get_parameters() const noexcept override { + return parameters; + } + + + + /** + * \brief Getter for member variable \ref ForNetcon.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref ForNetcon.parameters (rvalue reference) + */ + void set_parameters(ArgumentVector&& parameters); + /** + * \brief Setter for member variable \ref ForNetcon.parameters + */ + void set_parameters(const ArgumentVector& parameters); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - + + /** + * \brief Setter for member variable \ref ForNetcon.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ForNetcon.parameters (rvalue reference) - */ - void set_parameters(ArgumentVector&& parameters); - - /** - * \brief Setter for member variable \ref ForNetcon.parameters - */ - void set_parameters(const ArgumentVector& parameters); - - - /** - * \brief Setter for member variable \ref ForNetcon.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ForNetcon.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref ForNetcon.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -305,11 +273,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -321,7 +286,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/from_statement.hpp ast/from_statement.hpp --- ast.orig/from_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/from_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,37 +39,27 @@ class FromStatement : public Statement { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - std::shared_ptr from; + std::shared_ptr from; /// TODO - std::shared_ptr to; + std::shared_ptr to; /// TODO - std::shared_ptr increment; + std::shared_ptr increment; /// TODO - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit FromStatement(Name* name, Expression* from, Expression* to, Expression* increment, StatementBlock* statement_block); - explicit FromStatement(std::shared_ptr name, std::shared_ptr from, std::shared_ptr to, std::shared_ptr increment, std::shared_ptr statement_block); + explicit FromStatement(const std::shared_ptr& name, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& increment, const std::shared_ptr& statement_block); FromStatement(const FromStatement& obj); - - - virtual ~FromStatement() = default; - + virtual ~FromStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::FromStatement * \return true as object is of type ast::FromStatement @@ -88,7 +76,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) FromStatement* clone() const override { @@ -157,173 +145,142 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref FromStatement.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref FromStatement.from + */ + const std::shared_ptr& get_from() const noexcept { + return from; + } + + + + /** + * \brief Getter for member variable \ref FromStatement.to + */ + const std::shared_ptr& get_to() const noexcept { + return to; + } + + + + /** + * \brief Getter for member variable \ref FromStatement.increment + */ + const std::shared_ptr& get_increment() const noexcept { + return increment; + } + + + + /** + * \brief Getter for member variable \ref FromStatement.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } + /// \} - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FromStatement.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Getter for member variable \ref FromStatement.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref FromStatement.from - */ - std::shared_ptr get_from() const noexcept { - return from; - } - - - - - - - - /** - * \brief Getter for member variable \ref FromStatement.to - */ - std::shared_ptr get_to() const noexcept { - return to; - } - - - - - - - - /** - * \brief Getter for member variable \ref FromStatement.increment - */ - std::shared_ptr get_increment() const noexcept { - return increment; - } - - - - - - - - /** - * \brief Getter for member variable \ref FromStatement.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - + /** + * \brief Setter for member variable \ref FromStatement.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref FromStatement.from (rvalue reference) + */ + void set_from(std::shared_ptr&& from); - /// \} + /** + * \brief Setter for member variable \ref FromStatement.from + */ + void set_from(const std::shared_ptr& from); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref FromStatement.to (rvalue reference) + */ + void set_to(std::shared_ptr&& to); + /** + * \brief Setter for member variable \ref FromStatement.to + */ + void set_to(const std::shared_ptr& to); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FromStatement.increment (rvalue reference) + */ + void set_increment(std::shared_ptr&& increment); + /** + * \brief Setter for member variable \ref FromStatement.increment + */ + void set_increment(const std::shared_ptr& increment); + + /** + * \brief Setter for member variable \ref FromStatement.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref FromStatement.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref FromStatement.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref FromStatement.from (rvalue reference) - */ - void set_from(std::shared_ptr&& from); - - /** - * \brief Setter for member variable \ref FromStatement.from - */ - void set_from(const std::shared_ptr& from); - - - /** - * \brief Setter for member variable \ref FromStatement.to (rvalue reference) - */ - void set_to(std::shared_ptr&& to); - - /** - * \brief Setter for member variable \ref FromStatement.to - */ - void set_to(const std::shared_ptr& to); - - - /** - * \brief Setter for member variable \ref FromStatement.increment (rvalue reference) - */ - void set_increment(std::shared_ptr&& increment); - - /** - * \brief Setter for member variable \ref FromStatement.increment - */ - void set_increment(const std::shared_ptr& increment); - - - /** - * \brief Setter for member variable \ref FromStatement.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref FromStatement.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref FromStatement.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -365,11 +322,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -381,7 +335,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/function_block.hpp ast/function_block.hpp --- ast.orig/function_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/function_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/argument.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,37 +40,27 @@ class FunctionBlock : public Block { private: /// Name of the function - std::shared_ptr name; + std::shared_ptr name; /// Vector of the parameters - ArgumentVector parameters; + ArgumentVector parameters; /// Unit if specified - std::shared_ptr unit; + std::shared_ptr unit; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit FunctionBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block); - explicit FunctionBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit, std::shared_ptr statement_block); + explicit FunctionBlock(Name* name, const ArgumentVector& parameters, Unit* unit, StatementBlock* statement_block); + explicit FunctionBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit, const std::shared_ptr& statement_block); FunctionBlock(const FunctionBlock& obj); - - - virtual ~FunctionBlock() = default; - + virtual ~FunctionBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::FunctionBlock * \return true as object is of type ast::FunctionBlock @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) FunctionBlock* clone() const override { @@ -158,176 +146,148 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref FunctionBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionBlock.parameters - */ - const ArgumentVector& get_parameters() const noexcept override { - return parameters; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionBlock.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref FunctionBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref FunctionBlock.parameters + */ + const ArgumentVector& get_parameters() const noexcept override { + return parameters; + } + + + + /** + * \brief Getter for member variable \ref FunctionBlock.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } + + + + /** + * \brief Getter for member variable \ref FunctionBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref FunctionBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + + /** + * \brief Setter for member variable \ref FunctionBlock.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref FunctionBlock.parameters (rvalue reference) + */ + void set_parameters(ArgumentVector&& parameters); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Setter for member variable \ref FunctionBlock.parameters + */ + void set_parameters(const ArgumentVector& parameters); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + + /** + * \brief Setter for member variable \ref FunctionBlock.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); + /** + * \brief Setter for member variable \ref FunctionBlock.unit + */ + void set_unit(const std::shared_ptr& unit); + + + /** + * \brief Setter for member variable \ref FunctionBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref FunctionBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref FunctionBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref FunctionBlock.parameters (rvalue reference) - */ - void set_parameters(ArgumentVector&& parameters); - - /** - * \brief Setter for member variable \ref FunctionBlock.parameters - */ - void set_parameters(const ArgumentVector& parameters); - - - /** - * \brief Setter for member variable \ref FunctionBlock.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref FunctionBlock.unit - */ - void set_unit(const std::shared_ptr& unit); - - - /** - * \brief Setter for member variable \ref FunctionBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref FunctionBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref FunctionBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -369,11 +329,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -385,7 +342,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/function_call.hpp ast/function_call.hpp --- ast.orig/function_call.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/function_call.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class FunctionCall : public Expression { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - ExpressionVector arguments; + ExpressionVector arguments; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit FunctionCall(Name* name, ExpressionVector arguments); - explicit FunctionCall(std::shared_ptr name, const ExpressionVector& arguments); + explicit FunctionCall(Name* name, const ExpressionVector& arguments); + explicit FunctionCall(const std::shared_ptr& name, const ExpressionVector& arguments); FunctionCall(const FunctionCall& obj); - - - virtual ~FunctionCall() = default; - + virtual ~FunctionCall() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::FunctionCall * \return true as object is of type ast::FunctionCall @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) FunctionCall* clone() const override { @@ -137,101 +125,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref FunctionCall.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionCall.arguments - */ - const ExpressionVector& get_arguments() const noexcept { - return arguments; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref FunctionCall.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref FunctionCall.arguments + */ + const ExpressionVector& get_arguments() const noexcept { + return arguments; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FunctionCall.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref FunctionCall.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref FunctionCall.arguments (rvalue reference) + */ + void set_arguments(ExpressionVector&& arguments); - - /** - * \brief Setter for member variable \ref FunctionCall.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref FunctionCall.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref FunctionCall.arguments (rvalue reference) - */ - void set_arguments(ExpressionVector&& arguments); - - /** - * \brief Setter for member variable \ref FunctionCall.arguments - */ - void set_arguments(const ExpressionVector& arguments); - + /** + * \brief Setter for member variable \ref FunctionCall.arguments + */ + void set_arguments(const ExpressionVector& arguments); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -273,11 +242,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -289,7 +255,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/function_table_block.hpp ast/function_table_block.hpp --- ast.orig/function_table_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/function_table_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/argument.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,35 +40,25 @@ class FunctionTableBlock : public Block { private: /// Name of the function table block - std::shared_ptr name; + std::shared_ptr name; /// Vector of the parameters - ArgumentVector parameters; + ArgumentVector parameters; /// Unit if specified - std::shared_ptr unit; + std::shared_ptr unit; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit FunctionTableBlock(Name* name, ArgumentVector parameters, Unit* unit); - explicit FunctionTableBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit); + explicit FunctionTableBlock(Name* name, const ArgumentVector& parameters, Unit* unit); + explicit FunctionTableBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit); FunctionTableBlock(const FunctionTableBlock& obj); - - - virtual ~FunctionTableBlock() = default; - + virtual ~FunctionTableBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::FunctionTableBlock * \return true as object is of type ast::FunctionTableBlock @@ -87,7 +75,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) FunctionTableBlock* clone() const override { @@ -156,152 +144,128 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref FunctionTableBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionTableBlock.parameters - */ - const ArgumentVector& get_parameters() const noexcept override { - return parameters; - } - - - - - - - - /** - * \brief Getter for member variable \ref FunctionTableBlock.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref FunctionTableBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref FunctionTableBlock.parameters + */ + const ArgumentVector& get_parameters() const noexcept override { + return parameters; + } + + + + /** + * \brief Getter for member variable \ref FunctionTableBlock.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref FunctionTableBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref FunctionTableBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref FunctionTableBlock.parameters (rvalue reference) + */ + void set_parameters(ArgumentVector&& parameters); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref FunctionTableBlock.parameters + */ + void set_parameters(const ArgumentVector& parameters); + + /** + * \brief Setter for member variable \ref FunctionTableBlock.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref FunctionTableBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref FunctionTableBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref FunctionTableBlock.parameters (rvalue reference) - */ - void set_parameters(ArgumentVector&& parameters); - - /** - * \brief Setter for member variable \ref FunctionTableBlock.parameters - */ - void set_parameters(const ArgumentVector& parameters); - - - /** - * \brief Setter for member variable \ref FunctionTableBlock.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref FunctionTableBlock.unit - */ - void set_unit(const std::shared_ptr& unit); - + /** + * \brief Setter for member variable \ref FunctionTableBlock.unit + */ + void set_unit(const std::shared_ptr& unit); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -343,11 +307,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -359,7 +320,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/global.hpp ast/global.hpp --- ast.orig/global.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/global.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/global_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class Global : public Statement { private: /// Vector of global variables - GlobalVarVector variables; + GlobalVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Global(GlobalVarVector variables); + explicit Global(const GlobalVarVector& variables); Global(const Global& obj); - - - virtual ~Global() = default; - + virtual ~Global() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Global * \return true as object is of type ast::Global @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Global* clone() const override { @@ -149,113 +137,98 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - -/** - * \brief Add member to variables by raw pointer - */ -void emplace_back_global_var(GlobalVar *n); - -/** - * \brief Add member to variables by shared_ptr - */ -void emplace_back_global_var(std::shared_ptr n); - -/** - * \brief Erase member to variables - */ -GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first); - -/** - * \brief Erase members to variables - */ -GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first, GlobalVarVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to variables - * - * loosely following the cpp reference of remove_if - */ -size_t erase_global_var(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + /** + * \brief Add member to variables by raw pointer + */ + void emplace_back_global_var(GlobalVar *n); -/** - * \brief Insert member to variables - */ -GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to variables by shared_ptr + */ + void emplace_back_global_var(std::shared_ptr n); -/** - * \brief Insert members to variables - */ -template -void insert_global_var(GlobalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to variables + */ + GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first); -/** - * \brief Reset member to variables - */ -void reset_global_var(GlobalVarVector::const_iterator position, GlobalVar* n); + /** + * \brief Erase members to variables + */ + GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first, GlobalVarVector::const_iterator last); -/** - * \brief Reset member to variables - */ -void reset_global_var(GlobalVarVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to variables + * + * loosely following the cpp reference of remove_if + */ + size_t erase_global_var(std::unordered_set& to_be_erased); + /** + * \brief Insert member to variables + */ + GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to variables + */ + template + void insert_global_var(GlobalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref Global.variables - */ - const GlobalVarVector& get_variables() const noexcept { - return variables; - } - + /** + * \brief Reset member to variables + */ + void reset_global_var(GlobalVarVector::const_iterator position, GlobalVar* n); + /** + * \brief Reset member to variables + */ + void reset_global_var(GlobalVarVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref Global.variables + */ + const GlobalVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Global.variables (rvalue reference) + */ + void set_variables(GlobalVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Global.variables (rvalue reference) - */ - void set_variables(GlobalVarVector&& variables); - - /** - * \brief Setter for member variable \ref Global.variables - */ - void set_variables(const GlobalVarVector& variables); - + /** + * \brief Setter for member variable \ref Global.variables + */ + void set_variables(const GlobalVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -297,11 +270,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -313,7 +283,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/global_var.hpp ast/global_var.hpp --- ast.orig/global_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/global_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class GlobalVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit GlobalVar(Name* name); - explicit GlobalVar(std::shared_ptr name); + explicit GlobalVar(const std::shared_ptr& name); GlobalVar(const GlobalVar& obj); - - - virtual ~GlobalVar() = default; - + virtual ~GlobalVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::GlobalVar * \return true as object is of type ast::GlobalVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) GlobalVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref GlobalVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref GlobalVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref GlobalVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref GlobalVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref GlobalVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref GlobalVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/identifier.hpp ast/identifier.hpp --- ast.orig/identifier.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/identifier.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -44,21 +42,11 @@ class Identifier : public Expression { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Identifier() = default; - + virtual ~Identifier() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Identifier * \return true as object is of type ast::Identifier @@ -75,7 +63,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Identifier* clone() const override { @@ -130,23 +118,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -188,14 +165,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/if_statement.hpp ast/if_statement.hpp --- ast.orig/if_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/if_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/else_if_statement.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,35 +40,25 @@ class IfStatement : public Statement { private: /// TODO - std::shared_ptr condition; + std::shared_ptr condition; /// TODO - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// TODO - ElseIfStatementVector elseifs; + ElseIfStatementVector elseifs; /// TODO - std::shared_ptr elses; + std::shared_ptr elses; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit IfStatement(Expression* condition, StatementBlock* statement_block, ElseIfStatementVector elseifs, ElseStatement* elses); - explicit IfStatement(std::shared_ptr condition, std::shared_ptr statement_block, const ElseIfStatementVector& elseifs, std::shared_ptr elses); + explicit IfStatement(Expression* condition, StatementBlock* statement_block, const ElseIfStatementVector& elseifs, ElseStatement* elses); + explicit IfStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block, const ElseIfStatementVector& elseifs, const std::shared_ptr& elses); IfStatement(const IfStatement& obj); - - - virtual ~IfStatement() = default; - + virtual ~IfStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::IfStatement * \return true as object is of type ast::IfStatement @@ -87,7 +75,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) IfStatement* clone() const override { @@ -156,137 +144,110 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref IfStatement.condition - */ - std::shared_ptr get_condition() const noexcept { - return condition; - } - - - - - - - - /** - * \brief Getter for member variable \ref IfStatement.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref IfStatement.elseifs - */ - const ElseIfStatementVector& get_elseifs() const noexcept { - return elseifs; - } - - - - - - - - /** - * \brief Getter for member variable \ref IfStatement.elses - */ - std::shared_ptr get_elses() const noexcept { - return elses; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref IfStatement.condition + */ + const std::shared_ptr& get_condition() const noexcept { + return condition; + } + + + + /** + * \brief Getter for member variable \ref IfStatement.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } + + + + /** + * \brief Getter for member variable \ref IfStatement.elseifs + */ + const ElseIfStatementVector& get_elseifs() const noexcept { + return elseifs; + } + + + + /** + * \brief Getter for member variable \ref IfStatement.elses + */ + const std::shared_ptr& get_elses() const noexcept { + return elses; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref IfStatement.condition (rvalue reference) + */ + void set_condition(std::shared_ptr&& condition); + /** + * \brief Setter for member variable \ref IfStatement.condition + */ + void set_condition(const std::shared_ptr& condition); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref IfStatement.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); + + /** + * \brief Setter for member variable \ref IfStatement.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); + + /** + * \brief Setter for member variable \ref IfStatement.elseifs (rvalue reference) + */ + void set_elseifs(ElseIfStatementVector&& elseifs); + + /** + * \brief Setter for member variable \ref IfStatement.elseifs + */ + void set_elseifs(const ElseIfStatementVector& elseifs); + + /** + * \brief Setter for member variable \ref IfStatement.elses (rvalue reference) + */ + void set_elses(std::shared_ptr&& elses); - - /** - * \brief Setter for member variable \ref IfStatement.condition (rvalue reference) - */ - void set_condition(std::shared_ptr&& condition); - - /** - * \brief Setter for member variable \ref IfStatement.condition - */ - void set_condition(const std::shared_ptr& condition); - - - /** - * \brief Setter for member variable \ref IfStatement.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref IfStatement.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - - - /** - * \brief Setter for member variable \ref IfStatement.elseifs (rvalue reference) - */ - void set_elseifs(ElseIfStatementVector&& elseifs); - - /** - * \brief Setter for member variable \ref IfStatement.elseifs - */ - void set_elseifs(const ElseIfStatementVector& elseifs); - - - /** - * \brief Setter for member variable \ref IfStatement.elses (rvalue reference) - */ - void set_elses(std::shared_ptr&& elses); - - /** - * \brief Setter for member variable \ref IfStatement.elses - */ - void set_elses(const std::shared_ptr& elses); - + /** + * \brief Setter for member variable \ref IfStatement.elses + */ + void set_elses(const std::shared_ptr& elses); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -328,11 +289,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -344,7 +302,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/include.hpp ast/include.hpp --- ast.orig/include.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/include.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/node.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,31 +40,21 @@ class Include : public Statement { private: /// path to the file to include - std::shared_ptr filename; + std::shared_ptr filename; /// AST of the included file - NodeVector blocks; + NodeVector blocks; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Include(String* filename, NodeVector blocks); - explicit Include(std::shared_ptr filename, const NodeVector& blocks); + explicit Include(String* filename, const NodeVector& blocks); + explicit Include(const std::shared_ptr& filename, const NodeVector& blocks); Include(const Include& obj); - - - virtual ~Include() = default; - + virtual ~Include() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Include * \return true as object is of type ast::Include @@ -83,7 +71,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Include* clone() const override { @@ -152,89 +140,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Include.filename - */ - std::shared_ptr get_filename() const noexcept { - return filename; - } - - - - - - - - /** - * \brief Getter for member variable \ref Include.blocks - */ - const NodeVector& get_blocks() const noexcept { - return blocks; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Include.filename + */ + const std::shared_ptr& get_filename() const noexcept { + return filename; + } + + + + /** + * \brief Getter for member variable \ref Include.blocks + */ + const NodeVector& get_blocks() const noexcept { + return blocks; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Include.filename (rvalue reference) + */ + void set_filename(std::shared_ptr&& filename); + /** + * \brief Setter for member variable \ref Include.filename + */ + void set_filename(const std::shared_ptr& filename); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Include.blocks (rvalue reference) + */ + void set_blocks(NodeVector&& blocks); - - /** - * \brief Setter for member variable \ref Include.filename (rvalue reference) - */ - void set_filename(std::shared_ptr&& filename); - - /** - * \brief Setter for member variable \ref Include.filename - */ - void set_filename(const std::shared_ptr& filename); - - - /** - * \brief Setter for member variable \ref Include.blocks (rvalue reference) - */ - void set_blocks(NodeVector&& blocks); - - /** - * \brief Setter for member variable \ref Include.blocks - */ - void set_blocks(const NodeVector& blocks); - + /** + * \brief Setter for member variable \ref Include.blocks + */ + void set_blocks(const NodeVector& blocks); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -276,11 +245,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -292,7 +258,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/independent_block.hpp ast/independent_block.hpp --- ast.orig/independent_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/independent_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/name.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -49,30 +47,20 @@ class IndependentBlock : public Block { private: /// List of variable that should be independent - NameVector variables; + NameVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit IndependentBlock(NameVector variables); + explicit IndependentBlock(const NameVector& variables); IndependentBlock(const IndependentBlock& obj); - - - virtual ~IndependentBlock() = default; - + virtual ~IndependentBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::IndependentBlock * \return true as object is of type ast::IndependentBlock @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) IndependentBlock* clone() const override { @@ -158,92 +146,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref IndependentBlock.variables - */ - const NameVector& get_variables() const noexcept { - return variables; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref IndependentBlock.variables + */ + const NameVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref IndependentBlock.variables (rvalue reference) + */ + void set_variables(NameVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref IndependentBlock.variables (rvalue reference) - */ - void set_variables(NameVector&& variables); - - /** - * \brief Setter for member variable \ref IndependentBlock.variables - */ - void set_variables(const NameVector& variables); - + /** + * \brief Setter for member variable \ref IndependentBlock.variables + */ + void set_variables(const NameVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -285,11 +257,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -301,7 +270,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/indexed_name.hpp ast/indexed_name.hpp --- ast.orig/indexed_name.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/indexed_name.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -51,31 +49,21 @@ class IndexedName : public Identifier { private: /// Name of array variable - std::shared_ptr name; + std::shared_ptr name; /// length of an array or index position - std::shared_ptr length; + std::shared_ptr length; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit IndexedName(Identifier* name, Expression* length); - explicit IndexedName(std::shared_ptr name, std::shared_ptr length); + explicit IndexedName(const std::shared_ptr& name, const std::shared_ptr& length); IndexedName(const IndexedName& obj); - - - virtual ~IndexedName() = default; - + virtual ~IndexedName() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::IndexedName * \return true as object is of type ast::IndexedName @@ -92,7 +80,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) IndexedName* clone() const override { @@ -147,101 +135,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref IndexedName.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref IndexedName.length - */ - std::shared_ptr get_length() const noexcept { - return length; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref IndexedName.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref IndexedName.length + */ + const std::shared_ptr& get_length() const noexcept { + return length; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref IndexedName.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref IndexedName.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref IndexedName.length (rvalue reference) + */ + void set_length(std::shared_ptr&& length); - - /** - * \brief Setter for member variable \ref IndexedName.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref IndexedName.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref IndexedName.length (rvalue reference) - */ - void set_length(std::shared_ptr&& length); - - /** - * \brief Setter for member variable \ref IndexedName.length - */ - void set_length(const std::shared_ptr& length); - + /** + * \brief Setter for member variable \ref IndexedName.length + */ + void set_length(const std::shared_ptr& length); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -283,11 +252,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -299,7 +265,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/initial_block.hpp ast/initial_block.hpp --- ast.orig/initial_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/initial_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -52,31 +50,21 @@ class InitialBlock : public Block { private: /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit InitialBlock(StatementBlock* statement_block); - explicit InitialBlock(std::shared_ptr statement_block); + explicit InitialBlock(const std::shared_ptr& statement_block); InitialBlock(const InitialBlock& obj); - - - virtual ~InitialBlock() = default; - + virtual ~InitialBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::InitialBlock * \return true as object is of type ast::InitialBlock @@ -93,7 +81,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) InitialBlock* clone() const override { @@ -162,92 +150,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref InitialBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref InitialBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref InitialBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref InitialBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref InitialBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref InitialBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -289,11 +261,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -305,7 +274,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/integer.hpp ast/integer.hpp --- ast.orig/integer.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/integer.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/number.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -52,32 +50,22 @@ class Integer : public Number { private: /// Value of integer - int value; + int value; /// if integer is a macro then it's name - std::shared_ptr macro; + std::shared_ptr macro; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Integer(int value, Name* macro); - explicit Integer(int value, std::shared_ptr macro); + explicit Integer(int value, const std::shared_ptr& macro); Integer(const Integer& obj); - Integer() = default; - - virtual ~Integer() = default; - + virtual ~Integer() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Integer * \return true as object is of type ast::Integer @@ -94,7 +82,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Integer* clone() const override { @@ -149,91 +137,72 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Integer.value - */ - int get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref Integer.macro - */ - std::shared_ptr get_macro() const noexcept { - return macro; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Integer.value + */ + int get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref Integer.macro + */ + const std::shared_ptr& get_macro() const noexcept { + return macro; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set new value to the current ast node + * \sa Integer::eval + */ + void set(int _value) { + value = _value; + } + + /** + * \brief Setter for member variable \ref Integer.value + */ + void set_value(int value); + + /** + * \brief Setter for member variable \ref Integer.macro (rvalue reference) + */ + void set_macro(std::shared_ptr&& macro); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - /** - * \brief Set new value to the current ast node - * \sa Integer::eval - */ - void set(int _value) { - value = _value; - } - - - /** - * \brief Setter for member variable \ref Integer.value - */ - void set_value(int value); - - - /** - * \brief Setter for member variable \ref Integer.macro (rvalue reference) - */ - void set_macro(std::shared_ptr&& macro); - - /** - * \brief Setter for member variable \ref Integer.macro - */ - void set_macro(const std::shared_ptr& macro); - + /** + * \brief Setter for member variable \ref Integer.macro + */ + void set_macro(const std::shared_ptr& macro); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,7 +244,6 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} /** @@ -295,7 +263,6 @@ double to_double() override { return value; } - /** * \brief Return value of the ast node * @@ -308,7 +275,6 @@ int eval() const { return value; } - private: /** * \brief Set this object as parent for all the children @@ -320,7 +286,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/kinetic_block.hpp ast/kinetic_block.hpp --- ast.orig/kinetic_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/kinetic_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/name.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,35 +40,25 @@ class KineticBlock : public Block { private: /// Name of the kinetic block - std::shared_ptr name; + std::shared_ptr name; /// Solve for specification (TODO) - NameVector solvefor; + NameVector solvefor; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit KineticBlock(Name* name, NameVector solvefor, StatementBlock* statement_block); - explicit KineticBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block); + explicit KineticBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block); + explicit KineticBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block); KineticBlock(const KineticBlock& obj); - - - virtual ~KineticBlock() = default; - + virtual ~KineticBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::KineticBlock * \return true as object is of type ast::KineticBlock @@ -87,7 +75,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) KineticBlock* clone() const override { @@ -156,152 +144,128 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref KineticBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref KineticBlock.solvefor - */ - const NameVector& get_solvefor() const noexcept { - return solvefor; - } - - - - - - - - /** - * \brief Getter for member variable \ref KineticBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref KineticBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref KineticBlock.solvefor + */ + const NameVector& get_solvefor() const noexcept { + return solvefor; + } + + + + /** + * \brief Getter for member variable \ref KineticBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref KineticBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref KineticBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref KineticBlock.solvefor (rvalue reference) + */ + void set_solvefor(NameVector&& solvefor); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref KineticBlock.solvefor + */ + void set_solvefor(const NameVector& solvefor); + + /** + * \brief Setter for member variable \ref KineticBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref KineticBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref KineticBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref KineticBlock.solvefor (rvalue reference) - */ - void set_solvefor(NameVector&& solvefor); - - /** - * \brief Setter for member variable \ref KineticBlock.solvefor - */ - void set_solvefor(const NameVector& solvefor); - - - /** - * \brief Setter for member variable \ref KineticBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref KineticBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref KineticBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -343,11 +307,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -359,7 +320,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/lag_statement.hpp ast/lag_statement.hpp --- ast.orig/lag_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/lag_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -50,31 +48,21 @@ class LagStatement : public Statement { private: /// Name of the variable (TODO) - std::shared_ptr name; + std::shared_ptr name; /// Name of the variable (TODO) - std::shared_ptr byname; + std::shared_ptr byname; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit LagStatement(Identifier* name, Name* byname); - explicit LagStatement(std::shared_ptr name, std::shared_ptr byname); + explicit LagStatement(const std::shared_ptr& name, const std::shared_ptr& byname); LagStatement(const LagStatement& obj); - - - virtual ~LagStatement() = default; - + virtual ~LagStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LagStatement * \return true as object is of type ast::LagStatement @@ -91,7 +79,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LagStatement* clone() const override { @@ -160,89 +148,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref LagStatement.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref LagStatement.byname - */ - std::shared_ptr get_byname() const noexcept { - return byname; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref LagStatement.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref LagStatement.byname + */ + const std::shared_ptr& get_byname() const noexcept { + return byname; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LagStatement.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref LagStatement.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref LagStatement.byname (rvalue reference) + */ + void set_byname(std::shared_ptr&& byname); - - /** - * \brief Setter for member variable \ref LagStatement.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref LagStatement.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref LagStatement.byname (rvalue reference) - */ - void set_byname(std::shared_ptr&& byname); - - /** - * \brief Setter for member variable \ref LagStatement.byname - */ - void set_byname(const std::shared_ptr& byname); - + /** + * \brief Setter for member variable \ref LagStatement.byname + */ + void set_byname(const std::shared_ptr& byname); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -284,11 +253,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -300,7 +266,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/limits.hpp ast/limits.hpp --- ast.orig/limits.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/limits.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Limits : public Expression { private: /// TODO - std::shared_ptr min; + std::shared_ptr min; /// TODO - std::shared_ptr max; + std::shared_ptr max; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Limits(Double* min, Double* max); - explicit Limits(std::shared_ptr min, std::shared_ptr max); + explicit Limits(const std::shared_ptr& min, const std::shared_ptr& max); Limits(const Limits& obj); - - - virtual ~Limits() = default; - + virtual ~Limits() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Limits * \return true as object is of type ast::Limits @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Limits* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Limits.min - */ - std::shared_ptr get_min() const noexcept { - return min; - } - - - - - - - - /** - * \brief Getter for member variable \ref Limits.max - */ - std::shared_ptr get_max() const noexcept { - return max; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Limits.min + */ + const std::shared_ptr& get_min() const noexcept { + return min; + } + + + + /** + * \brief Getter for member variable \ref Limits.max + */ + const std::shared_ptr& get_max() const noexcept { + return max; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Limits.min (rvalue reference) + */ + void set_min(std::shared_ptr&& min); + /** + * \brief Setter for member variable \ref Limits.min + */ + void set_min(const std::shared_ptr& min); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Limits.max (rvalue reference) + */ + void set_max(std::shared_ptr&& max); - - /** - * \brief Setter for member variable \ref Limits.min (rvalue reference) - */ - void set_min(std::shared_ptr&& min); - - /** - * \brief Setter for member variable \ref Limits.min - */ - void set_min(const std::shared_ptr& min); - - - /** - * \brief Setter for member variable \ref Limits.max (rvalue reference) - */ - void set_max(std::shared_ptr&& max); - - /** - * \brief Setter for member variable \ref Limits.max - */ - void set_max(const std::shared_ptr& max); - + /** + * \brief Setter for member variable \ref Limits.max + */ + void set_max(const std::shared_ptr& max); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/lin_equation.hpp ast/lin_equation.hpp --- ast.orig/lin_equation.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/lin_equation.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class LinEquation : public Expression { private: /// TODO - std::shared_ptr left_linxpression; + std::shared_ptr left_linxpression; /// TODO - std::shared_ptr linxpression; + std::shared_ptr linxpression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit LinEquation(Expression* left_linxpression, Expression* linxpression); - explicit LinEquation(std::shared_ptr left_linxpression, std::shared_ptr linxpression); + explicit LinEquation(const std::shared_ptr& left_linxpression, const std::shared_ptr& linxpression); LinEquation(const LinEquation& obj); - - - virtual ~LinEquation() = default; - + virtual ~LinEquation() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LinEquation * \return true as object is of type ast::LinEquation @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LinEquation* clone() const override { @@ -151,89 +139,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref LinEquation.left_linxpression - */ - std::shared_ptr get_left_linxpression() const noexcept { - return left_linxpression; - } - - - - - - - - /** - * \brief Getter for member variable \ref LinEquation.linxpression - */ - std::shared_ptr get_linxpression() const noexcept { - return linxpression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref LinEquation.left_linxpression + */ + const std::shared_ptr& get_left_linxpression() const noexcept { + return left_linxpression; + } + + + + /** + * \brief Getter for member variable \ref LinEquation.linxpression + */ + const std::shared_ptr& get_linxpression() const noexcept { + return linxpression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LinEquation.left_linxpression (rvalue reference) + */ + void set_left_linxpression(std::shared_ptr&& left_linxpression); + /** + * \brief Setter for member variable \ref LinEquation.left_linxpression + */ + void set_left_linxpression(const std::shared_ptr& left_linxpression); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref LinEquation.linxpression (rvalue reference) + */ + void set_linxpression(std::shared_ptr&& linxpression); - - /** - * \brief Setter for member variable \ref LinEquation.left_linxpression (rvalue reference) - */ - void set_left_linxpression(std::shared_ptr&& left_linxpression); - - /** - * \brief Setter for member variable \ref LinEquation.left_linxpression - */ - void set_left_linxpression(const std::shared_ptr& left_linxpression); - - - /** - * \brief Setter for member variable \ref LinEquation.linxpression (rvalue reference) - */ - void set_linxpression(std::shared_ptr&& linxpression); - - /** - * \brief Setter for member variable \ref LinEquation.linxpression - */ - void set_linxpression(const std::shared_ptr& linxpression); - + /** + * \brief Setter for member variable \ref LinEquation.linxpression + */ + void set_linxpression(const std::shared_ptr& linxpression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,11 +244,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -291,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/line_comment.hpp ast/line_comment.hpp --- ast.orig/line_comment.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/line_comment.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class LineComment : public Statement { private: /// comment text - std::shared_ptr statement; + std::shared_ptr statement; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit LineComment(String* statement); - explicit LineComment(std::shared_ptr statement); + explicit LineComment(const std::shared_ptr& statement); LineComment(const LineComment& obj); - - - virtual ~LineComment() = default; - + virtual ~LineComment() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LineComment * \return true as object is of type ast::LineComment @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LineComment* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref LineComment.statement - */ - std::shared_ptr get_statement() const noexcept { - return statement; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref LineComment.statement + */ + const std::shared_ptr& get_statement() const noexcept { + return statement; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LineComment.statement (rvalue reference) + */ + void set_statement(std::shared_ptr&& statement); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref LineComment.statement (rvalue reference) - */ - void set_statement(std::shared_ptr&& statement); - - /** - * \brief Setter for member variable \ref LineComment.statement - */ - void set_statement(const std::shared_ptr& statement); - + /** + * \brief Setter for member variable \ref LineComment.statement + */ + void set_statement(const std::shared_ptr& statement); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/linear_block.hpp ast/linear_block.hpp --- ast.orig/linear_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/linear_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/name.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,35 +54,25 @@ class LinearBlock : public Block { private: /// Name of the linear block - std::shared_ptr name; + std::shared_ptr name; /// TODO - NameVector solvefor; + NameVector solvefor; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit LinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block); - explicit LinearBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block); + explicit LinearBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block); + explicit LinearBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block); LinearBlock(const LinearBlock& obj); - - - virtual ~LinearBlock() = default; - + virtual ~LinearBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LinearBlock * \return true as object is of type ast::LinearBlock @@ -101,7 +89,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LinearBlock* clone() const override { @@ -170,152 +158,128 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref LinearBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref LinearBlock.solvefor - */ - const NameVector& get_solvefor() const noexcept { - return solvefor; - } - - - - - - - - /** - * \brief Getter for member variable \ref LinearBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref LinearBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref LinearBlock.solvefor + */ + const NameVector& get_solvefor() const noexcept { + return solvefor; + } + + + + /** + * \brief Getter for member variable \ref LinearBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref LinearBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref LinearBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LinearBlock.solvefor (rvalue reference) + */ + void set_solvefor(NameVector&& solvefor); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref LinearBlock.solvefor + */ + void set_solvefor(const NameVector& solvefor); + + /** + * \brief Setter for member variable \ref LinearBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref LinearBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref LinearBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref LinearBlock.solvefor (rvalue reference) - */ - void set_solvefor(NameVector&& solvefor); - - /** - * \brief Setter for member variable \ref LinearBlock.solvefor - */ - void set_solvefor(const NameVector& solvefor); - - - /** - * \brief Setter for member variable \ref LinearBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref LinearBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref LinearBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -357,11 +321,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -373,7 +334,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/local_list_statement.hpp ast/local_list_statement.hpp --- ast.orig/local_list_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/local_list_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/local_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class LocalListStatement : public Statement { private: /// TODO - LocalVarVector variables; + LocalVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit LocalListStatement(LocalVarVector variables); + explicit LocalListStatement(const LocalVarVector& variables); LocalListStatement(const LocalListStatement& obj); - - - virtual ~LocalListStatement() = default; - + virtual ~LocalListStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LocalListStatement * \return true as object is of type ast::LocalListStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LocalListStatement* clone() const override { @@ -149,113 +137,98 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - -/** - * \brief Add member to variables by raw pointer - */ -void emplace_back_local_var(LocalVar *n); - -/** - * \brief Add member to variables by shared_ptr - */ -void emplace_back_local_var(std::shared_ptr n); - -/** - * \brief Erase member to variables - */ -LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first); - -/** - * \brief Erase members to variables - */ -LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first, LocalVarVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to variables - * - * loosely following the cpp reference of remove_if - */ -size_t erase_local_var(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + /** + * \brief Add member to variables by raw pointer + */ + void emplace_back_local_var(LocalVar *n); -/** - * \brief Insert member to variables - */ -LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to variables by shared_ptr + */ + void emplace_back_local_var(std::shared_ptr n); -/** - * \brief Insert members to variables - */ -template -void insert_local_var(LocalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to variables + */ + LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first); -/** - * \brief Reset member to variables - */ -void reset_local_var(LocalVarVector::const_iterator position, LocalVar* n); + /** + * \brief Erase members to variables + */ + LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first, LocalVarVector::const_iterator last); -/** - * \brief Reset member to variables - */ -void reset_local_var(LocalVarVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to variables + * + * loosely following the cpp reference of remove_if + */ + size_t erase_local_var(std::unordered_set& to_be_erased); + /** + * \brief Insert member to variables + */ + LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to variables + */ + template + void insert_local_var(LocalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref LocalListStatement.variables - */ - const LocalVarVector& get_variables() const noexcept { - return variables; - } - + /** + * \brief Reset member to variables + */ + void reset_local_var(LocalVarVector::const_iterator position, LocalVar* n); + /** + * \brief Reset member to variables + */ + void reset_local_var(LocalVarVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref LocalListStatement.variables + */ + const LocalVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LocalListStatement.variables (rvalue reference) + */ + void set_variables(LocalVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref LocalListStatement.variables (rvalue reference) - */ - void set_variables(LocalVarVector&& variables); - - /** - * \brief Setter for member variable \ref LocalListStatement.variables - */ - void set_variables(const LocalVarVector& variables); - + /** + * \brief Setter for member variable \ref LocalListStatement.variables + */ + void set_variables(const LocalVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -297,11 +270,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -313,7 +283,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/local_var.hpp ast/local_var.hpp --- ast.orig/local_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/local_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class LocalVar : public Expression { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit LocalVar(Identifier* name); - explicit LocalVar(std::shared_ptr name); + explicit LocalVar(const std::shared_ptr& name); LocalVar(const LocalVar& obj); - - - virtual ~LocalVar() = default; - + virtual ~LocalVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LocalVar * \return true as object is of type ast::LocalVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LocalVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref LocalVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref LocalVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LocalVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref LocalVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref LocalVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref LocalVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/lon_difuse.hpp ast/lon_difuse.hpp --- ast.orig/lon_difuse.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/lon_difuse.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/name.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,33 +40,23 @@ class LonDifuse : public Statement { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// TODO - NameVector names; + NameVector names; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit LonDifuse(Name* name, Expression* expression, NameVector names); - explicit LonDifuse(std::shared_ptr name, std::shared_ptr expression, const NameVector& names); + explicit LonDifuse(Name* name, Expression* expression, const NameVector& names); + explicit LonDifuse(const std::shared_ptr& name, const std::shared_ptr& expression, const NameVector& names); LonDifuse(const LonDifuse& obj); - - - virtual ~LonDifuse() = default; - + virtual ~LonDifuse() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::LonDifuse * \return true as object is of type ast::LonDifuse @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) LonDifuse* clone() const override { @@ -154,113 +142,90 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref LonDifuse.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref LonDifuse.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - - - - - - /** - * \brief Getter for member variable \ref LonDifuse.names - */ - const NameVector& get_names() const noexcept { - return names; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref LonDifuse.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref LonDifuse.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } + + + + /** + * \brief Getter for member variable \ref LonDifuse.names + */ + const NameVector& get_names() const noexcept { + return names; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LonDifuse.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref LonDifuse.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref LonDifuse.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); + /** + * \brief Setter for member variable \ref LonDifuse.expression + */ + void set_expression(const std::shared_ptr& expression); + + /** + * \brief Setter for member variable \ref LonDifuse.names (rvalue reference) + */ + void set_names(NameVector&& names); - - /** - * \brief Setter for member variable \ref LonDifuse.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref LonDifuse.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref LonDifuse.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref LonDifuse.expression - */ - void set_expression(const std::shared_ptr& expression); - - - /** - * \brief Setter for member variable \ref LonDifuse.names (rvalue reference) - */ - void set_names(NameVector&& names); - - /** - * \brief Setter for member variable \ref LonDifuse.names - */ - void set_names(const NameVector& names); - + /** + * \brief Setter for member variable \ref LonDifuse.names + */ + void set_names(const NameVector& names); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -302,11 +267,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -318,7 +280,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/model.hpp ast/model.hpp --- ast.orig/model.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/model.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class Model : public Statement { private: /// TODO - std::shared_ptr title; + std::shared_ptr title; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Model(String* title); - explicit Model(std::shared_ptr title); + explicit Model(const std::shared_ptr& title); Model(const Model& obj); - - - virtual ~Model() = default; - + virtual ~Model() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Model * \return true as object is of type ast::Model @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Model* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Model.title - */ - std::shared_ptr get_title() const noexcept { - return title; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Model.title + */ + const std::shared_ptr& get_title() const noexcept { + return title; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Model.title (rvalue reference) + */ + void set_title(std::shared_ptr&& title); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Model.title (rvalue reference) - */ - void set_title(std::shared_ptr&& title); - - /** - * \brief Setter for member variable \ref Model.title - */ - void set_title(const std::shared_ptr& title); - + /** + * \brief Setter for member variable \ref Model.title + */ + void set_title(const std::shared_ptr& title); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/mutex_lock.hpp ast/mutex_lock.hpp --- ast.orig/mutex_lock.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/mutex_lock.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,24 +39,14 @@ class MutexLock : public Statement { private: /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - - - virtual ~MutexLock() = default; - + virtual ~MutexLock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::MutexLock * \return true as object is of type ast::MutexLock @@ -75,7 +63,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) MutexLock* clone() const override { @@ -144,41 +132,30 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -220,14 +197,11 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/mutex_unlock.hpp ast/mutex_unlock.hpp --- ast.orig/mutex_unlock.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/mutex_unlock.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,24 +39,14 @@ class MutexUnlock : public Statement { private: /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - - - virtual ~MutexUnlock() = default; - + virtual ~MutexUnlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::MutexUnlock * \return true as object is of type ast::MutexUnlock @@ -75,7 +63,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) MutexUnlock* clone() const override { @@ -144,41 +132,30 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -220,14 +197,11 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/name.hpp ast/name.hpp --- ast.orig/name.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/name.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -47,30 +45,20 @@ class Name : public Identifier { private: /// Value of name - std::shared_ptr value; + std::shared_ptr value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Name(String* value); - explicit Name(std::shared_ptr value); + explicit Name(const std::shared_ptr& value); Name(const Name& obj); - Name() = default; - - virtual ~Name() = default; - + virtual ~Name() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Name * \return true as object is of type ast::Name @@ -87,7 +75,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Name* clone() const override { @@ -142,87 +130,72 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::String has value designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref Name.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::String has value designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Name.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ + /** + * \brief Set name for the current ast node + * + * Some ast nodes have a member marked designated as node name (e.g. nodes + * derived from ast::Identifier). This method is used to set new name for those + * nodes. This useful for passes like nmodl::visitor::RenameVisitor. + * + * \sa Ast::get_node_type_name Ast::get_node_name + */ + void set_name(const std::string& name) override; + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Name.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - /** - * \brief Set name for the current ast node - * - * Some ast nodes have a member marked designated as node name (e.g. nodes - * derived from ast::Identifier). This method is used to set new name for those - * nodes. This useful for passes like nmodl::visitor::RenameVisitor. - * - * \sa Ast::get_node_type_name Ast::get_node_name - */ - void set_name(const std::string& name) override; - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Name.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Name.value - */ - void set_value(const std::shared_ptr& value); - + /** + * \brief Setter for member variable \ref Name.value + */ + void set_value(const std::shared_ptr& value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -264,11 +237,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -280,7 +250,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/net_receive_block.hpp ast/net_receive_block.hpp --- ast.orig/net_receive_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/net_receive_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/argument.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,33 +40,23 @@ class NetReceiveBlock : public Block { private: /// Parameters to the net receive block - ArgumentVector parameters; + ArgumentVector parameters; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit NetReceiveBlock(ArgumentVector parameters, StatementBlock* statement_block); - explicit NetReceiveBlock(const ArgumentVector& parameters, std::shared_ptr statement_block); + explicit NetReceiveBlock(const ArgumentVector& parameters, StatementBlock* statement_block); + explicit NetReceiveBlock(const ArgumentVector& parameters, const std::shared_ptr& statement_block); NetReceiveBlock(const NetReceiveBlock& obj); - - - virtual ~NetReceiveBlock() = default; - + virtual ~NetReceiveBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NetReceiveBlock * \return true as object is of type ast::NetReceiveBlock @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NetReceiveBlock* clone() const override { @@ -154,116 +142,96 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref NetReceiveBlock.parameters - */ - const ArgumentVector& get_parameters() const noexcept override { - return parameters; - } - - - - - - - - /** - * \brief Getter for member variable \ref NetReceiveBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref NetReceiveBlock.parameters + */ + const ArgumentVector& get_parameters() const noexcept override { + return parameters; + } + + + + /** + * \brief Getter for member variable \ref NetReceiveBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref NetReceiveBlock.parameters (rvalue reference) + */ + void set_parameters(ArgumentVector&& parameters); + /** + * \brief Setter for member variable \ref NetReceiveBlock.parameters + */ + void set_parameters(const ArgumentVector& parameters); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - + + /** + * \brief Setter for member variable \ref NetReceiveBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref NetReceiveBlock.parameters (rvalue reference) - */ - void set_parameters(ArgumentVector&& parameters); - - /** - * \brief Setter for member variable \ref NetReceiveBlock.parameters - */ - void set_parameters(const ArgumentVector& parameters); - - - /** - * \brief Setter for member variable \ref NetReceiveBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref NetReceiveBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref NetReceiveBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -305,11 +273,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -321,7 +286,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/neuron_block.hpp ast/neuron_block.hpp --- ast.orig/neuron_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/neuron_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,31 +54,21 @@ class NeuronBlock : public Block { private: /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit NeuronBlock(StatementBlock* statement_block); - explicit NeuronBlock(std::shared_ptr statement_block); + explicit NeuronBlock(const std::shared_ptr& statement_block); NeuronBlock(const NeuronBlock& obj); - - - virtual ~NeuronBlock() = default; - + virtual ~NeuronBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NeuronBlock * \return true as object is of type ast::NeuronBlock @@ -97,7 +85,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NeuronBlock* clone() const override { @@ -166,92 +154,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref NeuronBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref NeuronBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref NeuronBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref NeuronBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref NeuronBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref NeuronBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -293,11 +265,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -309,7 +278,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/node.hpp ast/node.hpp --- ast.orig/node.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/node.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/ast.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -43,21 +41,11 @@ class Node : public Ast { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Node() = default; - + virtual ~Node() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Node * \return true as object is of type ast::Node @@ -74,7 +62,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Node* clone() const override { @@ -129,23 +117,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -187,14 +164,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/non_lin_equation.hpp ast/non_lin_equation.hpp --- ast.orig/non_lin_equation.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/non_lin_equation.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class NonLinEquation : public Expression { private: /// TODO - std::shared_ptr lhs; + std::shared_ptr lhs; /// TODO - std::shared_ptr rhs; + std::shared_ptr rhs; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit NonLinEquation(Expression* lhs, Expression* rhs); - explicit NonLinEquation(std::shared_ptr lhs, std::shared_ptr rhs); + explicit NonLinEquation(const std::shared_ptr& lhs, const std::shared_ptr& rhs); NonLinEquation(const NonLinEquation& obj); - - - virtual ~NonLinEquation() = default; - + virtual ~NonLinEquation() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NonLinEquation * \return true as object is of type ast::NonLinEquation @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NonLinEquation* clone() const override { @@ -151,89 +139,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref NonLinEquation.lhs - */ - std::shared_ptr get_lhs() const noexcept { - return lhs; - } - - - - - - - - /** - * \brief Getter for member variable \ref NonLinEquation.rhs - */ - std::shared_ptr get_rhs() const noexcept { - return rhs; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref NonLinEquation.lhs + */ + const std::shared_ptr& get_lhs() const noexcept { + return lhs; + } + + + + /** + * \brief Getter for member variable \ref NonLinEquation.rhs + */ + const std::shared_ptr& get_rhs() const noexcept { + return rhs; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref NonLinEquation.lhs (rvalue reference) + */ + void set_lhs(std::shared_ptr&& lhs); + /** + * \brief Setter for member variable \ref NonLinEquation.lhs + */ + void set_lhs(const std::shared_ptr& lhs); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref NonLinEquation.rhs (rvalue reference) + */ + void set_rhs(std::shared_ptr&& rhs); - - /** - * \brief Setter for member variable \ref NonLinEquation.lhs (rvalue reference) - */ - void set_lhs(std::shared_ptr&& lhs); - - /** - * \brief Setter for member variable \ref NonLinEquation.lhs - */ - void set_lhs(const std::shared_ptr& lhs); - - - /** - * \brief Setter for member variable \ref NonLinEquation.rhs (rvalue reference) - */ - void set_rhs(std::shared_ptr&& rhs); - - /** - * \brief Setter for member variable \ref NonLinEquation.rhs - */ - void set_rhs(const std::shared_ptr& rhs); - + /** + * \brief Setter for member variable \ref NonLinEquation.rhs + */ + void set_rhs(const std::shared_ptr& rhs); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,11 +244,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -291,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/non_linear_block.hpp ast/non_linear_block.hpp --- ast.orig/non_linear_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/non_linear_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/name.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -53,35 +51,25 @@ class NonLinearBlock : public Block { private: /// Name of the non-linear block - std::shared_ptr name; + std::shared_ptr name; /// Name of the integration method - NameVector solvefor; + NameVector solvefor; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit NonLinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block); - explicit NonLinearBlock(std::shared_ptr name, const NameVector& solvefor, std::shared_ptr statement_block); + explicit NonLinearBlock(Name* name, const NameVector& solvefor, StatementBlock* statement_block); + explicit NonLinearBlock(const std::shared_ptr& name, const NameVector& solvefor, const std::shared_ptr& statement_block); NonLinearBlock(const NonLinearBlock& obj); - - - virtual ~NonLinearBlock() = default; - + virtual ~NonLinearBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NonLinearBlock * \return true as object is of type ast::NonLinearBlock @@ -98,7 +86,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NonLinearBlock* clone() const override { @@ -167,152 +155,128 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref NonLinearBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref NonLinearBlock.solvefor - */ - const NameVector& get_solvefor() const noexcept { - return solvefor; - } - - - - - - - - /** - * \brief Getter for member variable \ref NonLinearBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref NonLinearBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref NonLinearBlock.solvefor + */ + const NameVector& get_solvefor() const noexcept { + return solvefor; + } + + + + /** + * \brief Getter for member variable \ref NonLinearBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref NonLinearBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref NonLinearBlock.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref NonLinearBlock.solvefor (rvalue reference) + */ + void set_solvefor(NameVector&& solvefor); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref NonLinearBlock.solvefor + */ + void set_solvefor(const NameVector& solvefor); + + /** + * \brief Setter for member variable \ref NonLinearBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref NonLinearBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref NonLinearBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref NonLinearBlock.solvefor (rvalue reference) - */ - void set_solvefor(NameVector&& solvefor); - - /** - * \brief Setter for member variable \ref NonLinearBlock.solvefor - */ - void set_solvefor(const NameVector& solvefor); - - - /** - * \brief Setter for member variable \ref NonLinearBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref NonLinearBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref NonLinearBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -354,11 +318,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -370,7 +331,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/nonspecific.hpp ast/nonspecific.hpp --- ast.orig/nonspecific.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/nonspecific.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/nonspecific_cur_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class Nonspecific : public Statement { private: /// Vector of non specific variables - NonspecificCurVarVector currents; + NonspecificCurVarVector currents; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Nonspecific(NonspecificCurVarVector currents); + explicit Nonspecific(const NonspecificCurVarVector& currents); Nonspecific(const Nonspecific& obj); - - - virtual ~Nonspecific() = default; - + virtual ~Nonspecific() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Nonspecific * \return true as object is of type ast::Nonspecific @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Nonspecific* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Nonspecific.currents - */ - const NonspecificCurVarVector& get_currents() const noexcept { - return currents; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Nonspecific.currents + */ + const NonspecificCurVarVector& get_currents() const noexcept { + return currents; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Nonspecific.currents (rvalue reference) + */ + void set_currents(NonspecificCurVarVector&& currents); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Nonspecific.currents (rvalue reference) - */ - void set_currents(NonspecificCurVarVector&& currents); - - /** - * \brief Setter for member variable \ref Nonspecific.currents - */ - void set_currents(const NonspecificCurVarVector& currents); - + /** + * \brief Setter for member variable \ref Nonspecific.currents + */ + void set_currents(const NonspecificCurVarVector& currents); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/nonspecific_cur_var.hpp ast/nonspecific_cur_var.hpp --- ast.orig/nonspecific_cur_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/nonspecific_cur_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class NonspecificCurVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit NonspecificCurVar(Name* name); - explicit NonspecificCurVar(std::shared_ptr name); + explicit NonspecificCurVar(const std::shared_ptr& name); NonspecificCurVar(const NonspecificCurVar& obj); - - - virtual ~NonspecificCurVar() = default; - + virtual ~NonspecificCurVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NonspecificCurVar * \return true as object is of type ast::NonspecificCurVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NonspecificCurVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref NonspecificCurVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref NonspecificCurVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref NonspecificCurVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref NonspecificCurVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref NonspecificCurVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref NonspecificCurVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/nrn_state_block.hpp ast/nrn_state_block.hpp --- ast.orig/nrn_state_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/nrn_state_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,30 +40,20 @@ class NrnStateBlock : public Block { private: /// solve blocks to be called or generated - StatementVector solve_statements; + StatementVector solve_statements; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit NrnStateBlock(StatementVector solve_statements); + explicit NrnStateBlock(const StatementVector& solve_statements); NrnStateBlock(const NrnStateBlock& obj); - - - virtual ~NrnStateBlock() = default; - + virtual ~NrnStateBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NrnStateBlock * \return true as object is of type ast::NrnStateBlock @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NrnStateBlock* clone() const override { @@ -151,92 +139,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref NrnStateBlock.solve_statements - */ - const StatementVector& get_solve_statements() const noexcept { - return solve_statements; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref NrnStateBlock.solve_statements + */ + const StatementVector& get_solve_statements() const noexcept { + return solve_statements; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref NrnStateBlock.solve_statements (rvalue reference) + */ + void set_solve_statements(StatementVector&& solve_statements); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref NrnStateBlock.solve_statements (rvalue reference) - */ - void set_solve_statements(StatementVector&& solve_statements); - - /** - * \brief Setter for member variable \ref NrnStateBlock.solve_statements - */ - void set_solve_statements(const StatementVector& solve_statements); - + /** + * \brief Setter for member variable \ref NrnStateBlock.solve_statements + */ + void set_solve_statements(const StatementVector& solve_statements); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -278,11 +250,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -294,7 +263,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/number.hpp ast/number.hpp --- ast.orig/number.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/number.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,26 +40,16 @@ class Number : public Expression { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Number() = default; - + virtual ~Number() = default; /// \} - /// \name Not implemented /// \{ - - virtual double to_double() { throw std::runtime_error("to_double not implemented"); } - /// \} - /** * \brief Check if the ast node is an instance of ast::Number * \return true as object is of type ast::Number @@ -78,7 +66,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Number* clone() const override { @@ -133,23 +121,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -191,14 +168,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/number_range.hpp ast/number_range.hpp --- ast.orig/number_range.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/number_range.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class NumberRange : public Expression { private: /// TODO - std::shared_ptr min; + std::shared_ptr min; /// TODO - std::shared_ptr max; + std::shared_ptr max; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit NumberRange(Number* min, Number* max); - explicit NumberRange(std::shared_ptr min, std::shared_ptr max); + explicit NumberRange(const std::shared_ptr& min, const std::shared_ptr& max); NumberRange(const NumberRange& obj); - - - virtual ~NumberRange() = default; - + virtual ~NumberRange() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::NumberRange * \return true as object is of type ast::NumberRange @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) NumberRange* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref NumberRange.min - */ - std::shared_ptr get_min() const noexcept { - return min; - } - - - - - - - - /** - * \brief Getter for member variable \ref NumberRange.max - */ - std::shared_ptr get_max() const noexcept { - return max; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref NumberRange.min + */ + const std::shared_ptr& get_min() const noexcept { + return min; + } + + + + /** + * \brief Getter for member variable \ref NumberRange.max + */ + const std::shared_ptr& get_max() const noexcept { + return max; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref NumberRange.min (rvalue reference) + */ + void set_min(std::shared_ptr&& min); + /** + * \brief Setter for member variable \ref NumberRange.min + */ + void set_min(const std::shared_ptr& min); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref NumberRange.max (rvalue reference) + */ + void set_max(std::shared_ptr&& max); - - /** - * \brief Setter for member variable \ref NumberRange.min (rvalue reference) - */ - void set_min(std::shared_ptr&& min); - - /** - * \brief Setter for member variable \ref NumberRange.min - */ - void set_min(const std::shared_ptr& min); - - - /** - * \brief Setter for member variable \ref NumberRange.max (rvalue reference) - */ - void set_max(std::shared_ptr&& max); - - /** - * \brief Setter for member variable \ref NumberRange.max - */ - void set_max(const std::shared_ptr& max); - + /** + * \brief Setter for member variable \ref NumberRange.max + */ + void set_max(const std::shared_ptr& max); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/ontology_statement.hpp ast/ontology_statement.hpp --- ast.orig/ontology_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/ontology_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class OntologyStatement : public Statement { private: /// Ontology name - std::shared_ptr ontology_id; + std::shared_ptr ontology_id; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit OntologyStatement(String* ontology_id); - explicit OntologyStatement(std::shared_ptr ontology_id); + explicit OntologyStatement(const std::shared_ptr& ontology_id); OntologyStatement(const OntologyStatement& obj); - - - virtual ~OntologyStatement() = default; - + virtual ~OntologyStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::OntologyStatement * \return true as object is of type ast::OntologyStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) OntologyStatement* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref OntologyStatement.ontology_id - */ - std::shared_ptr get_ontology_id() const noexcept { - return ontology_id; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref OntologyStatement.ontology_id + */ + const std::shared_ptr& get_ontology_id() const noexcept { + return ontology_id; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref OntologyStatement.ontology_id (rvalue reference) + */ + void set_ontology_id(std::shared_ptr&& ontology_id); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref OntologyStatement.ontology_id (rvalue reference) - */ - void set_ontology_id(std::shared_ptr&& ontology_id); - - /** - * \brief Setter for member variable \ref OntologyStatement.ontology_id - */ - void set_ontology_id(const std::shared_ptr& ontology_id); - + /** + * \brief Setter for member variable \ref OntologyStatement.ontology_id + */ + void set_ontology_id(const std::shared_ptr& ontology_id); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/param_assign.hpp ast/param_assign.hpp --- ast.orig/param_assign.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/param_assign.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,35 +39,25 @@ class ParamAssign : public Statement { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// TODO - std::shared_ptr value; + std::shared_ptr value; /// TODO - std::shared_ptr unit; + std::shared_ptr unit; /// TODO - std::shared_ptr limit; + std::shared_ptr limit; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ParamAssign(Identifier* name, Number* value, Unit* unit, Limits* limit); - explicit ParamAssign(std::shared_ptr name, std::shared_ptr value, std::shared_ptr unit, std::shared_ptr limit); + explicit ParamAssign(const std::shared_ptr& name, const std::shared_ptr& value, const std::shared_ptr& unit, const std::shared_ptr& limit); ParamAssign(const ParamAssign& obj); - - - virtual ~ParamAssign() = default; - + virtual ~ParamAssign() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ParamAssign * \return true as object is of type ast::ParamAssign @@ -86,7 +74,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ParamAssign* clone() const override { @@ -141,149 +129,122 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ParamAssign.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref ParamAssign.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref ParamAssign.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - - - - - - /** - * \brief Getter for member variable \ref ParamAssign.limit - */ - std::shared_ptr get_limit() const noexcept { - return limit; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ParamAssign.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref ParamAssign.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref ParamAssign.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } + + + + /** + * \brief Getter for member variable \ref ParamAssign.limit + */ + const std::shared_ptr& get_limit() const noexcept { + return limit; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ParamAssign.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + + /** + * \brief Setter for member variable \ref ParamAssign.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref ParamAssign.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Setter for member variable \ref ParamAssign.value + */ + void set_value(const std::shared_ptr& value); + + /** + * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); + /** + * \brief Setter for member variable \ref ParamAssign.unit + */ + void set_unit(const std::shared_ptr& unit); - - /** - * \brief Setter for member variable \ref ParamAssign.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ParamAssign.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref ParamAssign.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref ParamAssign.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref ParamAssign.unit - */ - void set_unit(const std::shared_ptr& unit); - - - /** - * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference) - */ - void set_limit(std::shared_ptr&& limit); - - /** - * \brief Setter for member variable \ref ParamAssign.limit - */ - void set_limit(const std::shared_ptr& limit); - + + /** + * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference) + */ + void set_limit(std::shared_ptr&& limit); + + /** + * \brief Setter for member variable \ref ParamAssign.limit + */ + void set_limit(const std::shared_ptr& limit); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -325,11 +286,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -341,7 +299,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/param_block.hpp ast/param_block.hpp --- ast.orig/param_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/param_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/param_assign.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,30 +54,20 @@ class ParamBlock : public Block { private: /// Vector of parameters - ParamAssignVector statements; + ParamAssignVector statements; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit ParamBlock(ParamAssignVector statements); + explicit ParamBlock(const ParamAssignVector& statements); ParamBlock(const ParamBlock& obj); - - - virtual ~ParamBlock() = default; - + virtual ~ParamBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ParamBlock * \return true as object is of type ast::ParamBlock @@ -96,7 +84,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ParamBlock* clone() const override { @@ -165,92 +153,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref ParamBlock.statements - */ - const ParamAssignVector& get_statements() const noexcept { - return statements; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref ParamBlock.statements + */ + const ParamAssignVector& get_statements() const noexcept { + return statements; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref ParamBlock.statements (rvalue reference) + */ + void set_statements(ParamAssignVector&& statements); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref ParamBlock.statements (rvalue reference) - */ - void set_statements(ParamAssignVector&& statements); - - /** - * \brief Setter for member variable \ref ParamBlock.statements - */ - void set_statements(const ParamAssignVector& statements); - + /** + * \brief Setter for member variable \ref ParamBlock.statements + */ + void set_statements(const ParamAssignVector& statements); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -292,11 +264,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -308,7 +277,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/paren_expression.hpp ast/paren_expression.hpp --- ast.orig/paren_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/paren_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ParenExpression : public Expression { private: /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ParenExpression(Expression* expression); - explicit ParenExpression(std::shared_ptr expression); + explicit ParenExpression(const std::shared_ptr& expression); ParenExpression(const ParenExpression& obj); - - - virtual ~ParenExpression() = default; - + virtual ~ParenExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ParenExpression * \return true as object is of type ast::ParenExpression @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ParenExpression* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ParenExpression.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ParenExpression.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ParenExpression.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ParenExpression.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref ParenExpression.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref ParenExpression.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/pointer.hpp ast/pointer.hpp --- ast.orig/pointer.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/pointer.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/pointer_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class Pointer : public Statement { private: /// Vector of pointer variables - PointerVarVector variables; + PointerVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Pointer(PointerVarVector variables); + explicit Pointer(const PointerVarVector& variables); Pointer(const Pointer& obj); - - - virtual ~Pointer() = default; - + virtual ~Pointer() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Pointer * \return true as object is of type ast::Pointer @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Pointer* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Pointer.variables - */ - const PointerVarVector& get_variables() const noexcept { - return variables; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Pointer.variables + */ + const PointerVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Pointer.variables (rvalue reference) + */ + void set_variables(PointerVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Pointer.variables (rvalue reference) - */ - void set_variables(PointerVarVector&& variables); - - /** - * \brief Setter for member variable \ref Pointer.variables - */ - void set_variables(const PointerVarVector& variables); - + /** + * \brief Setter for member variable \ref Pointer.variables + */ + void set_variables(const PointerVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/pointer_var.hpp ast/pointer_var.hpp --- ast.orig/pointer_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/pointer_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class PointerVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit PointerVar(Name* name); - explicit PointerVar(std::shared_ptr name); + explicit PointerVar(const std::shared_ptr& name); PointerVar(const PointerVar& obj); - - - virtual ~PointerVar() = default; - + virtual ~PointerVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::PointerVar * \return true as object is of type ast::PointerVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) PointerVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref PointerVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref PointerVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref PointerVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref PointerVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref PointerVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref PointerVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/prime_name.hpp ast/prime_name.hpp --- ast.orig/prime_name.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/prime_name.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -51,32 +49,22 @@ class PrimeName : public Identifier { private: /// Name of prime variable - std::shared_ptr value; + std::shared_ptr value; /// order of ODE - std::shared_ptr order; + std::shared_ptr order; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit PrimeName(String* value, Integer* order); - explicit PrimeName(std::shared_ptr value, std::shared_ptr order); + explicit PrimeName(const std::shared_ptr& value, const std::shared_ptr& order); PrimeName(const PrimeName& obj); - PrimeName() = default; - - virtual ~PrimeName() = default; - + virtual ~PrimeName() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::PrimeName * \return true as object is of type ast::PrimeName @@ -93,7 +81,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) PrimeName* clone() const override { @@ -148,101 +136,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::String has value designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref PrimeName.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - - - - /** - * \brief Getter for member variable \ref PrimeName.order - */ - std::shared_ptr get_order() const noexcept { - return order; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::String has value designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref PrimeName.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + + /** + * \brief Getter for member variable \ref PrimeName.order + */ + const std::shared_ptr& get_order() const noexcept { + return order; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref PrimeName.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); + /** + * \brief Setter for member variable \ref PrimeName.value + */ + void set_value(const std::shared_ptr& value); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref PrimeName.order (rvalue reference) + */ + void set_order(std::shared_ptr&& order); - - /** - * \brief Setter for member variable \ref PrimeName.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref PrimeName.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref PrimeName.order (rvalue reference) - */ - void set_order(std::shared_ptr&& order); - - /** - * \brief Setter for member variable \ref PrimeName.order - */ - void set_order(const std::shared_ptr& order); - + /** + * \brief Setter for member variable \ref PrimeName.order + */ + void set_order(const std::shared_ptr& order); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -284,11 +253,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -300,7 +266,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/procedure_block.hpp ast/procedure_block.hpp --- ast.orig/procedure_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/procedure_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/argument.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,37 +40,27 @@ class ProcedureBlock : public Block { private: /// Name of the procedure - std::shared_ptr name; + std::shared_ptr name; /// Vector of the parameters - ArgumentVector parameters; + ArgumentVector parameters; /// Unit if specified - std::shared_ptr unit; + std::shared_ptr unit; /// Block with statements vector - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit ProcedureBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block); - explicit ProcedureBlock(std::shared_ptr name, const ArgumentVector& parameters, std::shared_ptr unit, std::shared_ptr statement_block); + explicit ProcedureBlock(Name* name, const ArgumentVector& parameters, Unit* unit, StatementBlock* statement_block); + explicit ProcedureBlock(const std::shared_ptr& name, const ArgumentVector& parameters, const std::shared_ptr& unit, const std::shared_ptr& statement_block); ProcedureBlock(const ProcedureBlock& obj); - - - virtual ~ProcedureBlock() = default; - + virtual ~ProcedureBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ProcedureBlock * \return true as object is of type ast::ProcedureBlock @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ProcedureBlock* clone() const override { @@ -158,176 +146,148 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ProcedureBlock.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref ProcedureBlock.parameters - */ - const ArgumentVector& get_parameters() const noexcept override { - return parameters; - } - - - - - - - - /** - * \brief Getter for member variable \ref ProcedureBlock.unit - */ - std::shared_ptr get_unit() const noexcept { - return unit; - } - - - - - - - - /** - * \brief Getter for member variable \ref ProcedureBlock.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ProcedureBlock.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref ProcedureBlock.parameters + */ + const ArgumentVector& get_parameters() const noexcept override { + return parameters; + } + + + + /** + * \brief Getter for member variable \ref ProcedureBlock.unit + */ + const std::shared_ptr& get_unit() const noexcept { + return unit; + } + + + + /** + * \brief Getter for member variable \ref ProcedureBlock.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref ProcedureBlock.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + + /** + * \brief Setter for member variable \ref ProcedureBlock.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref ProcedureBlock.parameters (rvalue reference) + */ + void set_parameters(ArgumentVector&& parameters); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Setter for member variable \ref ProcedureBlock.parameters + */ + void set_parameters(const ArgumentVector& parameters); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + + /** + * \brief Setter for member variable \ref ProcedureBlock.unit (rvalue reference) + */ + void set_unit(std::shared_ptr&& unit); + /** + * \brief Setter for member variable \ref ProcedureBlock.unit + */ + void set_unit(const std::shared_ptr& unit); + + + /** + * \brief Setter for member variable \ref ProcedureBlock.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ProcedureBlock.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ProcedureBlock.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref ProcedureBlock.parameters (rvalue reference) - */ - void set_parameters(ArgumentVector&& parameters); - - /** - * \brief Setter for member variable \ref ProcedureBlock.parameters - */ - void set_parameters(const ArgumentVector& parameters); - - - /** - * \brief Setter for member variable \ref ProcedureBlock.unit (rvalue reference) - */ - void set_unit(std::shared_ptr&& unit); - - /** - * \brief Setter for member variable \ref ProcedureBlock.unit - */ - void set_unit(const std::shared_ptr& unit); - - - /** - * \brief Setter for member variable \ref ProcedureBlock.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref ProcedureBlock.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref ProcedureBlock.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -369,11 +329,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -385,7 +342,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/program.hpp ast/program.hpp --- ast.orig/program.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/program.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/ast.hpp" #include "ast/node.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,33 +40,23 @@ class Program : public Ast { private: /// Vector of top level blocks in the mod file - NodeVector blocks; + NodeVector blocks; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; /// global symbol table for model - symtab::ModelSymbolTable model_symtab; + symtab::ModelSymbolTable model_symtab; public: - /// \name Ctor & dtor /// \{ - - explicit Program(NodeVector blocks); + explicit Program(const NodeVector& blocks); Program(const Program& obj); - Program() = default; - - virtual ~Program() = default; - + virtual ~Program() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Program * \return true as object is of type ast::Program @@ -85,7 +73,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Program* clone() const override { @@ -140,146 +128,130 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - /** - * \brief Return global symbol table for the mod file - */ - symtab::ModelSymbolTable* get_model_symbol_table() { - return &model_symtab; - } - - -/** - * \brief Add member to blocks by raw pointer - */ -void emplace_back_node(Node *n); - -/** - * \brief Add member to blocks by shared_ptr - */ -void emplace_back_node(std::shared_ptr n); - -/** - * \brief Erase member to blocks - */ -NodeVector::const_iterator erase_node(NodeVector::const_iterator first); - -/** - * \brief Erase members to blocks - */ -NodeVector::const_iterator erase_node(NodeVector::const_iterator first, NodeVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to blocks - * - * loosely following the cpp reference of remove_if - */ -size_t erase_node(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + /** + * \brief Return global symbol table for the mod file + */ + symtab::ModelSymbolTable* get_model_symbol_table() { + return &model_symtab; + } + + /** + * \brief Add member to blocks by raw pointer + */ + void emplace_back_node(Node *n); -/** - * \brief Insert member to blocks - */ -NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to blocks by shared_ptr + */ + void emplace_back_node(std::shared_ptr n); -/** - * \brief Insert members to blocks - */ -template -void insert_node(NodeVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to blocks + */ + NodeVector::const_iterator erase_node(NodeVector::const_iterator first); -/** - * \brief Reset member to blocks - */ -void reset_node(NodeVector::const_iterator position, Node* n); + /** + * \brief Erase members to blocks + */ + NodeVector::const_iterator erase_node(NodeVector::const_iterator first, NodeVector::const_iterator last); -/** - * \brief Reset member to blocks - */ -void reset_node(NodeVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to blocks + * + * loosely following the cpp reference of remove_if + */ + size_t erase_node(std::unordered_set& to_be_erased); + /** + * \brief Insert member to blocks + */ + NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to blocks + */ + template + void insert_node(NodeVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref Program.blocks - */ - const NodeVector& get_blocks() const noexcept { - return blocks; - } - + /** + * \brief Reset member to blocks + */ + void reset_node(NodeVector::const_iterator position, Node* n); + /** + * \brief Reset member to blocks + */ + void reset_node(NodeVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref Program.blocks + */ + const NodeVector& get_blocks() const noexcept { + return blocks; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref Program.blocks (rvalue reference) + */ + void set_blocks(NodeVector&& blocks); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref Program.blocks (rvalue reference) - */ - void set_blocks(NodeVector&& blocks); - - /** - * \brief Setter for member variable \ref Program.blocks - */ - void set_blocks(const NodeVector& blocks); - + /** + * \brief Setter for member variable \ref Program.blocks + */ + void set_blocks(const NodeVector& blocks); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -321,11 +293,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -337,7 +306,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/protect_statement.hpp ast/protect_statement.hpp --- ast.orig/protect_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/protect_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ProtectStatement : public Statement { private: /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ProtectStatement(Expression* expression); - explicit ProtectStatement(std::shared_ptr expression); + explicit ProtectStatement(const std::shared_ptr& expression); ProtectStatement(const ProtectStatement& obj); - - - virtual ~ProtectStatement() = default; - + virtual ~ProtectStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ProtectStatement * \return true as object is of type ast::ProtectStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ProtectStatement* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ProtectStatement.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ProtectStatement.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ProtectStatement.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ProtectStatement.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref ProtectStatement.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref ProtectStatement.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/range.hpp ast/range.hpp --- ast.orig/range.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/range.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/range_var.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class Range : public Statement { private: /// Vector of range variables - RangeVarVector variables; + RangeVarVector variables; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Range(RangeVarVector variables); + explicit Range(const RangeVarVector& variables); Range(const Range& obj); - - - virtual ~Range() = default; - + virtual ~Range() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Range * \return true as object is of type ast::Range @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Range* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Range.variables - */ - const RangeVarVector& get_variables() const noexcept { - return variables; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Range.variables + */ + const RangeVarVector& get_variables() const noexcept { + return variables; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Range.variables (rvalue reference) + */ + void set_variables(RangeVarVector&& variables); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Range.variables (rvalue reference) - */ - void set_variables(RangeVarVector&& variables); - - /** - * \brief Setter for member variable \ref Range.variables - */ - void set_variables(const RangeVarVector& variables); - + /** + * \brief Setter for member variable \ref Range.variables + */ + void set_variables(const RangeVarVector& variables); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/range_var.hpp ast/range_var.hpp --- ast.orig/range_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/range_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class RangeVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit RangeVar(Name* name); - explicit RangeVar(std::shared_ptr name); + explicit RangeVar(const std::shared_ptr& name); RangeVar(const RangeVar& obj); - - - virtual ~RangeVar() = default; - + virtual ~RangeVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::RangeVar * \return true as object is of type ast::RangeVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) RangeVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref RangeVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref RangeVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref RangeVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref RangeVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref RangeVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref RangeVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/react_var_name.hpp ast/react_var_name.hpp --- ast.orig/react_var_name.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/react_var_name.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class ReactVarName : public Identifier { private: /// TODO - std::shared_ptr value; + std::shared_ptr value; /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ReactVarName(Integer* value, VarName* name); - explicit ReactVarName(std::shared_ptr value, std::shared_ptr name); + explicit ReactVarName(const std::shared_ptr& value, const std::shared_ptr& name); ReactVarName(const ReactVarName& obj); - - - virtual ~ReactVarName() = default; - + virtual ~ReactVarName() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ReactVarName * \return true as object is of type ast::ReactVarName @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ReactVarName* clone() const override { @@ -137,101 +125,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ReactVarName.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::VarName has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ReactVarName.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ReactVarName.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::VarName has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ReactVarName.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ReactVarName.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); + /** + * \brief Setter for member variable \ref ReactVarName.value + */ + void set_value(const std::shared_ptr& value); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref ReactVarName.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ReactVarName.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref ReactVarName.value - */ - void set_value(const std::shared_ptr& value); - - - /** - * \brief Setter for member variable \ref ReactVarName.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ReactVarName.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref ReactVarName.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -273,11 +242,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -289,7 +255,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/reaction_operator.hpp ast/reaction_operator.hpp --- ast.orig/reaction_operator.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/reaction_operator.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ReactionOperator : public Expression { private: /// TODO - ReactionOp value; + ReactionOp value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ReactionOperator(ReactionOp value); ReactionOperator(const ReactionOperator& obj); - ReactionOperator() = default; - - virtual ~ReactionOperator() = default; - + virtual ~ReactionOperator() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ReactionOperator * \return true as object is of type ast::ReactionOperator @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ReactionOperator* clone() const override { @@ -135,60 +123,45 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref ReactionOperator.value - */ - ReactionOp get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ReactionOperator.value + */ + ReactionOp get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ReactionOperator.value - */ - void set_value(ReactionOp value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ReactionOperator.value + */ + void set_value(ReactionOp value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -230,10 +203,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return enum value in string form * @@ -245,7 +216,6 @@ return ReactionOpNames[value]; } - private: /** * \brief Set this object as parent for all the children @@ -257,7 +227,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/reaction_statement.hpp ast/reaction_statement.hpp --- ast.orig/reaction_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/reaction_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/reaction_operator.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,37 +40,27 @@ class ReactionStatement : public Statement { private: /// TODO - std::shared_ptr reaction1; + std::shared_ptr reaction1; /// TODO - ReactionOperator op; + ReactionOperator op; /// TODO - std::shared_ptr reaction2; + std::shared_ptr reaction2; /// TODO - std::shared_ptr expression1; + std::shared_ptr expression1; /// TODO - std::shared_ptr expression2; + std::shared_ptr expression2; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ReactionStatement(Expression* reaction1, const ReactionOperator& op, Expression* reaction2, Expression* expression1, Expression* expression2); - explicit ReactionStatement(std::shared_ptr reaction1, const ReactionOperator& op, std::shared_ptr reaction2, std::shared_ptr expression1, std::shared_ptr expression2); + explicit ReactionStatement(const std::shared_ptr& reaction1, const ReactionOperator& op, const std::shared_ptr& reaction2, const std::shared_ptr& expression1, const std::shared_ptr& expression2); ReactionStatement(const ReactionStatement& obj); - - - virtual ~ReactionStatement() = default; - + virtual ~ReactionStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ReactionStatement * \return true as object is of type ast::ReactionStatement @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ReactionStatement* clone() const override { @@ -158,161 +146,130 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref ReactionStatement.reaction1 + */ + const std::shared_ptr& get_reaction1() const noexcept { + return reaction1; + } + + + + /** + * \brief Getter for member variable \ref ReactionStatement.op + */ + const ReactionOperator& get_op() const noexcept { + return op; + } + + + + /** + * \brief Getter for member variable \ref ReactionStatement.reaction2 + */ + const std::shared_ptr& get_reaction2() const noexcept { + return reaction2; + } + + + + /** + * \brief Getter for member variable \ref ReactionStatement.expression1 + */ + const std::shared_ptr& get_expression1() const noexcept { + return expression1; + } + + + + /** + * \brief Getter for member variable \ref ReactionStatement.expression2 + */ + const std::shared_ptr& get_expression2() const noexcept { + return expression2; + } + /// \} - + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ReactionStatement.reaction1 (rvalue reference) + */ + void set_reaction1(std::shared_ptr&& reaction1); - - /** - * \brief Getter for member variable \ref ReactionStatement.reaction1 - */ - std::shared_ptr get_reaction1() const noexcept { - return reaction1; - } - - - - - - - - /** - * \brief Getter for member variable \ref ReactionStatement.op - */ - const ReactionOperator& get_op() const noexcept { - return op; - } - - - - - - - - /** - * \brief Getter for member variable \ref ReactionStatement.reaction2 - */ - std::shared_ptr get_reaction2() const noexcept { - return reaction2; - } - - - - - - - - /** - * \brief Getter for member variable \ref ReactionStatement.expression1 - */ - std::shared_ptr get_expression1() const noexcept { - return expression1; - } - - - - - - - - /** - * \brief Getter for member variable \ref ReactionStatement.expression2 - */ - std::shared_ptr get_expression2() const noexcept { - return expression2; - } - + /** + * \brief Setter for member variable \ref ReactionStatement.reaction1 + */ + void set_reaction1(const std::shared_ptr& reaction1); + + /** + * \brief Setter for member variable \ref ReactionStatement.op (rvalue reference) + */ + void set_op(ReactionOperator&& op); - /// \} + /** + * \brief Setter for member variable \ref ReactionStatement.op + */ + void set_op(const ReactionOperator& op); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref ReactionStatement.reaction2 (rvalue reference) + */ + void set_reaction2(std::shared_ptr&& reaction2); + /** + * \brief Setter for member variable \ref ReactionStatement.reaction2 + */ + void set_reaction2(const std::shared_ptr& reaction2); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ReactionStatement.expression1 (rvalue reference) + */ + void set_expression1(std::shared_ptr&& expression1); + /** + * \brief Setter for member variable \ref ReactionStatement.expression1 + */ + void set_expression1(const std::shared_ptr& expression1); + + /** + * \brief Setter for member variable \ref ReactionStatement.expression2 (rvalue reference) + */ + void set_expression2(std::shared_ptr&& expression2); - - /** - * \brief Setter for member variable \ref ReactionStatement.reaction1 (rvalue reference) - */ - void set_reaction1(std::shared_ptr&& reaction1); - - /** - * \brief Setter for member variable \ref ReactionStatement.reaction1 - */ - void set_reaction1(const std::shared_ptr& reaction1); - - - /** - * \brief Setter for member variable \ref ReactionStatement.op (rvalue reference) - */ - void set_op(ReactionOperator&& op); - - /** - * \brief Setter for member variable \ref ReactionStatement.op - */ - void set_op(const ReactionOperator& op); - - - /** - * \brief Setter for member variable \ref ReactionStatement.reaction2 (rvalue reference) - */ - void set_reaction2(std::shared_ptr&& reaction2); - - /** - * \brief Setter for member variable \ref ReactionStatement.reaction2 - */ - void set_reaction2(const std::shared_ptr& reaction2); - - - /** - * \brief Setter for member variable \ref ReactionStatement.expression1 (rvalue reference) - */ - void set_expression1(std::shared_ptr&& expression1); - - /** - * \brief Setter for member variable \ref ReactionStatement.expression1 - */ - void set_expression1(const std::shared_ptr& expression1); - - - /** - * \brief Setter for member variable \ref ReactionStatement.expression2 (rvalue reference) - */ - void set_expression2(std::shared_ptr&& expression2); - - /** - * \brief Setter for member variable \ref ReactionStatement.expression2 - */ - void set_expression2(const std::shared_ptr& expression2); - + /** + * \brief Setter for member variable \ref ReactionStatement.expression2 + */ + void set_expression2(const std::shared_ptr& expression2); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -354,11 +311,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -370,7 +324,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/read_ion_var.hpp ast/read_ion_var.hpp --- ast.orig/read_ion_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/read_ion_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class ReadIonVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit ReadIonVar(Name* name); - explicit ReadIonVar(std::shared_ptr name); + explicit ReadIonVar(const std::shared_ptr& name); ReadIonVar(const ReadIonVar& obj); - - - virtual ~ReadIonVar() = default; - + virtual ~ReadIonVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ReadIonVar * \return true as object is of type ast::ReadIonVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ReadIonVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref ReadIonVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref ReadIonVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref ReadIonVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref ReadIonVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref ReadIonVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref ReadIonVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/solution_expression.hpp ast/solution_expression.hpp --- ast.orig/solution_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/solution_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class SolutionExpression : public Expression { private: /// - std::shared_ptr solve_block; + std::shared_ptr solve_block; /// Block to be solved (callback node or solution node itself) - std::shared_ptr node_to_solve; + std::shared_ptr node_to_solve; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit SolutionExpression(SolveBlock* solve_block, Expression* node_to_solve); - explicit SolutionExpression(std::shared_ptr solve_block, std::shared_ptr node_to_solve); + explicit SolutionExpression(const std::shared_ptr& solve_block, const std::shared_ptr& node_to_solve); SolutionExpression(const SolutionExpression& obj); - - - virtual ~SolutionExpression() = default; - + virtual ~SolutionExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::SolutionExpression * \return true as object is of type ast::SolutionExpression @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) SolutionExpression* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref SolutionExpression.solve_block - */ - std::shared_ptr get_solve_block() const noexcept { - return solve_block; - } - - - - - - - - /** - * \brief Getter for member variable \ref SolutionExpression.node_to_solve - */ - std::shared_ptr get_node_to_solve() const noexcept { - return node_to_solve; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref SolutionExpression.solve_block + */ + const std::shared_ptr& get_solve_block() const noexcept { + return solve_block; + } + + + + /** + * \brief Getter for member variable \ref SolutionExpression.node_to_solve + */ + const std::shared_ptr& get_node_to_solve() const noexcept { + return node_to_solve; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref SolutionExpression.solve_block (rvalue reference) + */ + void set_solve_block(std::shared_ptr&& solve_block); + /** + * \brief Setter for member variable \ref SolutionExpression.solve_block + */ + void set_solve_block(const std::shared_ptr& solve_block); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref SolutionExpression.node_to_solve (rvalue reference) + */ + void set_node_to_solve(std::shared_ptr&& node_to_solve); - - /** - * \brief Setter for member variable \ref SolutionExpression.solve_block (rvalue reference) - */ - void set_solve_block(std::shared_ptr&& solve_block); - - /** - * \brief Setter for member variable \ref SolutionExpression.solve_block - */ - void set_solve_block(const std::shared_ptr& solve_block); - - - /** - * \brief Setter for member variable \ref SolutionExpression.node_to_solve (rvalue reference) - */ - void set_node_to_solve(std::shared_ptr&& node_to_solve); - - /** - * \brief Setter for member variable \ref SolutionExpression.node_to_solve - */ - void set_node_to_solve(const std::shared_ptr& node_to_solve); - + /** + * \brief Setter for member variable \ref SolutionExpression.node_to_solve + */ + void set_node_to_solve(const std::shared_ptr& node_to_solve); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/solve_block.hpp ast/solve_block.hpp --- ast.orig/solve_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/solve_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,35 +39,25 @@ class SolveBlock : public Block { private: /// Name of the block to solve - std::shared_ptr block_name; + std::shared_ptr block_name; /// Name of the integration method - std::shared_ptr method; + std::shared_ptr method; /// Name of the integration method - std::shared_ptr steadystate; + std::shared_ptr steadystate; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - explicit SolveBlock(Name* block_name, Name* method, Name* steadystate); - explicit SolveBlock(std::shared_ptr block_name, std::shared_ptr method, std::shared_ptr steadystate); + explicit SolveBlock(const std::shared_ptr& block_name, const std::shared_ptr& method, const std::shared_ptr& steadystate); SolveBlock(const SolveBlock& obj); - - - virtual ~SolveBlock() = default; - + virtual ~SolveBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::SolveBlock * \return true as object is of type ast::SolveBlock @@ -86,7 +74,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) SolveBlock* clone() const override { @@ -155,140 +143,116 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref SolveBlock.block_name - */ - std::shared_ptr get_block_name() const noexcept { - return block_name; - } - - - - - - - - /** - * \brief Getter for member variable \ref SolveBlock.method - */ - std::shared_ptr get_method() const noexcept { - return method; - } - - - - - - - - /** - * \brief Getter for member variable \ref SolveBlock.steadystate - */ - std::shared_ptr get_steadystate() const noexcept { - return steadystate; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref SolveBlock.block_name + */ + const std::shared_ptr& get_block_name() const noexcept { + return block_name; + } + + + + /** + * \brief Getter for member variable \ref SolveBlock.method + */ + const std::shared_ptr& get_method() const noexcept { + return method; + } + + + + /** + * \brief Getter for member variable \ref SolveBlock.steadystate + */ + const std::shared_ptr& get_steadystate() const noexcept { + return steadystate; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref SolveBlock.block_name (rvalue reference) + */ + void set_block_name(std::shared_ptr&& block_name); + /** + * \brief Setter for member variable \ref SolveBlock.block_name + */ + void set_block_name(const std::shared_ptr& block_name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref SolveBlock.method (rvalue reference) + */ + void set_method(std::shared_ptr&& method); - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } + /** + * \brief Setter for member variable \ref SolveBlock.method + */ + void set_method(const std::shared_ptr& method); + + /** + * \brief Setter for member variable \ref SolveBlock.steadystate (rvalue reference) + */ + void set_steadystate(std::shared_ptr&& steadystate); - - /** - * \brief Setter for member variable \ref SolveBlock.block_name (rvalue reference) - */ - void set_block_name(std::shared_ptr&& block_name); - - /** - * \brief Setter for member variable \ref SolveBlock.block_name - */ - void set_block_name(const std::shared_ptr& block_name); - - - /** - * \brief Setter for member variable \ref SolveBlock.method (rvalue reference) - */ - void set_method(std::shared_ptr&& method); - - /** - * \brief Setter for member variable \ref SolveBlock.method - */ - void set_method(const std::shared_ptr& method); - - - /** - * \brief Setter for member variable \ref SolveBlock.steadystate (rvalue reference) - */ - void set_steadystate(std::shared_ptr&& steadystate); - - /** - * \brief Setter for member variable \ref SolveBlock.steadystate - */ - void set_steadystate(const std::shared_ptr& steadystate); - + /** + * \brief Setter for member variable \ref SolveBlock.steadystate + */ + void set_steadystate(const std::shared_ptr& steadystate); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -330,11 +294,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -346,7 +307,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/state_block.hpp ast/state_block.hpp --- ast.orig/state_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/state_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/assigned_definition.hpp" #include "ast/block.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -55,30 +53,20 @@ class StateBlock : public Block { private: /// Vector of state variables - AssignedDefinitionVector definitions; + AssignedDefinitionVector definitions; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit StateBlock(AssignedDefinitionVector definitions); + explicit StateBlock(const AssignedDefinitionVector& definitions); StateBlock(const StateBlock& obj); - - - virtual ~StateBlock() = default; - + virtual ~StateBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::StateBlock * \return true as object is of type ast::StateBlock @@ -95,7 +83,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) StateBlock* clone() const override { @@ -164,92 +152,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref StateBlock.definitions - */ - const AssignedDefinitionVector& get_definitions() const noexcept { - return definitions; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref StateBlock.definitions + */ + const AssignedDefinitionVector& get_definitions() const noexcept { + return definitions; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref StateBlock.definitions (rvalue reference) + */ + void set_definitions(AssignedDefinitionVector&& definitions); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref StateBlock.definitions (rvalue reference) - */ - void set_definitions(AssignedDefinitionVector&& definitions); - - /** - * \brief Setter for member variable \ref StateBlock.definitions - */ - void set_definitions(const AssignedDefinitionVector& definitions); - + /** + * \brief Setter for member variable \ref StateBlock.definitions + */ + void set_definitions(const AssignedDefinitionVector& definitions); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -291,11 +263,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -307,7 +276,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/statement.hpp ast/statement.hpp --- ast.orig/statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/statement.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/node.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,21 +39,11 @@ class Statement : public Node { public: - /// \name Ctor & dtor /// \{ - - - - virtual ~Statement() = default; - + virtual ~Statement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Statement * \return true as object is of type ast::Statement @@ -72,7 +60,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) virtual Statement* clone() const override { @@ -127,23 +115,12 @@ return std::static_pointer_cast(shared_from_this()); } - - - - /// \} - - - - - - /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -185,14 +162,11 @@ * \copydoc accept(visitor::Visitor&) */ virtual void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/statement_block.hpp ast/statement_block.hpp --- ast.orig/statement_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/statement_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -56,30 +54,20 @@ class StatementBlock : public Block { private: /// Vector of statements - StatementVector statements; + StatementVector statements; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit StatementBlock(StatementVector statements); + explicit StatementBlock(const StatementVector& statements); StatementBlock(const StatementBlock& obj); - - - virtual ~StatementBlock() = default; - + virtual ~StatementBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::StatementBlock * \return true as object is of type ast::StatementBlock @@ -96,7 +84,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) StatementBlock* clone() const override { @@ -151,140 +139,124 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - -/** - * \brief Add member to statements by raw pointer - */ -void emplace_back_statement(Statement *n); - -/** - * \brief Add member to statements by shared_ptr - */ -void emplace_back_statement(std::shared_ptr n); - -/** - * \brief Erase member to statements - */ -StatementVector::const_iterator erase_statement(StatementVector::const_iterator first); - -/** - * \brief Erase members to statements - */ -StatementVector::const_iterator erase_statement(StatementVector::const_iterator first, StatementVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to statements - * - * loosely following the cpp reference of remove_if - */ -size_t erase_statement(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + /** + * \brief Add member to statements by raw pointer + */ + void emplace_back_statement(Statement *n); -/** - * \brief Insert member to statements - */ -StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to statements by shared_ptr + */ + void emplace_back_statement(std::shared_ptr n); -/** - * \brief Insert members to statements - */ -template -void insert_statement(StatementVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to statements + */ + StatementVector::const_iterator erase_statement(StatementVector::const_iterator first); -/** - * \brief Reset member to statements - */ -void reset_statement(StatementVector::const_iterator position, Statement* n); + /** + * \brief Erase members to statements + */ + StatementVector::const_iterator erase_statement(StatementVector::const_iterator first, StatementVector::const_iterator last); -/** - * \brief Reset member to statements - */ -void reset_statement(StatementVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to statements + * + * loosely following the cpp reference of remove_if + */ + size_t erase_statement(std::unordered_set& to_be_erased); + /** + * \brief Insert member to statements + */ + StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to statements + */ + template + void insert_statement(StatementVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref StatementBlock.statements - */ - const StatementVector& get_statements() const noexcept { - return statements; - } - + /** + * \brief Reset member to statements + */ + void reset_statement(StatementVector::const_iterator position, Statement* n); + /** + * \brief Reset member to statements + */ + void reset_statement(StatementVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref StatementBlock.statements + */ + const StatementVector& get_statements() const noexcept { + return statements; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref StatementBlock.statements (rvalue reference) + */ + void set_statements(StatementVector&& statements); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref StatementBlock.statements (rvalue reference) - */ - void set_statements(StatementVector&& statements); - - /** - * \brief Setter for member variable \ref StatementBlock.statements - */ - void set_statements(const StatementVector& statements); - + /** + * \brief Setter for member variable \ref StatementBlock.statements + */ + void set_statements(const StatementVector& statements); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -326,11 +298,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -342,7 +311,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/string.hpp ast/string.hpp --- ast.orig/string.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/string.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -55,29 +53,19 @@ class String : public Expression { private: /// Value of string - std::string value; + std::string value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit String(const std::string& value); String(const String& obj); - String() = default; - - virtual ~String() = default; - + virtual ~String() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::String * \return true as object is of type ast::String @@ -94,7 +82,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) String* clone() const override { @@ -149,67 +137,52 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref String.value - */ - const std::string& get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref String.value + */ + const std::string& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - /** - * \brief Set new value to the current ast node - * \sa String::eval - */ - void set(std::string _value) { - value = _value; - } - - - /** - * \brief Setter for member variable \ref String.value - */ - void set_value(std::string value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set new value to the current ast node + * \sa String::eval + */ + void set(std::string _value) { + value = _value; + } + + /** + * \brief Setter for member variable \ref String.value + */ + void set_value(std::string value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -251,10 +224,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return value of the ast node * @@ -267,7 +238,6 @@ std::string eval() const { return value; } - private: /** * \brief Set this object as parent for all the children @@ -279,7 +249,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/suffix.hpp ast/suffix.hpp --- ast.orig/suffix.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/suffix.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Suffix : public Statement { private: /// type of channel - std::shared_ptr type; + std::shared_ptr type; /// Name of the channel - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Suffix(Name* type, Name* name); - explicit Suffix(std::shared_ptr type, std::shared_ptr name); + explicit Suffix(const std::shared_ptr& type, const std::shared_ptr& name); Suffix(const Suffix& obj); - - - virtual ~Suffix() = default; - + virtual ~Suffix() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Suffix * \return true as object is of type ast::Suffix @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Suffix* clone() const override { @@ -137,101 +125,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Suffix.type - */ - std::shared_ptr get_type() const noexcept { - return type; - } - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref Suffix.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Suffix.type + */ + const std::shared_ptr& get_type() const noexcept { + return type; + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Suffix.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Suffix.type (rvalue reference) + */ + void set_type(std::shared_ptr&& type); + /** + * \brief Setter for member variable \ref Suffix.type + */ + void set_type(const std::shared_ptr& type); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Suffix.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Suffix.type (rvalue reference) - */ - void set_type(std::shared_ptr&& type); - - /** - * \brief Setter for member variable \ref Suffix.type - */ - void set_type(const std::shared_ptr& type); - - - /** - * \brief Setter for member variable \ref Suffix.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Suffix.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref Suffix.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -273,11 +242,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -289,7 +255,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/table_statement.hpp ast/table_statement.hpp --- ast.orig/table_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/table_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/name.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,37 +40,27 @@ class TableStatement : public Statement { private: /// Variables in the table - NameVector table_vars; + NameVector table_vars; /// dependent variables - NameVector depend_vars; + NameVector depend_vars; /// from value - std::shared_ptr from; + std::shared_ptr from; /// to values - std::shared_ptr to; + std::shared_ptr to; /// an increment factor - std::shared_ptr with; + std::shared_ptr with; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit TableStatement(NameVector table_vars, NameVector depend_vars, Expression* from, Expression* to, Integer* with); - explicit TableStatement(const NameVector& table_vars, const NameVector& depend_vars, std::shared_ptr from, std::shared_ptr to, std::shared_ptr with); + explicit TableStatement(const NameVector& table_vars, const NameVector& depend_vars, Expression* from, Expression* to, Integer* with); + explicit TableStatement(const NameVector& table_vars, const NameVector& depend_vars, const std::shared_ptr& from, const std::shared_ptr& to, const std::shared_ptr& with); TableStatement(const TableStatement& obj); - - - virtual ~TableStatement() = default; - + virtual ~TableStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::TableStatement * \return true as object is of type ast::TableStatement @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) TableStatement* clone() const override { @@ -158,161 +146,130 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref TableStatement.table_vars + */ + const NameVector& get_table_vars() const noexcept { + return table_vars; + } + + + + /** + * \brief Getter for member variable \ref TableStatement.depend_vars + */ + const NameVector& get_depend_vars() const noexcept { + return depend_vars; + } + + + + /** + * \brief Getter for member variable \ref TableStatement.from + */ + const std::shared_ptr& get_from() const noexcept { + return from; + } + + + + /** + * \brief Getter for member variable \ref TableStatement.to + */ + const std::shared_ptr& get_to() const noexcept { + return to; + } + + + + /** + * \brief Getter for member variable \ref TableStatement.with + */ + const std::shared_ptr& get_with() const noexcept { + return with; + } + /// \} - + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref TableStatement.table_vars (rvalue reference) + */ + void set_table_vars(NameVector&& table_vars); - - /** - * \brief Getter for member variable \ref TableStatement.table_vars - */ - const NameVector& get_table_vars() const noexcept { - return table_vars; - } - - - - - - - - /** - * \brief Getter for member variable \ref TableStatement.depend_vars - */ - const NameVector& get_depend_vars() const noexcept { - return depend_vars; - } - - - - - - - - /** - * \brief Getter for member variable \ref TableStatement.from - */ - std::shared_ptr get_from() const noexcept { - return from; - } - - - - - - - - /** - * \brief Getter for member variable \ref TableStatement.to - */ - std::shared_ptr get_to() const noexcept { - return to; - } - - - - - - - - /** - * \brief Getter for member variable \ref TableStatement.with - */ - std::shared_ptr get_with() const noexcept { - return with; - } - + /** + * \brief Setter for member variable \ref TableStatement.table_vars + */ + void set_table_vars(const NameVector& table_vars); + + /** + * \brief Setter for member variable \ref TableStatement.depend_vars (rvalue reference) + */ + void set_depend_vars(NameVector&& depend_vars); - /// \} + /** + * \brief Setter for member variable \ref TableStatement.depend_vars + */ + void set_depend_vars(const NameVector& depend_vars); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref TableStatement.from (rvalue reference) + */ + void set_from(std::shared_ptr&& from); + /** + * \brief Setter for member variable \ref TableStatement.from + */ + void set_from(const std::shared_ptr& from); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref TableStatement.to (rvalue reference) + */ + void set_to(std::shared_ptr&& to); + /** + * \brief Setter for member variable \ref TableStatement.to + */ + void set_to(const std::shared_ptr& to); + + /** + * \brief Setter for member variable \ref TableStatement.with (rvalue reference) + */ + void set_with(std::shared_ptr&& with); - - /** - * \brief Setter for member variable \ref TableStatement.table_vars (rvalue reference) - */ - void set_table_vars(NameVector&& table_vars); - - /** - * \brief Setter for member variable \ref TableStatement.table_vars - */ - void set_table_vars(const NameVector& table_vars); - - - /** - * \brief Setter for member variable \ref TableStatement.depend_vars (rvalue reference) - */ - void set_depend_vars(NameVector&& depend_vars); - - /** - * \brief Setter for member variable \ref TableStatement.depend_vars - */ - void set_depend_vars(const NameVector& depend_vars); - - - /** - * \brief Setter for member variable \ref TableStatement.from (rvalue reference) - */ - void set_from(std::shared_ptr&& from); - - /** - * \brief Setter for member variable \ref TableStatement.from - */ - void set_from(const std::shared_ptr& from); - - - /** - * \brief Setter for member variable \ref TableStatement.to (rvalue reference) - */ - void set_to(std::shared_ptr&& to); - - /** - * \brief Setter for member variable \ref TableStatement.to - */ - void set_to(const std::shared_ptr& to); - - - /** - * \brief Setter for member variable \ref TableStatement.with (rvalue reference) - */ - void set_with(std::shared_ptr&& with); - - /** - * \brief Setter for member variable \ref TableStatement.with - */ - void set_with(const std::shared_ptr& with); - + /** + * \brief Setter for member variable \ref TableStatement.with + */ + void set_with(const std::shared_ptr& with); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -354,11 +311,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -370,7 +324,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/thread_safe.hpp ast/thread_safe.hpp --- ast.orig/thread_safe.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/thread_safe.hpp 2023-09-26 13:02:32.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,24 +39,14 @@ class ThreadSafe : public Statement { private: /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - - - virtual ~ThreadSafe() = default; - + virtual ~ThreadSafe() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::ThreadSafe * \return true as object is of type ast::ThreadSafe @@ -75,7 +63,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) ThreadSafe* clone() const override { @@ -144,41 +132,30 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -220,14 +197,11 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class } // namespace ast diff -ru ast.orig/unary_expression.hpp ast/unary_expression.hpp --- ast.orig/unary_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unary_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/expression.hpp" #include "ast/unary_operator.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,31 +40,21 @@ class UnaryExpression : public Expression { private: /// TODO - UnaryOperator op; + UnaryOperator op; /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit UnaryExpression(const UnaryOperator& op, Expression* expression); - explicit UnaryExpression(const UnaryOperator& op, std::shared_ptr expression); + explicit UnaryExpression(const UnaryOperator& op, const std::shared_ptr& expression); UnaryExpression(const UnaryExpression& obj); - - - virtual ~UnaryExpression() = default; - + virtual ~UnaryExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UnaryExpression * \return true as object is of type ast::UnaryExpression @@ -83,7 +71,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UnaryExpression* clone() const override { @@ -138,89 +126,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref UnaryExpression.op - */ - const UnaryOperator& get_op() const noexcept { - return op; - } - - - - - - - - /** - * \brief Getter for member variable \ref UnaryExpression.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref UnaryExpression.op + */ + const UnaryOperator& get_op() const noexcept { + return op; + } + + + + /** + * \brief Getter for member variable \ref UnaryExpression.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref UnaryExpression.op (rvalue reference) + */ + void set_op(UnaryOperator&& op); + /** + * \brief Setter for member variable \ref UnaryExpression.op + */ + void set_op(const UnaryOperator& op); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref UnaryExpression.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref UnaryExpression.op (rvalue reference) - */ - void set_op(UnaryOperator&& op); - - /** - * \brief Setter for member variable \ref UnaryExpression.op - */ - void set_op(const UnaryOperator& op); - - - /** - * \brief Setter for member variable \ref UnaryExpression.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref UnaryExpression.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref UnaryExpression.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -262,11 +231,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -278,7 +244,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/unary_operator.hpp ast/unary_operator.hpp --- ast.orig/unary_operator.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unary_operator.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class UnaryOperator : public Expression { private: /// TODO - UnaryOp value; + UnaryOp value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit UnaryOperator(UnaryOp value); UnaryOperator(const UnaryOperator& obj); - UnaryOperator() = default; - - virtual ~UnaryOperator() = default; - + virtual ~UnaryOperator() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UnaryOperator * \return true as object is of type ast::UnaryOperator @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UnaryOperator* clone() const override { @@ -135,60 +123,45 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref UnaryOperator.value - */ - UnaryOp get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref UnaryOperator.value + */ + UnaryOp get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref UnaryOperator.value - */ - void set_value(UnaryOp value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref UnaryOperator.value + */ + void set_value(UnaryOp value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -230,10 +203,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return enum value in string form * @@ -245,7 +216,6 @@ return UnaryOpNames[value]; } - private: /** * \brief Set this object as parent for all the children @@ -257,7 +227,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/unit.hpp ast/unit.hpp --- ast.orig/unit.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unit.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class Unit : public Expression { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Unit(String* name); - explicit Unit(std::shared_ptr name); + explicit Unit(const std::shared_ptr& name); Unit(const Unit& obj); - - - virtual ~Unit() = default; - + virtual ~Unit() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Unit * \return true as object is of type ast::Unit @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Unit* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::String has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref Unit.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::String has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Unit.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Unit.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Unit.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Unit.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref Unit.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/unit_block.hpp ast/unit_block.hpp --- ast.orig/unit_block.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unit_block.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/block.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,30 +40,20 @@ class UnitBlock : public Block { private: /// Vector of unit statements - ExpressionVector definitions; + ExpressionVector definitions; /// token with location information - std::shared_ptr token; + std::shared_ptr token; /// symbol table for a block - symtab::SymbolTable* symtab = nullptr; + symtab::SymbolTable* symtab = nullptr; public: - /// \name Ctor & dtor /// \{ - - explicit UnitBlock(ExpressionVector definitions); + explicit UnitBlock(const ExpressionVector& definitions); UnitBlock(const UnitBlock& obj); - - - virtual ~UnitBlock() = default; - + virtual ~UnitBlock() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UnitBlock * \return true as object is of type ast::UnitBlock @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UnitBlock* clone() const override { @@ -151,92 +139,76 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - /** - * \brief Return associated symbol table for the current ast node - * - * Only certain ast nodes (e.g. inherited from ast::Block) have associated - * symbol table. These nodes have nmodl::symtab::SymbolTable as member - * and it can be accessed using this method. - * - * \return pointer to the symbol table - * - * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor - */ - symtab::SymbolTable* get_symbol_table() const override { - return symtab; - } - - - - - - - - - /** - * \brief Getter for member variable \ref UnitBlock.definitions - */ - const ExpressionVector& get_definitions() const noexcept { - return definitions; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + /** + * \brief Return associated symbol table for the current ast node + * + * Only certain ast nodes (e.g. inherited from ast::Block) have associated + * symbol table. These nodes have nmodl::symtab::SymbolTable as member + * and it can be accessed using this method. + * + * \return pointer to the symbol table + * + * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor + */ + symtab::SymbolTable* get_symbol_table() const override { + return symtab; + } + + + + /** + * \brief Getter for member variable \ref UnitBlock.definitions + */ + const ExpressionVector& get_definitions() const noexcept { + return definitions; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + /** + * \brief Set symbol table for the current ast node + * + * Top level, block scoped nodes store symbol table in the ast node. + * nmodl::visitor::SymtabVisitor then used this method to setup symbol table + * for every node in the ast. + * + * \sa nmodl::visitor::SymtabVisitor + */ + void set_symbol_table(symtab::SymbolTable* newsymtab) override { + symtab = newsymtab; + } + + /** + * \brief Setter for member variable \ref UnitBlock.definitions (rvalue reference) + */ + void set_definitions(ExpressionVector&& definitions); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - /** - * \brief Set symbol table for the current ast node - * - * Top level, block scoped nodes store symbol table in the ast node. - * nmodl::visitor::SymtabVisitor then used this method to setup symbol table - * for every node in the ast. - * - * \sa nmodl::visitor::SymtabVisitor - */ - void set_symbol_table(symtab::SymbolTable* newsymtab) override { - symtab = newsymtab; - } - - - - /** - * \brief Setter for member variable \ref UnitBlock.definitions (rvalue reference) - */ - void set_definitions(ExpressionVector&& definitions); - - /** - * \brief Setter for member variable \ref UnitBlock.definitions - */ - void set_definitions(const ExpressionVector& definitions); - + /** + * \brief Setter for member variable \ref UnitBlock.definitions + */ + void set_definitions(const ExpressionVector& definitions); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -278,11 +250,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -294,7 +263,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/unit_def.hpp ast/unit_def.hpp --- ast.orig/unit_def.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unit_def.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class UnitDef : public Expression { private: /// TODO - std::shared_ptr unit1; + std::shared_ptr unit1; /// TODO - std::shared_ptr unit2; + std::shared_ptr unit2; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit UnitDef(Unit* unit1, Unit* unit2); - explicit UnitDef(std::shared_ptr unit1, std::shared_ptr unit2); + explicit UnitDef(const std::shared_ptr& unit1, const std::shared_ptr& unit2); UnitDef(const UnitDef& obj); - - - virtual ~UnitDef() = default; - + virtual ~UnitDef() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UnitDef * \return true as object is of type ast::UnitDef @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UnitDef* clone() const override { @@ -137,101 +125,82 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Unit has unit1 designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref UnitDef.unit1 - */ - std::shared_ptr get_unit1() const noexcept { - return unit1; - } - - - - - - - - /** - * \brief Getter for member variable \ref UnitDef.unit2 - */ - std::shared_ptr get_unit2() const noexcept { - return unit2; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Unit has unit1 designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref UnitDef.unit1 + */ + const std::shared_ptr& get_unit1() const noexcept { + return unit1; + } + + + + /** + * \brief Getter for member variable \ref UnitDef.unit2 + */ + const std::shared_ptr& get_unit2() const noexcept { + return unit2; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref UnitDef.unit1 (rvalue reference) + */ + void set_unit1(std::shared_ptr&& unit1); + /** + * \brief Setter for member variable \ref UnitDef.unit1 + */ + void set_unit1(const std::shared_ptr& unit1); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref UnitDef.unit2 (rvalue reference) + */ + void set_unit2(std::shared_ptr&& unit2); - - /** - * \brief Setter for member variable \ref UnitDef.unit1 (rvalue reference) - */ - void set_unit1(std::shared_ptr&& unit1); - - /** - * \brief Setter for member variable \ref UnitDef.unit1 - */ - void set_unit1(const std::shared_ptr& unit1); - - - /** - * \brief Setter for member variable \ref UnitDef.unit2 (rvalue reference) - */ - void set_unit2(std::shared_ptr&& unit2); - - /** - * \brief Setter for member variable \ref UnitDef.unit2 - */ - void set_unit2(const std::shared_ptr& unit2); - + /** + * \brief Setter for member variable \ref UnitDef.unit2 + */ + void set_unit2(const std::shared_ptr& unit2); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -273,11 +242,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -289,7 +255,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/unit_state.hpp ast/unit_state.hpp --- ast.orig/unit_state.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/unit_state.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,28 +39,18 @@ class UnitState : public Statement { private: /// TODO - UnitStateType value; + UnitStateType value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit UnitState(UnitStateType value); UnitState(const UnitState& obj); - - - virtual ~UnitState() = default; - + virtual ~UnitState() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UnitState * \return true as object is of type ast::UnitState @@ -79,7 +67,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UnitState* clone() const override { @@ -134,60 +122,45 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref UnitState.value - */ - UnitStateType get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref UnitState.value + */ + UnitStateType get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ - - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref UnitState.value - */ - void set_value(UnitStateType value); - + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref UnitState.value + */ + void set_value(UnitStateType value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -229,10 +202,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - /** * \brief Return enum value in string form * @@ -244,7 +215,6 @@ return UnitStateTypeNames[value]; } - private: /** * \brief Set this object as parent for all the children @@ -256,7 +226,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/update_dt.hpp ast/update_dt.hpp --- ast.orig/update_dt.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/update_dt.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class UpdateDt : public Statement { private: /// Value of new timestep - std::shared_ptr value; + std::shared_ptr value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit UpdateDt(Double* value); - explicit UpdateDt(std::shared_ptr value); + explicit UpdateDt(const std::shared_ptr& value); UpdateDt(const UpdateDt& obj); - - - virtual ~UpdateDt() = default; - + virtual ~UpdateDt() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::UpdateDt * \return true as object is of type ast::UpdateDt @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) UpdateDt* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref UpdateDt.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref UpdateDt.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref UpdateDt.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref UpdateDt.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref UpdateDt.value - */ - void set_value(const std::shared_ptr& value); - + /** + * \brief Setter for member variable \ref UpdateDt.value + */ + void set_value(const std::shared_ptr& value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/useion.hpp ast/useion.hpp --- ast.orig/useion.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/useion.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -24,15 +24,13 @@ #include "ast/statement.hpp" #include "ast/write_ion_var.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -43,37 +41,27 @@ class Useion : public Statement { private: /// Name of ion - std::shared_ptr name; + std::shared_ptr name; /// Variables being read - ReadIonVarVector readlist; + ReadIonVarVector readlist; /// Variables being written - WriteIonVarVector writelist; + WriteIonVarVector writelist; /// (TODO) - std::shared_ptr valence; + std::shared_ptr valence; /// Ontology to indicate the chemical ion - std::shared_ptr ontology_id; + std::shared_ptr ontology_id; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit Useion(Name* name, ReadIonVarVector readlist, WriteIonVarVector writelist, Valence* valence, String* ontology_id); - explicit Useion(std::shared_ptr name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, std::shared_ptr valence, std::shared_ptr ontology_id); + explicit Useion(Name* name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, Valence* valence, String* ontology_id); + explicit Useion(const std::shared_ptr& name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, const std::shared_ptr& valence, const std::shared_ptr& ontology_id); Useion(const Useion& obj); - - - virtual ~Useion() = default; - + virtual ~Useion() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Useion * \return true as object is of type ast::Useion @@ -90,7 +78,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Useion* clone() const override { @@ -159,173 +147,142 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref Useion.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref Useion.readlist + */ + const ReadIonVarVector& get_readlist() const noexcept { + return readlist; + } + + + + /** + * \brief Getter for member variable \ref Useion.writelist + */ + const WriteIonVarVector& get_writelist() const noexcept { + return writelist; + } + + + + /** + * \brief Getter for member variable \ref Useion.valence + */ + const std::shared_ptr& get_valence() const noexcept { + return valence; + } + + + + /** + * \brief Getter for member variable \ref Useion.ontology_id + */ + const std::shared_ptr& get_ontology_id() const noexcept { + return ontology_id; + } + /// \} - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; + /// \name Setters + /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Useion.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Getter for member variable \ref Useion.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref Useion.readlist - */ - const ReadIonVarVector& get_readlist() const noexcept { - return readlist; - } - - - - - - - - /** - * \brief Getter for member variable \ref Useion.writelist - */ - const WriteIonVarVector& get_writelist() const noexcept { - return writelist; - } - - - - - - - - /** - * \brief Getter for member variable \ref Useion.valence - */ - std::shared_ptr get_valence() const noexcept { - return valence; - } - - - - - - - - /** - * \brief Getter for member variable \ref Useion.ontology_id - */ - std::shared_ptr get_ontology_id() const noexcept { - return ontology_id; - } - + /** + * \brief Setter for member variable \ref Useion.name + */ + void set_name(const std::shared_ptr& name); + + /** + * \brief Setter for member variable \ref Useion.readlist (rvalue reference) + */ + void set_readlist(ReadIonVarVector&& readlist); - /// \} + /** + * \brief Setter for member variable \ref Useion.readlist + */ + void set_readlist(const ReadIonVarVector& readlist); - /// \name Setters - /// \{ + + /** + * \brief Setter for member variable \ref Useion.writelist (rvalue reference) + */ + void set_writelist(WriteIonVarVector&& writelist); + /** + * \brief Setter for member variable \ref Useion.writelist + */ + void set_writelist(const WriteIonVarVector& writelist); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Useion.valence (rvalue reference) + */ + void set_valence(std::shared_ptr&& valence); + /** + * \brief Setter for member variable \ref Useion.valence + */ + void set_valence(const std::shared_ptr& valence); + + /** + * \brief Setter for member variable \ref Useion.ontology_id (rvalue reference) + */ + void set_ontology_id(std::shared_ptr&& ontology_id); - - /** - * \brief Setter for member variable \ref Useion.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref Useion.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref Useion.readlist (rvalue reference) - */ - void set_readlist(ReadIonVarVector&& readlist); - - /** - * \brief Setter for member variable \ref Useion.readlist - */ - void set_readlist(const ReadIonVarVector& readlist); - - - /** - * \brief Setter for member variable \ref Useion.writelist (rvalue reference) - */ - void set_writelist(WriteIonVarVector&& writelist); - - /** - * \brief Setter for member variable \ref Useion.writelist - */ - void set_writelist(const WriteIonVarVector& writelist); - - - /** - * \brief Setter for member variable \ref Useion.valence (rvalue reference) - */ - void set_valence(std::shared_ptr&& valence); - - /** - * \brief Setter for member variable \ref Useion.valence - */ - void set_valence(const std::shared_ptr& valence); - - - /** - * \brief Setter for member variable \ref Useion.ontology_id (rvalue reference) - */ - void set_ontology_id(std::shared_ptr&& ontology_id); - - /** - * \brief Setter for member variable \ref Useion.ontology_id - */ - void set_ontology_id(const std::shared_ptr& ontology_id); - + /** + * \brief Setter for member variable \ref Useion.ontology_id + */ + void set_ontology_id(const std::shared_ptr& ontology_id); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -367,11 +324,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -383,7 +337,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/valence.hpp ast/valence.hpp --- ast.orig/valence.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/valence.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Valence : public Expression { private: /// TODO - std::shared_ptr type; + std::shared_ptr type; /// TODO - std::shared_ptr value; + std::shared_ptr value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Valence(Name* type, Double* value); - explicit Valence(std::shared_ptr type, std::shared_ptr value); + explicit Valence(const std::shared_ptr& type, const std::shared_ptr& value); Valence(const Valence& obj); - - - virtual ~Valence() = default; - + virtual ~Valence() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Valence * \return true as object is of type ast::Valence @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Valence* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Valence.type - */ - std::shared_ptr get_type() const noexcept { - return type; - } - - - - - - - - /** - * \brief Getter for member variable \ref Valence.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Valence.type + */ + const std::shared_ptr& get_type() const noexcept { + return type; + } + + + + /** + * \brief Getter for member variable \ref Valence.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Valence.type (rvalue reference) + */ + void set_type(std::shared_ptr&& type); + /** + * \brief Setter for member variable \ref Valence.type + */ + void set_type(const std::shared_ptr& type); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Valence.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Valence.type (rvalue reference) - */ - void set_type(std::shared_ptr&& type); - - /** - * \brief Setter for member variable \ref Valence.type - */ - void set_type(const std::shared_ptr& type); - - - /** - * \brief Setter for member variable \ref Valence.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Valence.value - */ - void set_value(const std::shared_ptr& value); - + /** + * \brief Setter for member variable \ref Valence.value + */ + void set_value(const std::shared_ptr& value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/var_name.hpp ast/var_name.hpp --- ast.orig/var_name.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/var_name.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -46,33 +44,23 @@ class VarName : public Identifier { private: /// Name of variable - std::shared_ptr name; + std::shared_ptr name; /// Value specified with `@` - std::shared_ptr at; + std::shared_ptr at; /// index value in case of array - std::shared_ptr index; + std::shared_ptr index; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit VarName(Identifier* name, Integer* at, Expression* index); - explicit VarName(std::shared_ptr name, std::shared_ptr at, std::shared_ptr index); + explicit VarName(const std::shared_ptr& name, const std::shared_ptr& at, const std::shared_ptr& index); VarName(const VarName& obj); - - - virtual ~VarName() = default; - + virtual ~VarName() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::VarName * \return true as object is of type ast::VarName @@ -89,7 +77,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) VarName* clone() const override { @@ -144,125 +132,102 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Identifier has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref VarName.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - - - - - - /** - * \brief Getter for member variable \ref VarName.at - */ - std::shared_ptr get_at() const noexcept { - return at; - } - - - - - - - - /** - * \brief Getter for member variable \ref VarName.index - */ - std::shared_ptr get_index() const noexcept { - return index; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Identifier has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref VarName.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } + + + + /** + * \brief Getter for member variable \ref VarName.at + */ + const std::shared_ptr& get_at() const noexcept { + return at; + } + + + + /** + * \brief Getter for member variable \ref VarName.index + */ + const std::shared_ptr& get_index() const noexcept { + return index; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref VarName.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); + /** + * \brief Setter for member variable \ref VarName.name + */ + void set_name(const std::shared_ptr& name); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref VarName.at (rvalue reference) + */ + void set_at(std::shared_ptr&& at); + /** + * \brief Setter for member variable \ref VarName.at + */ + void set_at(const std::shared_ptr& at); + + /** + * \brief Setter for member variable \ref VarName.index (rvalue reference) + */ + void set_index(std::shared_ptr&& index); - - /** - * \brief Setter for member variable \ref VarName.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref VarName.name - */ - void set_name(const std::shared_ptr& name); - - - /** - * \brief Setter for member variable \ref VarName.at (rvalue reference) - */ - void set_at(std::shared_ptr&& at); - - /** - * \brief Setter for member variable \ref VarName.at - */ - void set_at(const std::shared_ptr& at); - - - /** - * \brief Setter for member variable \ref VarName.index (rvalue reference) - */ - void set_index(std::shared_ptr&& index); - - /** - * \brief Setter for member variable \ref VarName.index - */ - void set_index(const std::shared_ptr& index); - + /** + * \brief Setter for member variable \ref VarName.index + */ + void set_index(const std::shared_ptr& index); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -304,11 +269,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -320,7 +282,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/verbatim.hpp ast/verbatim.hpp --- ast.orig/verbatim.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/verbatim.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class Verbatim : public Statement { private: /// C code as a string - std::shared_ptr statement; + std::shared_ptr statement; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Verbatim(String* statement); - explicit Verbatim(std::shared_ptr statement); + explicit Verbatim(const std::shared_ptr& statement); Verbatim(const Verbatim& obj); - - - virtual ~Verbatim() = default; - + virtual ~Verbatim() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Verbatim * \return true as object is of type ast::Verbatim @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Verbatim* clone() const override { @@ -149,65 +137,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Verbatim.statement - */ - std::shared_ptr get_statement() const noexcept { - return statement; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Verbatim.statement + */ + const std::shared_ptr& get_statement() const noexcept { + return statement; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Verbatim.statement (rvalue reference) + */ + void set_statement(std::shared_ptr&& statement); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref Verbatim.statement (rvalue reference) - */ - void set_statement(std::shared_ptr&& statement); - - /** - * \brief Setter for member variable \ref Verbatim.statement - */ - void set_statement(const std::shared_ptr& statement); - + /** + * \brief Setter for member variable \ref Verbatim.statement + */ + void set_statement(const std::shared_ptr& statement); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -249,11 +222,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -265,7 +235,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/watch.hpp ast/watch.hpp --- ast.orig/watch.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/watch.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class Watch : public Expression { private: /// TODO - std::shared_ptr expression; + std::shared_ptr expression; /// TODO - std::shared_ptr value; + std::shared_ptr value; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit Watch(Expression* expression, Expression* value); - explicit Watch(std::shared_ptr expression, std::shared_ptr value); + explicit Watch(const std::shared_ptr& expression, const std::shared_ptr& value); Watch(const Watch& obj); - - - virtual ~Watch() = default; - + virtual ~Watch() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::Watch * \return true as object is of type ast::Watch @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) Watch* clone() const override { @@ -137,89 +125,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref Watch.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - - - - - - /** - * \brief Getter for member variable \ref Watch.value - */ - std::shared_ptr get_value() const noexcept { - return value; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref Watch.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } + + + + /** + * \brief Getter for member variable \ref Watch.value + */ + const std::shared_ptr& get_value() const noexcept { + return value; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref Watch.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); + /** + * \brief Setter for member variable \ref Watch.expression + */ + void set_expression(const std::shared_ptr& expression); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref Watch.value (rvalue reference) + */ + void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Watch.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref Watch.expression - */ - void set_expression(const std::shared_ptr& expression); - - - /** - * \brief Setter for member variable \ref Watch.value (rvalue reference) - */ - void set_value(std::shared_ptr&& value); - - /** - * \brief Setter for member variable \ref Watch.value - */ - void set_value(const std::shared_ptr& value); - + /** + * \brief Setter for member variable \ref Watch.value + */ + void set_value(const std::shared_ptr& value); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -261,11 +230,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -277,7 +243,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/watch_statement.hpp ast/watch_statement.hpp --- ast.orig/watch_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/watch_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -23,15 +23,13 @@ #include "ast/statement.hpp" #include "ast/watch.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -42,28 +40,18 @@ class WatchStatement : public Statement { private: /// Vector of watch statements - WatchVector statements; + WatchVector statements; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - - explicit WatchStatement(WatchVector statements); + explicit WatchStatement(const WatchVector& statements); WatchStatement(const WatchStatement& obj); - - - virtual ~WatchStatement() = default; - + virtual ~WatchStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::WatchStatement * \return true as object is of type ast::WatchStatement @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) WatchStatement* clone() const override { @@ -149,113 +137,98 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - -/** - * \brief Add member to statements by raw pointer - */ -void emplace_back_watch(Watch *n); - -/** - * \brief Add member to statements by shared_ptr - */ -void emplace_back_watch(std::shared_ptr n); - -/** - * \brief Erase member to statements - */ -WatchVector::const_iterator erase_watch(WatchVector::const_iterator first); - -/** - * \brief Erase members to statements - */ -WatchVector::const_iterator erase_watch(WatchVector::const_iterator first, WatchVector::const_iterator last); - -/** - * \brief Erase non-consecutive members to statements - * - * loosely following the cpp reference of remove_if - */ -size_t erase_watch(std::unordered_set& to_be_erased); + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + /** + * \brief Add member to statements by raw pointer + */ + void emplace_back_watch(Watch *n); -/** - * \brief Insert member to statements - */ -WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr& n); + /** + * \brief Add member to statements by shared_ptr + */ + void emplace_back_watch(std::shared_ptr n); -/** - * \brief Insert members to statements - */ -template -void insert_watch(WatchVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); + /** + * \brief Erase member to statements + */ + WatchVector::const_iterator erase_watch(WatchVector::const_iterator first); -/** - * \brief Reset member to statements - */ -void reset_watch(WatchVector::const_iterator position, Watch* n); + /** + * \brief Erase members to statements + */ + WatchVector::const_iterator erase_watch(WatchVector::const_iterator first, WatchVector::const_iterator last); -/** - * \brief Reset member to statements - */ -void reset_watch(WatchVector::const_iterator position, std::shared_ptr n); + /** + * \brief Erase non-consecutive members to statements + * + * loosely following the cpp reference of remove_if + */ + size_t erase_watch(std::unordered_set& to_be_erased); + /** + * \brief Insert member to statements + */ + WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr& n); - + /** + * \brief Insert members to statements + */ + template + void insert_watch(WatchVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last); - - /** - * \brief Getter for member variable \ref WatchStatement.statements - */ - const WatchVector& get_statements() const noexcept { - return statements; - } - + /** + * \brief Reset member to statements + */ + void reset_watch(WatchVector::const_iterator position, Watch* n); + /** + * \brief Reset member to statements + */ + void reset_watch(WatchVector::const_iterator position, std::shared_ptr n); + + + /** + * \brief Getter for member variable \ref WatchStatement.statements + */ + const WatchVector& get_statements() const noexcept { + return statements; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref WatchStatement.statements (rvalue reference) + */ + void set_statements(WatchVector&& statements); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref WatchStatement.statements (rvalue reference) - */ - void set_statements(WatchVector&& statements); - - /** - * \brief Setter for member variable \ref WatchStatement.statements - */ - void set_statements(const WatchVector& statements); - + /** + * \brief Setter for member variable \ref WatchStatement.statements + */ + void set_statements(const WatchVector& statements); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -297,11 +270,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -313,7 +283,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class /** diff -ru ast.orig/while_statement.hpp ast/while_statement.hpp --- ast.orig/while_statement.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/while_statement.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/statement.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,31 +39,21 @@ class WhileStatement : public Statement { private: /// TODO - std::shared_ptr condition; + std::shared_ptr condition; /// TODO - std::shared_ptr statement_block; + std::shared_ptr statement_block; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit WhileStatement(Expression* condition, StatementBlock* statement_block); - explicit WhileStatement(std::shared_ptr condition, std::shared_ptr statement_block); + explicit WhileStatement(const std::shared_ptr& condition, const std::shared_ptr& statement_block); WhileStatement(const WhileStatement& obj); - - - virtual ~WhileStatement() = default; - + virtual ~WhileStatement() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::WhileStatement * \return true as object is of type ast::WhileStatement @@ -82,7 +70,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) WhileStatement* clone() const override { @@ -151,89 +139,70 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref WhileStatement.condition - */ - std::shared_ptr get_condition() const noexcept { - return condition; - } - - - - - - - - /** - * \brief Getter for member variable \ref WhileStatement.statement_block - */ - std::shared_ptr get_statement_block() const noexcept override { - return statement_block; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref WhileStatement.condition + */ + const std::shared_ptr& get_condition() const noexcept { + return condition; + } + + + + /** + * \brief Getter for member variable \ref WhileStatement.statement_block + */ + const std::shared_ptr& get_statement_block() const noexcept override { + return statement_block; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref WhileStatement.condition (rvalue reference) + */ + void set_condition(std::shared_ptr&& condition); + /** + * \brief Setter for member variable \ref WhileStatement.condition + */ + void set_condition(const std::shared_ptr& condition); - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - + + /** + * \brief Setter for member variable \ref WhileStatement.statement_block (rvalue reference) + */ + void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref WhileStatement.condition (rvalue reference) - */ - void set_condition(std::shared_ptr&& condition); - - /** - * \brief Setter for member variable \ref WhileStatement.condition - */ - void set_condition(const std::shared_ptr& condition); - - - /** - * \brief Setter for member variable \ref WhileStatement.statement_block (rvalue reference) - */ - void set_statement_block(std::shared_ptr&& statement_block); - - /** - * \brief Setter for member variable \ref WhileStatement.statement_block - */ - void set_statement_block(const std::shared_ptr& statement_block); - + /** + * \brief Setter for member variable \ref WhileStatement.statement_block + */ + void set_statement_block(const std::shared_ptr& statement_block); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -275,11 +244,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -291,7 +257,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/wrapped_expression.hpp ast/wrapped_expression.hpp --- ast.orig/wrapped_expression.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/wrapped_expression.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/expression.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class WrappedExpression : public Expression { private: /// Expression that is being wrapped - std::shared_ptr expression; + std::shared_ptr expression; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit WrappedExpression(Expression* expression); - explicit WrappedExpression(std::shared_ptr expression); + explicit WrappedExpression(const std::shared_ptr& expression); WrappedExpression(const WrappedExpression& obj); - - - virtual ~WrappedExpression() = default; - + virtual ~WrappedExpression() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::WrappedExpression * \return true as object is of type ast::WrappedExpression @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) WrappedExpression* clone() const override { @@ -135,65 +123,50 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - - - - /** - * \brief Getter for member variable \ref WrappedExpression.expression - */ - std::shared_ptr get_expression() const noexcept { - return expression; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + + /** + * \brief Getter for member variable \ref WrappedExpression.expression + */ + const std::shared_ptr& get_expression() const noexcept { + return expression; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref WrappedExpression.expression (rvalue reference) + */ + void set_expression(std::shared_ptr&& expression); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref WrappedExpression.expression (rvalue reference) - */ - void set_expression(std::shared_ptr&& expression); - - /** - * \brief Setter for member variable \ref WrappedExpression.expression - */ - void set_expression(const std::shared_ptr& expression); - + /** + * \brief Setter for member variable \ref WrappedExpression.expression + */ + void set_expression(const std::shared_ptr& expression); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -235,11 +208,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -251,7 +221,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class diff -ru ast.orig/write_ion_var.hpp ast/write_ion_var.hpp --- ast.orig/write_ion_var.hpp 2023-09-26 12:20:29.000000000 +0200 +++ ast/write_ion_var.hpp 2023-09-26 13:11:59.000000000 +0200 @@ -22,15 +22,13 @@ #include "ast/ast_decl.hpp" #include "ast/identifier.hpp" - - namespace nmodl { namespace ast { /** - * @addtogroup ast_class - * @ingroup ast - * @{ + * \addtogroup ast_class + * \ingroup ast + * \{ */ /** @@ -41,29 +39,19 @@ class WriteIonVar : public Identifier { private: /// TODO - std::shared_ptr name; + std::shared_ptr name; /// token with location information - std::shared_ptr token; + std::shared_ptr token; public: - /// \name Ctor & dtor /// \{ - explicit WriteIonVar(Name* name); - explicit WriteIonVar(std::shared_ptr name); + explicit WriteIonVar(const std::shared_ptr& name); WriteIonVar(const WriteIonVar& obj); - - - virtual ~WriteIonVar() = default; - + virtual ~WriteIonVar() = default; /// \} - - - - - /** * \brief Check if the ast node is an instance of ast::WriteIonVar * \return true as object is of type ast::WriteIonVar @@ -80,7 +68,7 @@ * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the * ast. * - * @return pointer to the clone/copy of the current node + * \return pointer to the clone/copy of the current node */ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) WriteIonVar* clone() const override { @@ -135,77 +123,62 @@ return std::static_pointer_cast(shared_from_this()); } - /** - * \brief Return associated token for the current ast node - * - * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor - * can insert new nodes in the ast as a solution of ODEs. In this case, we return - * nullptr to store in the nmodl::symtab::SymbolTable. - * - * \return pointer to token if exist otherwise nullptr - */ - const ModToken* get_token() const noexcept override { - return token.get(); - } - - - - - - -/** - * \brief Return name of the node - * - * Some ast nodes have a member marked designated as node name. For example, - * in case of this ast::Name has name designated as a - * node name. - * - * @return name of the node as std::string - * - * \sa Ast::get_node_type_name - */ -std::string get_node_name() const override; - - - /** - * \brief Getter for member variable \ref WriteIonVar.name - */ - std::shared_ptr get_name() const noexcept { - return name; - } - - - + /** + * \brief Return associated token for the current ast node + * + * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor + * can insert new nodes in the ast as a solution of ODEs. In this case, we return + * nullptr to store in the nmodl::symtab::SymbolTable. + * + * \return pointer to token if exist otherwise nullptr + */ + const ModToken* get_token() const noexcept override { + return token.get(); + } + + + /** + * \brief Return name of the node + * + * Some ast nodes have a member marked designated as node name. For example, + * in case of this ast::Name has name designated as a + * node name. + * + * \return name of the node as std::string + * + * \sa Ast::get_node_type_name + */ + std::string get_node_name() const override; + + /** + * \brief Getter for member variable \ref WriteIonVar.name + */ + const std::shared_ptr& get_name() const noexcept { + return name; + } /// \} /// \name Setters /// \{ + /** + * \brief Set token for the current ast node + */ + void set_token(const ModToken& tok) { token = std::make_shared(tok); } + + /** + * \brief Setter for member variable \ref WriteIonVar.name (rvalue reference) + */ + void set_name(std::shared_ptr&& name); - - /** - * \brief Set token for the current ast node - */ - void set_token(const ModToken& tok) { token = std::make_shared(tok); } - - - - - /** - * \brief Setter for member variable \ref WriteIonVar.name (rvalue reference) - */ - void set_name(std::shared_ptr&& name); - - /** - * \brief Setter for member variable \ref WriteIonVar.name - */ - void set_name(const std::shared_ptr& name); - + /** + * \brief Setter for member variable \ref WriteIonVar.name + */ + void set_name(const std::shared_ptr& name); /// \} /// \name Visitor /// \{ - /** * \brief visit children i.e. member variables of current node using provided visitor * @@ -247,11 +220,8 @@ * \copydoc accept(visitor::Visitor&) */ void accept(visitor::ConstVisitor& v) const override; - /// \} - - private: /** * \brief Set this object as parent for all the children @@ -263,7 +233,7 @@ void set_parent_in_children(); }; -/** @} */ // end of ast_class +/** \} */ // end of ast_class