Cadabra
Computer algebra system for field theory problems
|
Class which turns the string output of a preprocessor
object and turns it into an Ex expression tree.
The output of preprocessor
is assumed to be valid and consistent, so the code here is rather simple.
#include <Parser.hh>
Public Member Functions | |
Parser () | |
Parser (std::shared_ptr< Ex >) | |
Parser (std::shared_ptr< Ex >, const std::string &) | |
void | erase () |
void | remove_empty_nodes () |
void | finalise () |
Finalise the parsed expression. More... | |
bool | string2tree (const std::string &inp) |
Public Attributes | |
std::shared_ptr< Ex > | tree |
Private Types | |
enum | mode_t { m_skipwhite =0 , m_name =1 , m_findchildren =2 , m_singlecharname =3 , m_backslashname =4 , m_childgroup =5 , m_initialgroup =6 , m_verbatim =7 , m_property =8 } |
Private Member Functions | |
void | advance (unsigned int &i) |
char32_t | get_token (unsigned int i) |
bool | is_number (const std::u32string &str) const |
str_node::bracket_t | is_closing_bracket (const char32_t &br) const |
str_node::bracket_t | is_opening_bracket (const char32_t &br) const |
str_node::parent_rel_t | is_link (const char32_t &ln) const |
Private Attributes | |
Ex::iterator | parts |
std::u32string | str |
std::vector< mode_t > | current_mode |
std::vector< str_node::bracket_t > | current_bracket |
std::vector< str_node::parent_rel_t > | current_parent_rel |
|
private |
Parser::Parser | ( | ) |
Parser::Parser | ( | std::shared_ptr< Ex > | t | ) |
Parser::Parser | ( | std::shared_ptr< Ex > | t, |
const std::string & | str | ||
) |
|
private |
void Parser::erase | ( | ) |
void Parser::finalise | ( | ) |
Finalise the parsed expression.
This function should be called when no further operator>> calls are going to be made, and is necessary to ensure that the tree is consistent.
|
private |
|
private |
|
private |
|
private |
|
private |
void Parser::remove_empty_nodes | ( | ) |
bool Parser::string2tree | ( | const std::string & | inp | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
std::shared_ptr<Ex> cadabra::Parser::tree |