8 #include <catch2/catch_test_macros.hpp>
19 using namespace nmodl;
20 using namespace visitor;
22 using namespace test_utils;
55 SCENARIO(
"Running visitor passes multiple times",
"[visitor]") {
68 THEN("Passes can run multiple times") {
79 SCENARIO(
"Sympy specific AST to NMODL conversion") {
80 GIVEN(
"NMODL block with unit usage") {
81 static const std::string
nmodl = R
"(
83 Pf_NMDA = (1/1.38) * 120 (mM) * 0.6
84 VDCC = gca_bar_VDCC * 4(um2)*PI*3(1/um3)
85 gca_bar_VDCC = 0.0372 (nS/um2)
89 static const std::string expected = R
"(
91 Pf_NMDA = (1/1.38)*120*0.6
92 VDCC = gca_bar_VDCC*4*PI*3
97 THEN("to_nmodl can ignore all units") {
Visitor for checking parents of ast nodes
Class that binds all pieces together for parsing nmodl file.
Visitor to inline local procedure and function calls
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor to transform global variable usage to local
void visit_program(const ast::Program &node) override
visit node of type ast::Program
Concrete visitor for constructing symbol table from AST.
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor for checking parents of ast nodes
int check_ast(const ast::Ast &node)
A small wrapper to have a nicer call in parser.cpp.
AstNodeType
Enum type for every AST node type.
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
Visitor to inline local procedure and function calls
Visitor to transform global variable usage to local
void run_visitor_passes(const std::string &text)
SCENARIO("Running visitor passes multiple times", "[visitor]")
std::string reindent_text(const std::string &text, int indent_level)
Reindent nmodl text for text-to-text comparison.
encapsulates code generation backend implementations
std::string to_nmodl(const ast::Ast &node, const std::set< ast::AstNodeType > &exclude_types)
Given AST node, return the NMODL string representation.
Auto generated AST classes declaration.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::parser::UnitDriver driver
Utility functions for visitors implementation.