-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISyntaxTreeVisitor.hpp
181 lines (157 loc) · 6.04 KB
/
ISyntaxTreeVisitor.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#pragma once
#include "SyntaxNode.hpp"
class IdentifierNode;
class LiteralNode;
class ParamFunctionNode;
class ParamStructNode;
class LetNode;
class FunctionNode;
class StructNode;
class ConstantItemNode;
class ParenthesizedTypeNode;
class TupleTypeNode;
class ReferenceTypeNode;
class ArrayTypeNode;
class IdentifierTypeNode;
class TupleIndexFieldNode;
class IdentifierFieldNode;
class RefMutIdentifierFieldNode;
class LiteralPatternNode;
class IdentifierPatternNode;
class WildcardPatternNode;
class RestPatternNode;
class ReferencePatternNode;
class StructPatternNode;
class TupleStructPatternNode;
class TuplePatternNode;
class GroupedPatternNode;
class IdentifierExpressionNode;
class LiteralExpressionNode;
class BinaryOperationNode;
class PrefixUnaryOperationNode;
class InfiniteLoopNode;
class PredicateLoopNode;
class IteratorLoopNode;
class IfNode;
class BlockNode;
class BreakNode;
class ContinueNode;
class ReturnNode;
class CallOrInitTupleNode;
class IndexNode;
class MemberAccessNode;
class ArrayExpressionNode;
class InitStructExpressionNode;
class ShorthandFieldInitStructExpressionNode;
class TupleIndexFieldInitStructExpressionNode;
class IdentifierFieldInitStructExpressionNode;
class TupleExpressionNode;
class SyntaxTree;
class AssignmentNode;
class ISyntaxTreeVisitor {
friend class IdentifierNode;
friend class LiteralNode;
friend class ParamFunctionNode;
friend class ParamStructNode;
friend class LetNode;
friend class FunctionNode;
friend class StructNode;
friend class ConstantItemNode;
friend class ParenthesizedTypeNode;
friend class TupleTypeNode;
friend class ReferenceTypeNode;
friend class ArrayTypeNode;
friend class IdentifierTypeNode;
friend class TupleIndexFieldNode;
friend class IdentifierFieldNode;
friend class RefMutIdentifierFieldNode;
friend class LiteralPatternNode;
friend class IdentifierPatternNode;
friend class WildcardPatternNode;
friend class RestPatternNode;
friend class ReferencePatternNode;
friend class StructPatternNode;
friend class TupleStructPatternNode;
friend class TuplePatternNode;
friend class GroupedPatternNode;
friend class IdentifierExpressionNode;
friend class LiteralExpressionNode;
friend class BinaryOperationNode;
friend class PrefixUnaryOperationNode;
friend class InfiniteLoopNode;
friend class PredicateLoopNode;
friend class IteratorLoopNode;
friend class IfNode;
friend class BlockNode;
friend class BreakNode;
friend class ContinueNode;
friend class ReturnNode;
friend class CallOrInitTupleNode;
friend class IndexNode;
friend class MemberAccessNode;
friend class ArrayExpressionNode;
friend class InitStructExpressionNode;
friend class FieldInitStructExpressionNode;
friend class ShorthandFieldInitStructExpressionNode;
friend class TupleIndexFieldInitStructExpressionNode;
friend class IdentifierFieldInitStructExpressionNode;
friend class TupleExpressionNode;
friend class SyntaxTree;
friend class AssignmentNode;
public:
virtual ~ISyntaxTreeVisitor() = default;
virtual void Visit(const SyntaxNode *syntaxNode) {
if (syntaxNode != nullptr) {
syntaxNode->Visit(this);
}
}
protected:
virtual void PostVisit(const IdentifierNode *) = 0;
virtual void PostVisit(const LiteralNode *) = 0;
virtual void PostVisit(const ParamFunctionNode *) = 0;
virtual void PostVisit(const ParamStructNode *) = 0;
virtual void PostVisit(const LetNode *) = 0;
virtual void PostVisit(const FunctionNode *) = 0;
virtual void PostVisit(const StructNode *) = 0;
virtual void PostVisit(const ConstantItemNode *) = 0;
virtual void PostVisit(const ParenthesizedTypeNode *) = 0;
virtual void PostVisit(const TupleTypeNode *) = 0;
virtual void PostVisit(const ReferenceTypeNode *) = 0;
virtual void PostVisit(const ArrayTypeNode *) = 0;
virtual void PostVisit(const IdentifierTypeNode *) = 0;
virtual void PostVisit(const TupleIndexFieldNode *) = 0;
virtual void PostVisit(const IdentifierFieldNode *) = 0;
virtual void PostVisit(const RefMutIdentifierFieldNode *) = 0;
virtual void PostVisit(const LiteralPatternNode *) = 0;
virtual void PostVisit(const IdentifierPatternNode *) = 0;
virtual void PostVisit(const WildcardPatternNode *) = 0;
virtual void PostVisit(const RestPatternNode *) = 0;
virtual void PostVisit(const ReferencePatternNode *) = 0;
virtual void PostVisit(const StructPatternNode *) = 0;
virtual void PostVisit(const TupleStructPatternNode *) = 0;
virtual void PostVisit(const TuplePatternNode *) = 0;
virtual void PostVisit(const GroupedPatternNode *) = 0;
virtual void PostVisit(const IdentifierExpressionNode *) = 0;
virtual void PostVisit(const LiteralExpressionNode *) = 0;
virtual void PostVisit(const BinaryOperationNode *) = 0;
virtual void PostVisit(const PrefixUnaryOperationNode *) = 0;
virtual void PostVisit(const InfiniteLoopNode *) = 0;
virtual void PostVisit(const PredicateLoopNode *) = 0;
virtual void PostVisit(const IteratorLoopNode *) = 0;
virtual void PostVisit(const IfNode *) = 0;
virtual void PostVisit(const BlockNode *) = 0;
virtual void PostVisit(const BreakNode *) = 0;
virtual void PostVisit(const ContinueNode *) = 0;
virtual void PostVisit(const ReturnNode *) = 0;
virtual void PostVisit(const CallOrInitTupleNode *) = 0;
virtual void PostVisit(const IndexNode *) = 0;
virtual void PostVisit(const MemberAccessNode *) = 0;
virtual void PostVisit(const ArrayExpressionNode *) = 0;
virtual void PostVisit(const InitStructExpressionNode *) = 0;
virtual void PostVisit(const ShorthandFieldInitStructExpressionNode *) = 0;
virtual void PostVisit(const TupleIndexFieldInitStructExpressionNode *) = 0;
virtual void PostVisit(const IdentifierFieldInitStructExpressionNode *) = 0;
virtual void PostVisit(const TupleExpressionNode *) = 0;
virtual void PostVisit(const SyntaxTree *) = 0;
virtual void PostVisit(const AssignmentNode *) = 0;
};