![]() |
User Guide
|
#include "utils/fmt.h"
#include <catch2/catch_test_macros.hpp>
#include "ast/double.hpp"
#include "ast/factor_def.hpp"
#include "ast/program.hpp"
#include "parser/nmodl_driver.hpp"
#include "src/config/config.h"
#include "test/unit/utils/nmodl_constructs.hpp"
#include "test/unit/utils/test_utils.hpp"
#include "visitors/checkparent_visitor.hpp"
#include "visitors/units_visitor.hpp"
Go to the source code of this file.
Functions | |
std::tuple< std::shared_ptr< ast::Program >, std::shared_ptr< units::UnitTable > > | run_units_visitor (const std::string &text) |
std::string | get_unit_definitions (const ast::Program &ast, const units::UnitTable &unit_table) |
Returns all the UnitDef s of the ast::Program . More... | |
std::string | get_factor_definitions (const ast::Program &ast) |
Returns all the FactorDef s of the ast::Program . More... | |
SCENARIO ("Parse UNITS block of mod files using Units Visitor", "[visitor][units]") | |
std::string get_factor_definitions | ( | const ast::Program & | ast | ) |
Returns all the FactorDef
s of the ast::Program
.
Visit AST to find all the ast::FactorDef nodes to print their unit names and factors as they are calculated to be printed to the generated .cpp file The FactorDef
s are printed in the format:
ast::Program
to look for FactorDef
sstd::string get_unit_definitions | ( | const ast::Program & | ast, |
const units::UnitTable & | unit_table | ||
) |
Returns all the UnitDef
s of the ast::Program
.
Visit AST to find all the ast::UnitDef nodes to print their unit names, factors and dimensions as they are calculated in the units::UnitTable The UnitDef
s are printed in the format:
If the unit is constant then instead of the dimensions we print constant
ast::Program
to look for UnitDef
s units::UnitTable
to look for the definitions of the unitsstd::tuple<std::shared_ptr<ast::Program>, std::shared_ptr<units::UnitTable> > run_units_visitor | ( | const std::string & | text | ) |