|
TECA
The Toolkit for Extreme Climate Analysis
|
Codes dealing with expression parsing. More...
Classes | |
| class | tokenizer |
Functions | |
| template<typename tokenizer_t = teca_parser::tokenizer> | |
| char * | infix_to_postfix (const char *iexpr, std::set< std::string > *variables) |
| template<typename work_t , typename arg_t , typename operand_resolver_t , typename operator_resolver_t , typename tokenizer_t = teca_parser::tokenizer> | |
| int | eval_postfix (arg_t &iexpr_result, const char *iexpr, operand_resolver_t &operands) |
Codes dealing with expression parsing.
| int teca_parser::eval_postfix | ( | arg_t & | iexpr_result, |
| const char * | iexpr, | ||
| operand_resolver_t & | operands | ||
| ) |
evaluate a postfix expression. returns non zero if an error occurred. the result of the evaluated expression is returned in iexpr_result.
template types define the intermediate types used in the calculation. arg_t would likely be the const form of work_t. resolvers for constants, variables, and operators are passed. The purpose of the resolvers is to identify token class and implement variable lookup, and operator evaluation.
| char* teca_parser::infix_to_postfix | ( | const char * | iexpr, |
| std::set< std::string > * | variables | ||
| ) |
Convert infix expression to postfix. returns the postfix form of the expression in a string allocated with malloc. caller to free the string. return nullptr if there is an error.
template types implement detection of classes of syntactical tokens. groups, constants, variables, and operators.