#include <EquationParser.h>
Parses a given string representation of an equation generates an AST using EquationParser::createAST
◆ EquationParser()
EquationParser::EquationParser |
( |
std::string |
in | ) |
|
|
inlineexplicit |
◆ buildSymbolSuperSet()
static std::vector< std::shared_ptr< Symbolic > > EquationParser::buildSymbolSuperSet |
( |
const std::vector< std::shared_ptr< Symbolic > > & |
a, |
|
|
const std::vector< std::shared_ptr< Symbolic > > & |
b |
|
) |
| |
|
inlinestatic |
helper method to generate superset of given vectors
- Parameters
-
a | set of symbols |
b | other set of symbols |
- Returns
- merged unique set of symbols
◆ createAST()
std::shared_ptr< MathNode > EquationParser::createAST |
( |
| ) |
|
◆ extractObjects()
std::vector< std::string > EquationParser::extractObjects |
( |
std::string & |
eq, |
|
|
const std::vector< std::string > & |
container |
|
) |
| |
|
private |
extracts given objects from given equation string
- Parameters
-
eq | equation string |
container | container containing objects to search for |
- Returns
- extracted objects
◆ GetFunction()
static std::shared_ptr< Function > EquationParser::GetFunction |
( |
const std::string & |
valString | ) |
|
|
inlinestaticprivate |
Lexer function to detect a Function node.
- Parameters
-
valString | element of DefaultFunctions vector |
- Returns
◆ GetOperator()
static std::shared_ptr< Operator > EquationParser::GetOperator |
( |
const std::string & |
valString | ) |
|
|
inlinestatic |
Lexer function to determine first connecting operator
- Parameters
-
- Returns
◆ isAny()
static bool EquationParser::isAny |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
test if value is anything processable
- Parameters
-
- Returns
◆ isNumber()
static bool EquationParser::isNumber |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
tests if value is number
- Parameters
-
- Returns
◆ isOperator()
static bool EquationParser::isOperator |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
test if value is operator
- Parameters
-
- Returns
◆ isParenthesesClose()
static bool EquationParser::isParenthesesClose |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
test if value is parentheses close
- Parameters
-
- Returns
◆ isParenthesesOpen()
static bool EquationParser::isParenthesesOpen |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
test if value is parentheses open
- Parameters
-
- Returns
◆ isSymbol()
static bool EquationParser::isSymbol |
( |
const std::string & |
in | ) |
|
|
inlinestaticprivate |
tests if value is symbol
- Parameters
-
- Returns
◆ parseSequence()
bool EquationParser::parseSequence |
( |
const std::string & |
c | ) |
|
|
inlineprivate |
◆ processCurrentOP()
static void EquationParser::processCurrentOP |
( |
const std::shared_ptr< Operator > & |
currentOp, |
|
|
std::vector< std::string > & |
operatorStack, |
|
|
std::vector< std::shared_ptr< MathNode > > & |
operandStack |
|
) |
| |
|
staticprivate |
process current operator until end of equation, next operator with higher priority or closing parentheses
- Parameters
-
operatorStack | current operator stack object |
operandStack | current operand stack |
currentOp | the operator to process |
◆ rearrangeStack()
static void EquationParser::rearrangeStack |
( |
std::vector< std::string > & |
operatorStack, |
|
|
std::vector< std::shared_ptr< MathNode > > & |
operandStack |
|
) |
| |
|
staticprivate |
rearranges stack until end of equation of opening parentheses
- Parameters
-
operatorStack | operator stack object |
operandStack | operand stack object |
◆ splitEquation()
std::vector< std::string > EquationParser::splitEquation |
( |
const std::string & |
eqString | ) |
|
|
private |
Splits an equation string into a vector of strings
- Parameters
-
eqString | equation string to split |
- Returns
- vector with equation elements
◆ splitFunctionsOrElementwise()
std::vector< std::string > EquationParser::splitFunctionsOrElementwise |
( |
const std::string & |
in | ) |
|
|
inlineprivate |
Recursively split of input string into function/symbol/operator/numerical substrings.
- Parameters
-
- Returns
◆ nextIsNegative
bool EquationParser::nextIsNegative = false |
|
private |
flag for parsing process to detect whether a node is negated
◆ operandStack
std::vector<std::shared_ptr<MathNode> > EquationParser::operandStack |
|
private |
operand stack object, used during parsing
◆ operatorStack
std::vector<std::string> EquationParser::operatorStack |
|
private |
operator stack object, used during parsing
◆ prevWasOperator
bool EquationParser::prevWasOperator = true |
|
private |
◆ processString
std::string EquationParser::processString |
|
private |
◆ symbols
std::vector<std::shared_ptr<Symbolic> > EquationParser::symbols |
The documentation for this class was generated from the following file: