![Logo](logo.png) |
User Guide
|
Go to the documentation of this file.
18 #include <unordered_set>
46 const std::set<std::string>& vars,
47 const std::string& original_string,
53 const std::string& suffix,
54 std::map<std::string, int>& variables);
66 ast::LocalVar*
add_local_variable(ast::StatementBlock& node,
const std::string& varname);
67 ast::LocalVar*
add_local_variable(ast::StatementBlock& node, ast::Identifier* varname);
68 ast::LocalVar*
add_local_variable(ast::StatementBlock& node,
const std::string& varname,
int dim);
72 std::shared_ptr<ast::Statement>
create_statement(
const std::string& code_statement);
76 const std::vector<std::string>::const_iterator& code_statements_beg,
77 const std::vector<std::string>::const_iterator& code_statements_end);
82 const std::vector<std::string>& code_statements);
90 bool calls_function(
const ast::Ast& node,
const std::string& name);
97 const std::vector<ast::AstNodeType>& types = {});
102 const std::vector<ast::AstNodeType>& types = {});
105 bool solver_exists(
const ast::Ast& node,
const std::string& name);
111 std::string
to_nmodl(
const ast::Ast& node,
const std::set<ast::AstNodeType>& exclude_types = {});
114 template <
typename T>
115 typename std::enable_if<std::is_base_of<ast::Ast, T>::value, std::string>::type
to_nmodl(
116 const std::shared_ptr<T>& node,
117 const std::set<ast::AstNodeType>& exclude_types = {}) {
118 return to_nmodl(*node, exclude_types);
122 std::string
to_json(
const ast::Ast& node,
123 bool compact =
false,
125 bool add_nmodl =
false);
135 const std::shared_ptr<ast::Expression>& lhs,
136 const std::shared_ptr<ast::Expression>& rhs);
std::string get_indexed_name(const ast::IndexedName &node)
Given a Indexed node, return the name with index.
std::string to_nmodl(const ast::Ast &node, const std::set< ast::AstNodeType > &exclude_types)
Given AST node, return the NMODL string representation.
std::vector< std::shared_ptr< Statement > > create_statements(const std::vector< std::string >::const_iterator &code_statements_beg, const std::vector< std::string >::const_iterator &code_statements_end)
Same as for create_statement but for vectors of strings.
bool calls_function(const ast::Ast &node, const std::string &name)
Checks whether block contains a call to a particular function.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
std::shared_ptr< ast::LocalListStatement > get_local_list_statement(const StatementBlock &node)
Return pointer to local statement in the given block, otherwise nullptr.
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.
bool is_random_construct_function(const std::string &name)
Is given name a one of the function for RANDOM construct.
std::pair< std::string, std::unordered_set< std::string > > statement_dependencies(const std::shared_ptr< ast::Expression > &lhs, const std::shared_ptr< ast::Expression > &rhs)
If lhs and rhs combined represent an assignment (we assume to have an "=" in between them) we extract...
AstNodeType
Enum type for every AST node type.
bool solver_exists(const ast::Ast &node, const std::string &name)
Whether or not a solver of type name exists in the AST.
UseNumbersInString
Enum to wrap bool variable to select if random string should have numbers or not.
std::string statement_dependencies_key(const std::shared_ptr< ast::Expression > &lhs)
The result.first of statement_dependencies.
bool is_nrn_pointing(const std::string &name)
Is given name nrn_pointing.
bool node_exists(const ast::Ast &node, ast::AstNodeType ast_type)
Whether a node of type ast_type exists as a subnode of node.
std::string get_full_var_name(const ast::VarName &node)
Given a VarName node, return the full var name including index.
std::shared_ptr< Statement > create_statement(const std::string &code_statement)
Convert given code statement (in string format) to corresponding ast node.
std::vector< std::shared_ptr< const ast::Ast > > collect_nodes(const ast::Ast &node, const std::vector< ast::AstNodeType > &types)
traverse node recursively and collect nodes of given types
void add_local_statement(StatementBlock &node)
Add empty local statement to given block if already doesn't exist.
std::string get_new_name(const std::string &name, const std::string &suffix, std::map< std::string, int > &variables)
Return new name variable by appending _suffix_COUNT where COUNT is number of times the given variable...
std::shared_ptr< StatementBlock > create_statement_block(const std::vector< std::string > &code_statements)
Convert given code statement (in string format) to corresponding ast node.
LocalVar * add_local_variable(StatementBlock &node, Identifier *varname)
std::string suffix_random_string(const std::set< std::string > &vars, const std::string &original_string, const UseNumbersInString use_num)
Return the "original_string" with a random suffix if "original_string" exists in "vars".
Common utility functions for file/dir manipulation.
std::set< std::string > get_global_vars(const Program &node)
Return set of strings with the names of all global variables.