Skip to content

Commit

Permalink
nested namespace in declarations files
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan0x committed Sep 29, 2023
1 parent 6c63fbf commit 2f433c3
Show file tree
Hide file tree
Showing 62 changed files with 124 additions and 269 deletions.
7 changes: 2 additions & 5 deletions src/ast/ast_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
#include "symtab/symbol_table.hpp"
#include "visitors/visitor.hpp"

namespace nmodl {

/// Abstract Syntax Tree (AST) related implementations
namespace ast {
namespace nmodl::ast {

/**
* @defgroup ast AST Implementation
Expand Down Expand Up @@ -96,5 +94,4 @@ static const std::string ReactionOpNames[] = {"<->", "<<", "->"};

/** @} */ // end of ast_prop

} // namespace ast
} // namespace nmodl
} // namespace nmodl::ast
6 changes: 2 additions & 4 deletions src/codegen/codegen_acc_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include "codegen/codegen_cpp_visitor.hpp"


namespace nmodl {
namespace codegen {
namespace nmodl::codegen {

/**
* \addtogroup codegen_backends
Expand Down Expand Up @@ -151,5 +150,4 @@ class CodegenAccVisitor: public CodegenCppVisitor {

/** \} */ // end of codegen_backends

} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen
6 changes: 2 additions & 4 deletions src/codegen/codegen_compatibility_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include "utils/logger.hpp"
#include "visitors/ast_visitor.hpp"

namespace nmodl {
namespace codegen {
namespace nmodl::codegen {

using namespace ast;

Expand Down Expand Up @@ -157,5 +156,4 @@ class CodegenCompatibilityVisitor: public visitor::AstVisitor {

/** \} */ // end of codegen_backends

} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen
7 changes: 2 additions & 5 deletions src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@


/// encapsulates code generation backend implementations
namespace nmodl {

namespace codegen {
namespace nmodl::codegen {

/**
* \defgroup codegen Code Generation Implementation
Expand Down Expand Up @@ -1865,5 +1863,4 @@ void CodegenCppVisitor::print_function_declaration(const T& node, const std::str

/** \} */ // end of codegen_backends

} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen
6 changes: 2 additions & 4 deletions src/codegen/codegen_helper_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "symtab/symbol_table.hpp"
#include "visitors/ast_visitor.hpp"

namespace nmodl {
namespace codegen {
namespace nmodl::codegen {

/**
* @addtogroup codegen_details
Expand Down Expand Up @@ -119,5 +118,4 @@ class CodegenHelperVisitor: public visitor::ConstAstVisitor {

/** @} */ // end of codegen_details

} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen
6 changes: 2 additions & 4 deletions src/codegen/codegen_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include "ast/ast.hpp"
#include "symtab/symbol_table.hpp"

namespace nmodl {
namespace codegen {
namespace nmodl::codegen {

/**
* \addtogroup codegen_details
Expand Down Expand Up @@ -439,5 +438,4 @@ struct CodegenInfo {

/** \} */ // end of codegen_backends

} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen
9 changes: 2 additions & 7 deletions src/codegen/codegen_naming.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
#include <string>


namespace nmodl {
namespace codegen {
/// different variable names used in code generation
namespace naming {
namespace nmodl::codegen::naming {

/// nmodl language version
/// @todo : should be moved from codegen to global scope
Expand Down Expand Up @@ -179,6 +176,4 @@ static constexpr char ION_VARNAME_PREFIX[] = "ion_";
{"_tqitem", "tqitem"}};
// clang-format on

} // namespace naming
} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen::naming
8 changes: 2 additions & 6 deletions src/codegen/codegen_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

#include <string>

namespace nmodl {
namespace codegen {
namespace utils {
namespace nmodl::codegen::utils {

/**
* Handles the double constants format being printed in the generated code.
Expand Down Expand Up @@ -46,6 +44,4 @@ std::string format_double_string(const std::string& s_value);
template <typename T>
std::string format_float_string(const std::string& s_value);

} // namespace utils
} // namespace codegen
} // namespace nmodl
} // namespace nmodl::codegen::utils
6 changes: 2 additions & 4 deletions src/lexer/c11_lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include "FlexLexer.h"
#endif

namespace nmodl {
namespace parser {
namespace nmodl::parser {

/**
* @addtogroup lexer
Expand Down Expand Up @@ -108,5 +107,4 @@ class CLexer: public CFlexLexer {

/** @} */ // end of lexer

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/lexer/diffeq_lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include "FlexLexer.h"
#endif

namespace nmodl {
namespace parser {
namespace nmodl::parser {

/**
* @addtogroup lexer
Expand Down Expand Up @@ -80,5 +79,4 @@ class DiffeqLexer: public DiffEqFlexLexer {

/** @} */ // end of lexer

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/lexer/nmodl_lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
#include "FlexLexer.h"
#endif

namespace nmodl {
namespace parser {
namespace nmodl::parser {

/**
* @defgroup lexer Lexer Implementation
Expand Down Expand Up @@ -154,5 +153,4 @@ class NmodlLexer: public NmodlFlexLexer {

/** @} */ // end of lexer

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/lexer/unit_lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include "FlexLexer.h"
#endif

namespace nmodl {
namespace parser {
namespace nmodl::parser {

/**
* @addtogroup lexer
Expand Down Expand Up @@ -83,5 +82,4 @@ class UnitLexer: public UnitFlexLexer {
virtual UnitParser::symbol_type next_token();
};

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/parser/c11_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <vector>


namespace nmodl {
namespace parser {
namespace nmodl::parser {

/// flex generated scanner class (extends base lexer class of flex)
class CLexer;
Expand Down Expand Up @@ -109,5 +108,4 @@ class CDriver {

/** \} */ // end of parser

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
8 changes: 2 additions & 6 deletions src/parser/diffeq_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <utility>

namespace nmodl {
namespace parser {
namespace diffeq {
namespace nmodl::parser::diffeq {

/**
* \class Term
Expand Down Expand Up @@ -127,6 +125,4 @@ class DiffEqContext {
void print() const;
};

} // namespace diffeq
} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser::diffeq
6 changes: 2 additions & 4 deletions src/parser/diffeq_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "parser/diffeq_context.hpp"


namespace nmodl {
namespace parser {
namespace nmodl::parser {

/// flex generated scanner class (extends base lexer class of flex)
class DiffeqlLexer;
Expand Down Expand Up @@ -60,5 +59,4 @@ class DiffeqDriver {

/** @} */ // end of parser

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
9 changes: 2 additions & 7 deletions src/parser/diffeq_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

#include "parser/diffeq_context.hpp"

namespace nmodl {
namespace parser {

/**
* \brief Helper functions for solving differential equations
*
Expand All @@ -23,7 +20,7 @@ namespace parser {
* Need to revisit this, may be using better library like symengine
* altogether.
*/
namespace diffeq {
namespace nmodl::parser::diffeq {

/// operators beign supported as part of binary expressions
enum class MathOp { add = 1, sub, mul, div };
Expand Down Expand Up @@ -175,6 +172,4 @@ inline Term eval_derivative<MathOp::div>(const Term& first,
return solution;
}

} // namespace diffeq
} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser::diffeq
7 changes: 2 additions & 5 deletions src/parser/nmodl_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@


/// encapsulates everything related to NMODL code generation framework
namespace nmodl {
/// encapsulate lexer and parsers implementations
namespace parser {
namespace nmodl::parser {

/**
* \defgroup parser Parser Implementation
Expand Down Expand Up @@ -162,5 +160,4 @@ class NmodlDriver {

/** \} */ // end of parser

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/parser/unit_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <string>
#include <vector>

namespace nmodl {
namespace parser {
namespace nmodl::parser {

/// flex generated scanner class (extends base lexer class of flex)
class UnitLexer;
Expand Down Expand Up @@ -75,5 +74,4 @@ class UnitDriver {
}
};

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser
6 changes: 2 additions & 4 deletions src/parser/verbatim_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <iostream>


namespace nmodl {
namespace parser {
namespace nmodl::parser {

/**
* @addtogroup parser
Expand Down Expand Up @@ -47,8 +46,7 @@ class VerbatimDriver {

/** @} */ // end of parser

} // namespace parser
} // namespace nmodl
} // namespace nmodl::parser


int Verbatim_parse(nmodl::parser::VerbatimDriver*);
7 changes: 2 additions & 5 deletions src/printer/code_printer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <sstream>
#include <string_view>

namespace nmodl {
/// implementation of various printers
namespace printer {
namespace nmodl::printer {

/**
* @defgroup printer Code Printers
Expand Down Expand Up @@ -131,5 +129,4 @@ class CodePrinter {

/** @} */ // end of printer

} // namespace printer
} // namespace nmodl
} // namespace nmodl::printer
6 changes: 2 additions & 4 deletions src/printer/decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
* \brief Forward references of symbols defined in namespace nmodl::printer
*/

namespace nmodl {
namespace printer {
namespace nmodl::printer {

class JSONPrinter;

}
} // namespace nmodl
} // namespace nmodl::printer
6 changes: 2 additions & 4 deletions src/printer/json_printer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include <iostream>
#include <stack>

namespace nmodl {
namespace printer {
namespace nmodl::printer {

using json = nlohmann::json;

Expand Down Expand Up @@ -100,5 +99,4 @@ class JSONPrinter {

/** @} */ // end of printer

} // namespace printer
} // namespace nmodl
} // namespace nmodl::printer
Loading

0 comments on commit 2f433c3

Please sign in to comment.