Static Public Member Functions | Static Private Member Functions | List of all members
PLMD::lepton::Parser Class Reference

This class provides the main interface for parsing expressions. More...

#include <Parser.h>

Static Public Member Functions

static ParsedExpression parse (const std::string &expression)
 Parse a mathematical expression and return a representation of it as an abstract syntax tree. More...
 
static ParsedExpression parse (const std::string &expression, const std::map< std::string, CustomFunction * > &customFunctions)
 Parse a mathematical expression and return a representation of it as an abstract syntax tree. More...
 

Static Private Member Functions

static OperationgetFunctionOperation (const std::string &name, const std::map< std::string, CustomFunction * > &customFunctions)
 
static ParseToken getNextToken (const std::string &expression, int start)
 
static OperationgetOperatorOperation (const std::string &name)
 
static ExpressionTreeNode parsePrecedence (const std::vector< ParseToken > &tokens, int &pos, const std::map< std::string, CustomFunction * > &customFunctions, const std::map< std::string, ExpressionTreeNode > &subexpressionDefs, int precedence)
 
static std::vector< ParseTokentokenize (const std::string &expression)
 
static std::string trim (const std::string &expression)
 

Detailed Description

This class provides the main interface for parsing expressions.

Member Function Documentation

◆ getFunctionOperation()

Operation * PLMD::Parser::getFunctionOperation ( const std::string &  name,
const std::map< std::string, CustomFunction * > &  customFunctions 
)
staticprivate

◆ getNextToken()

ParseToken PLMD::Parser::getNextToken ( const std::string &  expression,
int  start 
)
staticprivate

◆ getOperatorOperation()

Operation * PLMD::Parser::getOperatorOperation ( const std::string &  name)
staticprivate

◆ parse() [1/2]

ParsedExpression PLMD::Parser::parse ( const std::string &  expression)
static

Parse a mathematical expression and return a representation of it as an abstract syntax tree.

◆ parse() [2/2]

ParsedExpression PLMD::Parser::parse ( const std::string &  expression,
const std::map< std::string, CustomFunction * > &  customFunctions 
)
static

Parse a mathematical expression and return a representation of it as an abstract syntax tree.

Parameters
customFunctionsa map specifying user defined functions that may appear in the expression. The key are function names, and the values are corresponding CustomFunction objects.

◆ parsePrecedence()

ExpressionTreeNode PLMD::Parser::parsePrecedence ( const std::vector< ParseToken > &  tokens,
int &  pos,
const std::map< std::string, CustomFunction * > &  customFunctions,
const std::map< std::string, ExpressionTreeNode > &  subexpressionDefs,
int  precedence 
)
staticprivate

◆ tokenize()

vector< ParseToken > PLMD::Parser::tokenize ( const std::string &  expression)
staticprivate

◆ trim()

string PLMD::Parser::trim ( const std::string &  expression)
staticprivate

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