Parser::ShuntingYard Namespace Reference


Classes

class  ParseException
 internal exception class for all errors More...

Namespaces

namespace  Operators
 classes for operators on shunting yards operator stack
namespace  RPNTokens
 classes for parsed tokens in rpn queue

Functions

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

Variables

static std::map< std::string,
Operators::OperatorBase * > 
supportedBinaryOperations
static Operators::OperatorBaseparenthesesOperator = nullptr
static Operators::OperatorBaseifOperator = nullptr
static Operators::OperatorBaseifOperatorClose = nullptr
static std::map< std::string,
Operators::FunctionOperator * > 
supportedFunctions


Function Documentation

void Parser::ShuntingYard::ClearQueue ( std::queue< RPNTokens::TokenBase * > &  input  ) 

clear the queue

Definition at line 217 of file ParseExp.cpp.

Referenced by EvaluateRPN(), and Parser::ParseExpression().

std::string Parser::ShuntingYard::RemoveWhiteSpaces ( const std::string text  ) 

remove all whitespaces and convert to lowercase

Definition at line 227 of file ParseExp.cpp.

References hugin_utils::tolower().

Referenced by Parser::ParseExpression().

void Parser::ShuntingYard::InitParser (  ) 

initialize some internal variables

Definition at line 248 of file ParseExp.cpp.

References ifOperator, ifOperatorClose, vigra_ext::log(), M_PI, parenthesesOperator, vigra_ext::pow(), supportedBinaryOperations, and supportedFunctions.

Referenced by ConvertToRPN().

void Parser::ShuntingYard::CleanUpParser (  ) 

clean up some internal static variables

Definition at line 300 of file ParseExp.cpp.

References ifOperator, ifOperatorClose, parenthesesOperator, supportedBinaryOperations, and supportedFunctions.

std::string Parser::ShuntingYard::FindOperator ( const std::string searchString  ) 

compare the first characters in string with supportedBinaryOperations, return longest match

Definition at line 330 of file ParseExp.cpp.

References supportedBinaryOperations.

Referenced by ConvertToRPN().

bool Parser::ShuntingYard::ConvertToRPN ( const std::string expression,
const ConstantMap constants,
std::queue< RPNTokens::TokenBase * > &  rpn 
)

convert expression to RPN *

Returns:
true, if expression could be converted to Reverse Polish notation (RPN), otherwise false

Definition at line 349 of file ParseExp.cpp.

References Parser::ShuntingYard::Operators::OperatorBase::ComparePrecedence(), FindOperator(), ifOperator, ifOperatorClose, InitParser(), parenthesesOperator, supportedBinaryOperations, and supportedFunctions.

Referenced by Parser::ParseExpression().

bool Parser::ShuntingYard::EvaluateRPN ( std::queue< RPNTokens::TokenBase * > &  input,
double &  result 
)

evaluate RPN in input

Returns:
true, if input could be evaluated, result has the final value; otherwise false and result is unmodified

Definition at line 551 of file ParseExp.cpp.

References ClearQueue().

Referenced by Parser::ParseExpression().


Variable Documentation

std::map<std::string, Operators::OperatorBase*> Parser::ShuntingYard::supportedBinaryOperations [static]

Definition at line 239 of file ParseExp.cpp.

Referenced by CleanUpParser(), ConvertToRPN(), FindOperator(), and InitParser().

Operators::OperatorBase* Parser::ShuntingYard::parenthesesOperator = nullptr [static]

Definition at line 242 of file ParseExp.cpp.

Referenced by CleanUpParser(), ConvertToRPN(), and InitParser().

Operators::OperatorBase* Parser::ShuntingYard::ifOperator = nullptr [static]

Definition at line 243 of file ParseExp.cpp.

Referenced by CleanUpParser(), ConvertToRPN(), and InitParser().

Operators::OperatorBase* Parser::ShuntingYard::ifOperatorClose = nullptr [static]

Definition at line 244 of file ParseExp.cpp.

Referenced by CleanUpParser(), ConvertToRPN(), and InitParser().

std::map<std::string, Operators::FunctionOperator*> Parser::ShuntingYard::supportedFunctions [static]

Definition at line 245 of file ParseExp.cpp.

Referenced by CleanUpParser(), ConvertToRPN(), and InitParser().


Generated on 23 Jan 2018 for Hugintrunk by  doxygen 1.4.7