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