|
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);
87 const std::set<ast::Node*>& statements);
95 bool calls_function(
const ast::Ast& node,
const std::string& name);
101 const ast::Ast& node,
102 const std::vector<ast::AstNodeType>& types = {});
107 const std::vector<ast::AstNodeType>& types = {});
112 std::string
to_nmodl(
const ast::Ast& node,
const std::set<ast::AstNodeType>& exclude_types = {});
115 template <
typename T>
116 typename std::enable_if<std::is_base_of<ast::Ast, T>::value, std::string>::type
to_nmodl(
117 const std::shared_ptr<T>& node,
118 const std::set<ast::AstNodeType>& exclude_types = {}) {
119 return to_nmodl(*node, exclude_types);
123 std::string
to_json(
const ast::Ast& node,
124 bool compact =
false,
126 bool add_nmodl =
false);
133 const std::shared_ptr<ast::Expression>& lhs,
134 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...
UseNumbersInString
Enum to wrap bool variable to select if random string should have numbers or not.
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)
void remove_statements_from_block(ast::StatementBlock &block, const std::set< ast::Node * > &statements)
Remove statements from given statement block if they exist.
bool sparse_solver_exists(const ast::Ast &node)
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.