Cadabra
Computer algebra system for field theory problems
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
cadabra::Parser Class Reference

Description

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< Extree
 

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_tcurrent_mode
 
std::vector< str_node::bracket_tcurrent_bracket
 
std::vector< str_node::parent_rel_tcurrent_parent_rel
 

Member Enumeration Documentation

◆ mode_t

Enumerator
m_skipwhite 
m_name 
m_findchildren 
m_singlecharname 
m_backslashname 
m_childgroup 
m_initialgroup 
m_verbatim 
m_property 

Constructor & Destructor Documentation

◆ Parser() [1/3]

Parser::Parser ( )

◆ Parser() [2/3]

Parser::Parser ( std::shared_ptr< Ex t)

◆ Parser() [3/3]

Parser::Parser ( std::shared_ptr< Ex t,
const std::string &  str 
)

Member Function Documentation

◆ advance()

void Parser::advance ( unsigned int &  i)
private

◆ erase()

void Parser::erase ( )

◆ finalise()

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.

◆ get_token()

char32_t Parser::get_token ( unsigned int  i)
private

◆ is_closing_bracket()

str_node::bracket_t Parser::is_closing_bracket ( const char32_t &  br) const
private

◆ is_link()

str_node::parent_rel_t Parser::is_link ( const char32_t &  ln) const
private

◆ is_number()

bool Parser::is_number ( const std::u32string &  str) const
private

◆ is_opening_bracket()

str_node::bracket_t Parser::is_opening_bracket ( const char32_t &  br) const
private

◆ remove_empty_nodes()

void Parser::remove_empty_nodes ( )

◆ string2tree()

bool Parser::string2tree ( const std::string &  inp)

Member Data Documentation

◆ current_bracket

std::vector<str_node::bracket_t> cadabra::Parser::current_bracket
private

◆ current_mode

std::vector<mode_t> cadabra::Parser::current_mode
private

◆ current_parent_rel

std::vector<str_node::parent_rel_t> cadabra::Parser::current_parent_rel
private

◆ parts

Ex::iterator cadabra::Parser::parts
private

◆ str

std::u32string cadabra::Parser::str
private

◆ tree

std::shared_ptr<Ex> cadabra::Parser::tree

The documentation for this class was generated from the following files: