GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ExpressionParser2NodeWorker.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-present Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #ifndef GDCORE_EXPRESSIONPARSER2NODEWORKER_H
7 #define GDCORE_EXPRESSIONPARSER2NODEWORKER_H
8 
9 namespace gd {
10 struct ExpressionNode;
11 struct SubExpressionNode;
12 struct OperatorNode;
13 struct UnaryOperatorNode;
14 struct NumberNode;
15 struct TextNode;
16 struct VariableNode;
17 struct VariableAccessorNode;
18 struct VariableBracketAccessorNode;
19 struct IdentifierOrFunctionCallOrObjectFunctionNameOrEmptyNode;
20 struct IdentifierNode;
21 struct FunctionCallOrObjectFunctionNameOrEmptyNode;
22 struct ObjectFunctionNameNode;
23 struct FunctionCallNode;
24 struct EmptyNode;
25 } // namespace gd
26 
27 namespace gd {
28 
36 class GD_CORE_API ExpressionParser2NodeWorker {
37  friend struct ExpressionNode;
38  friend struct SubExpressionNode;
39  friend struct OperatorNode;
40  friend struct UnaryOperatorNode;
41  friend struct NumberNode;
42  friend struct TextNode;
43  friend struct VariableNode;
44  friend struct VariableAccessorNode;
45  friend struct VariableBracketAccessorNode;
47  friend struct IdentifierNode;
49  friend struct ObjectFunctionNameNode;
50  friend struct FunctionCallNode;
51  friend struct EmptyNode;
52 
53  public:
54  virtual ~ExpressionParser2NodeWorker();
55 
56  protected:
57  virtual void OnVisitSubExpressionNode(SubExpressionNode& node) = 0;
58  virtual void OnVisitOperatorNode(OperatorNode& node) = 0;
59  virtual void OnVisitUnaryOperatorNode(UnaryOperatorNode& node) = 0;
60  virtual void OnVisitNumberNode(NumberNode& node) = 0;
61  virtual void OnVisitTextNode(TextNode& node) = 0;
62  virtual void OnVisitVariableNode(VariableNode& node) = 0;
63  virtual void OnVisitVariableAccessorNode(VariableAccessorNode& node) = 0;
64  virtual void OnVisitVariableBracketAccessorNode(
65  VariableBracketAccessorNode& node) = 0;
66  virtual void OnVisitIdentifierNode(IdentifierNode& node) = 0;
67  virtual void OnVisitObjectFunctionNameNode(ObjectFunctionNameNode& node) = 0;
68  virtual void OnVisitFunctionCallNode(FunctionCallNode& node) = 0;
69  virtual void OnVisitEmptyNode(EmptyNode& node) = 0;
70 };
71 
72 } // namespace gd
73 
74 #endif
The interface for any worker class ("visitor" pattern) that want to interact with the nodes of a pars...
Definition: ExpressionParser2NodeWorker.h:36
Definition: CommonTools.h:24
An empty node, used when parsing failed/a syntax error was encountered and any other node could not m...
Definition: ExpressionParser2Node.h:416
The base node, from which all nodes in the tree of an expression inherits from.
Definition: ExpressionParser2Node.h:93
A function call node (either free function, object function or object behavior function)....
Definition: ExpressionParser2Node.h:364
Definition: ExpressionParser2Node.h:228
An identifier node, usually representing an object or a variable with an optional function name or ch...
Definition: ExpressionParser2Node.h:197
A number node. For example: "123". Its type is always "number".
Definition: ExpressionParser2Node.h:154
The name of a function to call on an object or the behavior For example: "MyObject....
Definition: ExpressionParser2Node.h:314
An operator node. For example: "lhs + rhs".
Definition: ExpressionParser2Node.h:122
Definition: ExpressionParser2Node.h:108
A text node. For example: "Hello World". Its type is always "string".
Definition: ExpressionParser2Node.h:170
A unary operator node. For example: "-2".
Definition: ExpressionParser2Node.h:138
A direct accessor to a child variable. Example: MyChild in MyVariable.MyChild.
Definition: ExpressionParser2Node.h:275
A bracket accessor to a child variable. Example: ["MyChild"] (in MyVariable["MyChild"]).
Definition: ExpressionParser2Node.h:293
A variable, or object variable, with bracket accessor or at least 2 "dot" accessors.
Definition: ExpressionParser2Node.h:254