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 <ast/expressions/UnaryOperator.hpp>
|
29 |
|
|
#include <ast/IScope.hpp>
|
30 |
|
|
#include <ast/SymbolTable.hpp>
|
31 |
|
|
#include <base/Exceptions.hpp>
|
32 |
|
|
#include <string>
|
33 |
|
|
#include <ast/identifiers/Identifier.hpp>
|
34 |
|
|
|
35 |
|
|
namespace Ast {
|
36 |
|
|
|
37 |
|
|
class Quantifier
|
38 |
|
|
: public UnaryOperator
|
39 |
|
|
, public IScope
|
40 |
|
|
{
|
41 |
|
|
protected:
|
42 |
|
|
SymbolTable* m_symbols;
|
43 |
|
|
IScope* m_parentScope;
|
44 |
|
|
|
45 |
|
|
Quantifier(ExpressionKind kind):
|
46 |
|
|
UnaryOperator(kind),
|
47 |
|
|
m_symbols (nullptr),
|
48 |
|
|
m_parentScope (nullptr)
|
49 |
|
|
{}
|
50 |
|
|
Quantifier(const Quantifier &toCopy):
|
51 |
|
|
UnaryOperator(toCopy),
|
52 |
|
|
m_symbols (toCopy.m_symbols),
|
53 |
|
|
m_parentScope (toCopy.m_parentScope)
|
54 |
|
|
{}
|
55 |
|
|
public:
|
56 |
|
|
~Quantifier() override {}
|
57 |
|
|
|
58 |
|
|
void init(std::int32_t line, std::int32_t pos,
|
59 |
|
|
Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef,
|
60 |
|
|
Expression* child, SymbolTable* symTabRef, IScope* scopeRef)
|
61 |
|
|
{
|
62 |
|
|
UnaryOperator::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef,child);
|
63 |
|
|
m_symbols = symTabRef;
|
64 |
|
|
m_parentScope = scopeRef;
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
SymbolTable* symbols() {return m_symbols;};
|
68 |
|
|
Identifier* resolveIdentifier(const std::string& aName) const override { return m_symbols->get(aName); };
|
69 |
|
|
IScope* getParentScope() const override {return m_parentScope;};
|
70 |
|
|
std::string getScopeName() const override {return "";}
|
71 |
|
|
void setParentScope(IScope* parentScope) override {m_parentScope = parentScope;};
|
72 |
|
|
void addIdentifier(Identifier* anIdentifier, void* ) override {m_symbols->addIdentifier(anIdentifier);};
|
73 |
|
|
};
|
74 |
|
|
} |