8 #include <catch2/catch_test_macros.hpp>
9 #include <catch2/matchers/catch_matchers_string.hpp>
21 using namespace nmodl;
22 using namespace visitor;
24 using namespace test_utils;
26 using Catch::Matchers::Equals;
42 std::stringstream stream;
52 SCENARIO(
"LocalVarRenameVisitor works with InlineVisitor",
"[visitor][localvarrename]") {
53 GIVEN(
"A FUNCTION that gets inlined with a LOCAL variable") {
55 FUNCTION rates_1(Vm (mV)) {
61 FUNCTION rates_2(Vm (mV)) {
65 std::string output_nmodl = R"(
66 FUNCTION rates_1(Vm(mV)) {
72 FUNCTION rates_2(Vm(mV)) {
80 rates_2 = rates_1_in_0
83 THEN("LOCAL variable in inlined function gets renamed") {
87 REQUIRE(
result == expected_result);
Visitor for checking parents of ast nodes
Class that binds all pieces together for parsing nmodl file.
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor to inline local procedure and function calls
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor to rename local variables conflicting with global scope
Visitor for printing AST back to NMODL
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.
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 rename local variables conflicting with global scope
std::string run_inline_localvarrename_visitor(const std::string &text)
SCENARIO("LocalVarRenameVisitor works with InlineVisitor", "[visitor][localvarrename]")
std::string reindent_text(const std::string &text, int indent_level)
Reindent nmodl text for text-to-text comparison.
encapsulates code generation backend implementations
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
Auto generated AST classes declaration.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::parser::UnitDriver driver