![Logo](logo.png) |
User Guide
|
Go to the documentation of this file.
8 #include <catch2/catch_test_macros.hpp>
15 #include <nlohmann/json.hpp>
19 using namespace nmodl;
20 using namespace visitor;
35 TEST_CASE(
"Convert NMODL to AST to JSON form using JSONVisitor",
"[visitor][json]") {
36 SECTION(
"JSON object test") {
37 std::string nmodl_text =
"NEURON {}";
53 json result = json::parse(json_text);
55 REQUIRE(expected == result);
58 SECTION(
"JSON text test (compact format)") {
59 std::string nmodl_text =
"NEURON {}";
60 std::string expected = R
"({"Program":[{"NeuronBlock":[{"StatementBlock":[]}]}]})";
63 REQUIRE(result == expected);
Class that binds all pieces together for parsing nmodl file.
encapsulates code generation backend implementations
std::string to_json(const ast::Ast &node, bool compact, bool expand, bool add_nmodl)
Given AST node, return the JSON string representation.
TEST_CASE("Convert NMODL to AST to JSON form using JSONVisitor", "[visitor][json]")
Utility functions for visitors implementation.
Auto generated AST classes declaration.
nmodl::parser::UnitDriver driver
std::string run_json_visitor(const std::string &text, bool compact=false)
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.