8 #include <catch2/catch_test_macros.hpp>
15 using namespace nmodl;
16 using namespace visitor;
30 v.visit_program(*ast);
35 return v.verbatim_blocks();
38 TEST_CASE(
"Parse VERBATIM block using Verbatim Visitor") {
39 SECTION(
"Single Block") {
40 const std::string
text =
"VERBATIM int a; ENDVERBATIM";
43 REQUIRE(blocks.size() == 1);
44 REQUIRE(blocks.front() ==
" int a; ");
47 SECTION(
"Multiple Blocks") {
48 std::string
text =
"VERBATIM int a; ENDVERBATIM VERBATIM float b; ENDVERBATIM";
51 REQUIRE(blocks.size() == 2);
52 REQUIRE(blocks[0] ==
" int a; ");
53 REQUIRE(blocks[1] ==
" float b; ");
Visitor for checking parents of ast nodes
Class that binds all pieces together for parsing nmodl file.
Visitor for verbatim blocks of AST
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)
encapsulates code generation backend implementations
Auto generated AST classes declaration.
nmodl::parser::UnitDriver driver
TEST_CASE("Parse VERBATIM block using Verbatim Visitor")
std::vector< std::string > run_verbatim_visitor(const std::string &text)
Visitor for verbatim blocks of AST