![Logo](logo.png) |
User Guide
|
Go to the documentation of this file.
8 #include <catch2/catch_test_macros.hpp>
15 using namespace nmodl;
16 using namespace visitor;
30 v.visit_program(*ast);
33 CheckParentVisitor().check_ast(*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; ");
Class that binds all pieces together for parsing nmodl file.
encapsulates code generation backend implementations
std::vector< std::string > run_verbatim_visitor(const std::string &text)
Auto generated AST classes declaration.
nmodl::parser::UnitDriver driver
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
Visitor for verbatim blocks of AST
Visitor for checking parents of ast nodes
TEST_CASE("Parse VERBATIM block using Verbatim Visitor")