TECA
The Toolkit for Extreme Climate Analysis
teca_parser.h File Reference
#include "teca_common.h"
#include <vector>
#include <set>
#include <string>
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <cmath>
#include <cstdio>
Include dependency graph for teca_parser.h:

Go to the source code of this file.

Classes

class  teca_parser::tokenizer
 

Namespaces

 teca_parser
 Codes dealing with expression parsing.
 

Macros

#define TECA_PARSER_ERROR(_descr, _expr, _pos)
 
#define TECA_SYNTAX_ERROR(_expr, _pos)   TECA_PARSER_ERROR("Syntax error. ", _expr, _pos)
 
#define TECA_NAME_RESOLUTION_ERROR(_name, _expr, _pos)
 
#define TECA_INVALID_OPERATION_ERROR(_op, _expr, _pos)
 
#define TECA_OPERATION_FAILED_ERROR(_op, _expr, _pos)
 
#define TECA_NUM_OPERANDS_ERROR(_op, _nreq, _ngive, _expr, _pos)
 

Functions

template<typename tokenizer_t = teca_parser::tokenizer>
char * teca_parser::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 teca_parser::eval_postfix (arg_t &iexpr_result, const char *iexpr, operand_resolver_t &operands)
 

Macro Definition Documentation

◆ TECA_INVALID_OPERATION_ERROR

#define TECA_INVALID_OPERATION_ERROR (   _op,
  _expr,
  _pos 
)
Value:
TECA_PARSER_ERROR("Invalid operation \"" \
<< _op << "\". ", _expr, _pos)

◆ TECA_NAME_RESOLUTION_ERROR

#define TECA_NAME_RESOLUTION_ERROR (   _name,
  _expr,
  _pos 
)
Value:
TECA_PARSER_ERROR("Name resolution error \"" \
<< _name << "\". ", _expr, _pos)

◆ TECA_NUM_OPERANDS_ERROR

#define TECA_NUM_OPERANDS_ERROR (   _op,
  _nreq,
  _ngive,
  _expr,
  _pos 
)
Value:
TECA_PARSER_ERROR("Operation \"" << _op \
<< "\" requires " << _nreq << " operands, given " \
<< _ngive << ". ", _expr, _pos)

◆ TECA_OPERATION_FAILED_ERROR

#define TECA_OPERATION_FAILED_ERROR (   _op,
  _expr,
  _pos 
)
Value:
TECA_PARSER_ERROR("Operation \"" << _op \
<< "\" failed. " , _expr, _pos)

◆ TECA_PARSER_ERROR

#define TECA_PARSER_ERROR (   _descr,
  _expr,
  _pos 
)
Value:
TECA_MESSAGE(std::cerr, "ERROR:", ANSI_RED, \
<< "" _descr \
<< "at position " << (_pos) << " in \"" \
<< std::string(_expr, _expr+(_pos)) << END_HL \
<< BEGIN_HL(ANSI_RED) << (_expr+(_pos))[0] << END_HL \
<< BEGIN_HL(ANSI_WHITE) << std::string(_expr+(_pos)+1) << "\"")
TECA_MESSAGE
#define TECA_MESSAGE(_strm, _head, _head_color, _msg)
Definition: teca_common.h:120