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
|
#pragma once
|
27
|
|
28
|
#include <CallContext.hpp>
|
29
|
#include <ast/IAstVisitor.hpp>
|
30
|
#include <base/TiresiasObject.hpp>
|
31
|
#include <ast/types/Type.hpp>
|
32
|
#include <ast/identifiers/Identifier.hpp>
|
33
|
#include <ast/expressions/Expression.hpp>
|
34
|
#include <ast/statements/Statement.hpp>
|
35
|
#include <unordered_map>
|
36
|
|
37
|
namespace Ast {
|
38
|
|
39
|
|
40
|
|
41
|
|
42
|
class ExpressionVisitor:
|
43
|
public Base::TiresiasObject,
|
44
|
public IAstVisitor {
|
45
|
protected:
|
46
|
CallContext* m_context;
|
47
|
|
48
|
void visitSub(AstElement* subElement, AstElement* parent);
|
49
|
void visitAstElement(AstElement* element, AstElement* parent);
|
50
|
void error();
|
51
|
public:
|
52
|
ExpressionVisitor(CallContext* context);
|
53
|
~ExpressionVisitor() override;
|
54
|
|
55
|
void visit(TypeIdentifier* typeIdentifier) override;
|
56
|
void visit(EnumIdentifier* enumIdentifier) override;
|
57
|
|
58
|
void visit(AttributeIdentifier* attributeIdentifier) override;
|
59
|
void visit(LocalVariableIdentifier* localVariableIdentifier) override;
|
60
|
void visit(ParameterIdentifier* parameterIdentifier) override;
|
61
|
void visit(ExpressionVariableIdentifier* expressionVariableIdentifier) override;
|
62
|
void visit(MethodIdentifier* methodIdentifier) override;
|
63
|
void visit(NamedActionIdentifier* namedActionIdentifier) override;
|
64
|
void visit(Module* module) override;
|
65
|
void visit(ConstantIdentifier* constantIdentifier) override;
|
66
|
void visit(UnspecIdentifierBlock* unspecIdentifierList) override;
|
67
|
void visit(SeqIdentifierBlock* seqIdentifierList) override;
|
68
|
void visit(NondetIdentifierBlock* nondetIdentifierList) override;
|
69
|
void visit(PrioIdentifierBlock* prioIdentifierList) override;
|
70
|
void visit(MainModule* mainModule) override;
|
71
|
|
72
|
void visit(IntType* intType) override;
|
73
|
void visit(BoolType* boolType) override;
|
74
|
void visit(EnumType* enumType) override;
|
75
|
void visit(ListType* listType) override;
|
76
|
void visit(TupleType* tupleType) override;
|
77
|
void visit(NullType* nullType) override;
|
78
|
void visit(FunctionType* functionType) override;
|
79
|
void visit(ActionSystemType* actionSystemType) override;
|
80
|
|
81
|
void visit(GuardedCommand* guardedCommand) override;
|
82
|
void visit(Call* call) override;
|
83
|
void visit(Assignment* assignment) override;
|
84
|
void visit(SeqBlock* seqBlock) override;
|
85
|
void visit(NondetBlock* nondetBlock) override;
|
86
|
void visit(PrioBlock* prioBlock) override;
|
87
|
void visit(Skip* skipStatement) override;
|
88
|
void visit(Break* skipStatement) override;
|
89
|
void visit(Abort* abortStatement) override;
|
90
|
|
91
|
void visit(TernaryOperator* ternaryOperator) override;
|
92
|
void visit(BinaryOperator* binaryOperator) override;
|
93
|
void visit(UnaryOperator* unaryOperator) override;
|
94
|
void visit(ExistsQuantifier* quantifier) override;
|
95
|
void visit(ForallQuantifier* quantifier) override;
|
96
|
void visit(ListConstructor* listConstructor) override;
|
97
|
void visit(SetConstructor* setConstructor) override;
|
98
|
void visit(TupleConstructor* tupleConstructor) override;
|
99
|
void visit(ObjectConstructor* objectConstructor) override;
|
100
|
void visit(BoolValueExpression* identifierExpression) override;
|
101
|
void visit(IntValueExpression* identifierExpression) override;
|
102
|
void visit(RefValueExpression* identifierExpression) override;
|
103
|
void visit(IdentifierExpression* identifierExpression) override;
|
104
|
void visit(TypeExpression* typeExpression) override;
|
105
|
void visit(TupleMapAccessExpression* tupleMapAccessExpression) override;
|
106
|
void visit(CallExpression* callExpression) override;
|
107
|
void visit(AccessExpression* accessExpression) override;
|
108
|
void visit(PointerType* pt) override;
|
109
|
};
|
110
|
|
111
|
}
|