|
HIPO
4.3.0
High Performance Output data format for experimental physics
|
Mathematical expression parser and evaluator. More...
#include <parser.h>
Public Types | |
| enum | TokenType { NONE , NAME , NUMBER , END , PLUS ='+' , MINUS ='-' , MULTIPLY ='*' , DIVIDE ='/' , ASSIGN ='=' , LHPAREN ='(' , RHPAREN =')' , COMMA =',' , NOT ='!' , LT ='<' , GT ='>' , LE , GE , EQ , NE , AND , OR , ASSIGN_ADD , ASSIGN_SUB , ASSIGN_MUL , ASSIGN_DIV } |
| Token types used by the expression lexer. More... | |
Public Member Functions | |
| Parser (const std::string &program) | |
| Construct a parser with the given expression. More... | |
| const double | Evaluate () |
| Evaluate the stored expression using current symbol values. More... | |
| const double | Evaluate (const std::string &program) |
| Evaluate a new expression using current symbol values. More... | |
| double & | operator[] (const std::string &key) |
| Access or create a symbol (variable) by name. More... | |
Public Attributes | |
| std::map< std::string, double > | symbols_ |
| Symbol table mapping variable names to values. Can be accessed directly. More... | |
Mathematical expression parser and evaluator.
Parses and evaluates arithmetic expressions with support for variables, comparisons, logical operators, and standard math functions. Used internally by hipo::bank::rowlist::filter for expression-based filtering.
Token types used by the expression lexer.
Represents all possible token categories including literals (NUMBER, NAME), operators (arithmetic, comparison, logical), and delimiters.
|
inline |
| const double hipo::Parser::Evaluate | ( | ) |
Evaluate the stored expression using current symbol values.
Definition at line 653 of file parser.cpp.
| const double hipo::Parser::Evaluate | ( | const std::string & | program | ) |
Evaluate a new expression using current symbol values.
| program | Expression string to evaluate |
Definition at line 664 of file parser.cpp.
|
inline |
| std::map<std::string, double> hipo::Parser::symbols_ |