4 #include "EXPR_Object.h"
6 #include "EXPR_Tokenizer.h"
7 #include "EXPR_RootNode.h"
8 #include "EXPR_Environment.h"
10 #include "EXPR_OperatorNode.h"
11 #include "EXPR_GroupNode.h"
12 #include "EXPR_ElementaryGeometryNode.h"
13 #include "EXPR_Function.h"
32 CORE_UniquePointer<EXPR_Tokenizer> mTokenizer;
33 CORE_UniquePointer<EXPR_Environment> mEnvironment;
34 CORE_UniquePointer<EXPR_RootNode> mTree;
37 std::vector<CORE_UniquePointer<EXPR_OperatorNode>> mLeftUnaryOperators;
40 std::vector<CORE_UniquePointer<EXPR_OperatorNode>> m1OrderBinaryOperators;
42 std::vector<CORE_UniquePointer<EXPR_OperatorNode>> m2OrderBinaryOperators;
45 std::vector<CORE_UniquePointer<EXPR_ElementaryGeometryNode>> mGeometries;
48 std::vector<CORE_UniquePointer<EXPR_Function>> mFunctions;
51 tString mParseExpression;
69 inline static CORE_UniquePointer<EXPR_Parser>
New() {
86 if (var==
null)
return null;
93 return mEnvironment.get();
99 return mEnvironment.get();
107 tBoolean
parse(
const tString& expr);
113 return parse(mParseExpression);
119 return mParseExpression;
125 std::map<tString,tBoolean> alreadyComputed;
126 mEnvironment->computeBoundingBox(alreadyComputed);
127 mTree->computeBoundingBox(alreadyComputed);
134 std::cout <<
"adimenionsionization failed when L=0. Ignored \n";
137 std::map<tString,tBoolean> alreadyComputed;
138 mEnvironment->adimensionize(L,alreadyComputed);
139 mTree->adimensionize(L,alreadyComputed);
156 CORE_SharedPointer<EXPR_ChildNode> read2OrderBinaryOperator();
160 CORE_SharedPointer<EXPR_ChildNode> read1OrderBinaryOperator();
165 CORE_SharedPointer<EXPR_OperatorNode> readLeftUnaryOperator();
170 CORE_SharedPointer<EXPR_ChildNode> readTerm();
175 CORE_SharedPointer<EXPR_GroupNode> readGroup();
180 CORE_SharedPointer<EXPR_ChildNode> readFunction();
187 CORE_SharedPointer<EXPR_ChildNode> apply(
const tString& name,
188 const std::vector<tString>& args,
194 CORE_SharedPointer<EXPR_ChildNode> readFactor();
200 virtual tString
toString()
const override;
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is the environment with contains all the variable value.
Definition: EXPR_Environment.h:20
This class is the base class of all the parser package.
Definition: EXPR_Object.h:27
This class is a parent node with children.
Definition: EXPR_ParentNode.h:23
This class parse an expression into a tree.
Definition: EXPR_Parser.h:23
void computeBoundingBox()
compute the bounding box of the main expression and its environment
Definition: EXPR_Parser.h:124
const EXPR_RootNode * getTree(const tString &name) const
get the tree with name
Definition: EXPR_Parser.h:84
const tString & getParseExpression() const
return the last parse exopression
Definition: EXPR_Parser.h:118
EXPR_Parser()
create the class
Definition: EXPR_Parser.cpp:15
virtual tString toString() const override
return the string representation of this
Definition: EXPR_Parser.cpp:450
EXPR_Environment * getEnvironment()
get the environment
Definition: EXPR_Parser.h:98
void adimensionize(const tReal &L)
adimensionize the main expression and its environment
Definition: EXPR_Parser.h:132
static CORE_UniquePointer< EXPR_Parser > New()
create a test class
Definition: EXPR_Parser.h:69
virtual ~EXPR_Parser()
delete the class
Definition: EXPR_Parser.cpp:40
const EXPR_RootNode * getTree() const
get the tree
Definition: EXPR_Parser.h:77
tBoolean parse()
parse the expression
Definition: EXPR_Parser.h:112
const EXPR_Environment * getEnvironment() const
get the environment
Definition: EXPR_Parser.h:92
This class describes the root of the tree.
Definition: EXPR_RootNode.h:16
This class describes a variable node with contains:
Definition: EXPR_VariableNode.h:17
const EXPR_RootNode * getExpression() const
get the expression of the variable
Definition: EXPR_VariableNode.h:95