cgv
Loading...
Searching...
No Matches
cgv::ppp::expression_processor Class Reference

Public Member Functions

bool parse (const token &input_token)
 
void extract_begins (std::vector< unsigned > &begins, unsigned i0=0, unsigned ie=-1) const
 
bool assign_func_decl (const std::vector< variant > &values) const
 
bool is_func_decl () const
 
int classify_call (unsigned i) const
 
bool validate (bool allow_several_values=false)
 
bool evaluate (variant &result, ph_processor *ph_proc)
 
const std::string & get_last_error () const
 
const tokenget_last_error_token () const
 

Public Attributes

bool found_error
 
bool issued_error
 

Protected Types

typedef std::pair< unsigned int, unsigned int > expr_stack_entry
 

Protected Member Functions

void prepare ()
 
bool compress_stack_validate (int priority, std::vector< expr_stack_entry > &expression_stack, std::vector< ExpressionPart > &parenthesis_stack, std::stack< variant > &value_stack, std::stack< OperatorType > &operator_stack)
 
bool compress_stack_evaluate (int priority, std::vector< expr_stack_entry > &expression_stack, std::vector< ExpressionPart > &parenthesis_stack, std::stack< variant > &value_stack, std::stack< OperatorType > &operator_stack)
 
unsigned int get_nr_comma_separated_expressions (std::vector< expr_stack_entry > &expression_stack, std::vector< ExpressionPart > &parenthesis_stack, std::stack< variant > &value_stack) const
 
ExpressionPart find_last_parenthesis (std::vector< expr_stack_entry > &expression_stack, std::vector< ExpressionPart > &parenthesis_stack) const
 

Protected Attributes

bool debug_parse
 
bool debug_evaluate
 
std::vector< expression_tokenexpression_tokens
 
std::string last_error
 
token last_error_token
 

Detailed Description

Definition at line 29 of file expression_processor.h.

Member Typedef Documentation

◆ expr_stack_entry

typedef std::pair<unsigned int, unsigned int> cgv::ppp::expression_processor::expr_stack_entry
protected

Definition at line 36 of file expression_processor.h.

Constructor & Destructor Documentation

◆ expression_processor()

cgv::ppp::expression_processor::expression_processor ( )

Definition at line 39 of file expression_processor.cxx.

Member Function Documentation

◆ assign_func_decl()

bool cgv::ppp::expression_processor::assign_func_decl ( const std::vector< variant > &  values) const

Definition at line 293 of file expression_processor.cxx.

◆ classify_call()

int cgv::ppp::expression_processor::classify_call ( unsigned  i) const

Definition at line 247 of file expression_processor.cxx.

◆ compress_stack_evaluate()

bool cgv::ppp::expression_processor::compress_stack_evaluate ( int  priority,
std::vector< expr_stack_entry > &  expression_stack,
std::vector< ExpressionPart > &  parenthesis_stack,
std::stack< variant > &  value_stack,
std::stack< OperatorType > &  operator_stack 
)
protected

Definition at line 952 of file expression_processor.cxx.

◆ compress_stack_validate()

bool cgv::ppp::expression_processor::compress_stack_validate ( int  priority,
std::vector< expr_stack_entry > &  expression_stack,
std::vector< ExpressionPart > &  parenthesis_stack,
std::stack< variant > &  value_stack,
std::stack< OperatorType > &  operator_stack 
)
protected

Definition at line 1019 of file expression_processor.cxx.

◆ evaluate()

bool cgv::ppp::expression_processor::evaluate ( variant result,
ph_processor ph_proc 
)

store for each started expression the sizes of the value and operator stacks before this expression

store for each started expression the expression part that started the expression, i.e. open parentheses or commas

stack of values that will still be processed

stack of operators that separate the not yet processed values

Definition at line 598 of file expression_processor.cxx.

References evaluate(), cgv::ppp::variant::get_element(), cgv::ppp::variant::get_element_name(), cgv::ppp::variant::get_int(), cgv::ppp::variant::get_str(), cgv::ppp::variant::is_func(), cgv::ppp::variant::is_int(), cgv::ppp::variant::is_str(), cgv::ppp::variant::ref_func(), cgv::ppp::variant::ref_value(), and cgv::utils::to_string().

Referenced by evaluate().

◆ extract_begins()

void cgv::ppp::expression_processor::extract_begins ( std::vector< unsigned > &  begins,
unsigned  i0 = 0,
unsigned  ie = -1 
) const

Definition at line 216 of file expression_processor.cxx.

◆ find_last_parenthesis()

ExpressionPart cgv::ppp::expression_processor::find_last_parenthesis ( std::vector< expr_stack_entry > &  expression_stack,
std::vector< ExpressionPart > &  parenthesis_stack 
) const
protected

Definition at line 72 of file expression_processor.cxx.

◆ get_last_error()

const std::string & cgv::ppp::expression_processor::get_last_error ( ) const

Definition at line 1060 of file expression_processor.cxx.

◆ get_last_error_token()

const token & cgv::ppp::expression_processor::get_last_error_token ( ) const

Definition at line 1065 of file expression_processor.cxx.

◆ get_nr_comma_separated_expressions()

unsigned int cgv::ppp::expression_processor::get_nr_comma_separated_expressions ( std::vector< expr_stack_entry > &  expression_stack,
std::vector< ExpressionPart > &  parenthesis_stack,
std::stack< variant > &  value_stack 
) const
protected

Definition at line 51 of file expression_processor.cxx.

◆ is_func_decl()

bool cgv::ppp::expression_processor::is_func_decl ( ) const

Definition at line 321 of file expression_processor.cxx.

◆ parse()

bool cgv::ppp::expression_processor::parse ( const token input_token)

Definition at line 87 of file expression_processor.cxx.

◆ prepare()

void cgv::ppp::expression_processor::prepare ( )
protected

Definition at line 206 of file expression_processor.cxx.

◆ validate()

bool cgv::ppp::expression_processor::validate ( bool  allow_several_values = false)

store for each started expression the sizes of the value and operator stacks before this expression

store for each started expression the expression part that started the expression, i.e. open parentheses or commas

stack of values that will still be processed

stack of operators that separate the not yet processed values

Definition at line 354 of file expression_processor.cxx.

Referenced by cgv::ppp::command_token::split_off_from().

Member Data Documentation

◆ debug_evaluate

bool cgv::ppp::expression_processor::debug_evaluate
protected

Definition at line 35 of file expression_processor.h.

◆ debug_parse

bool cgv::ppp::expression_processor::debug_parse
protected

Definition at line 34 of file expression_processor.h.

◆ expression_tokens

std::vector<expression_token> cgv::ppp::expression_processor::expression_tokens
protected

Definition at line 48 of file expression_processor.h.

◆ found_error

bool cgv::ppp::expression_processor::found_error

Definition at line 60 of file expression_processor.h.

◆ issued_error

bool cgv::ppp::expression_processor::issued_error

Definition at line 61 of file expression_processor.h.

◆ last_error

std::string cgv::ppp::expression_processor::last_error
mutableprotected

Definition at line 57 of file expression_processor.h.

◆ last_error_token

token cgv::ppp::expression_processor::last_error_token
mutableprotected

Definition at line 58 of file expression_processor.h.


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