ParseExp.cpp File Reference

functions to parse expressions from strings More...

#include "ParseExp.h"
#include <exception>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <cstdlib>

Include dependency graph for ParseExp.cpp:

Go to the source code of this file.

Namespaces

namespace  Parser
namespace  Parser::RPNTokens
namespace  Parser::Operators

Classes

class  Parser::ParseException
 internal exception class for all errors More...
class  Parser::RPNTokens::TokenBase
 abstract base class More...
class  Parser::RPNTokens::NumericToken
 single numeric token on rpn queue More...
class  Parser::RPNTokens::FunctionToken
 unary operator or function on rpn queue More...
class  Parser::RPNTokens::BinaryToken
 binary operator on rpn stack More...
class  Parser::RPNTokens::IfToken
 if operator on rpn stack More...
class  Parser::Operators::OperatorBase
 base class for operator on shunting yards operator stack More...
class  Parser::Operators::FunctionOperator
 function or unary operator on shunting yards operator stack More...
class  Parser::Operators::BinaryOperator
 binary operator on stack on shunting yards operator stack More...
class  Parser::Operators::IfOperator
 if operator on operator stack, used only for ':' token More...

Defines

#define _USE_MATH_DEFINES

Functions

void Parser::ClearQueue (std::queue< RPNTokens::TokenBase * > &input)
 clear the queue
std::string Parser::RemoveWhiteSpaces (const std::string &text)
 remove all whitespaces and convert to lowercase
void Parser::InitParser ()
 initialize some internal variables
void Parser::CleanUpParser ()
 clean up some internal static variables
std::string Parser::FindOperator (const std::string &searchString)
 compare the first characters in string with supportedBinaryOperations, return longest match
bool Parser::ConvertToRPN (const std::string &expression, const ConstantMap &constants, std::queue< RPNTokens::TokenBase * > &rpn)
 convert expression to RPN *
bool Parser::EvaluateRPN (std::queue< RPNTokens::TokenBase * > &input, double &result)
 evaluate RPN in input
bool Parser::ParseExpression (const std::string &expression, double &result, const ConstantMap &constants)
 parse complete expression in 2 steps

Variables

static std::map< std::string,
Operators::OperatorBase * > 
Parser::supportedBinaryOperations
static Operators::OperatorBase * Parser::parenthesesOperator = nullptr
static Operators::OperatorBase * Parser::ifOperator = nullptr
static Operators::OperatorBase * Parser::ifOperatorClose = nullptr
static std::map< std::string,
Operators::FunctionOperator * > 
Parser::supportedFunctions


Detailed Description

functions to parse expressions from strings

Author:
T. Modes

Definition in file ParseExp.cpp.


Define Documentation

#define _USE_MATH_DEFINES

Definition at line 35 of file ParseExp.cpp.


Generated on 28 Jul 2016 for Hugintrunk by  doxygen 1.4.7