|
/**
|
|
*
|
|
* OOAS Compiler - C++ AST
|
|
*
|
|
* Copyright 2015, AIT Austrian Institute of Technology.
|
|
* All rights reserved.
|
|
*
|
|
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
|
*
|
|
* If you modify the file please update the list of contributors below to in-
|
|
* clude your name. Please also stick to the coding convention of using TABs
|
|
* to do the basic (block-level) indentation and spaces for anything after
|
|
* that. (Enable the display of special chars and it should be pretty obvious
|
|
* what this means.) Also, remove all trailing whitespace.
|
|
*
|
|
* Contributors:
|
|
* Willibald Krenn (AIT)
|
|
* Stephan Zimmerer (AIT)
|
|
* Christoph Czurda (AIT)
|
|
*
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <ast/expressions/UnaryOperator.hpp>
|
|
#include <ast/IScope.hpp>
|
|
#include <ast/SymbolTable.hpp>
|
|
#include <base/Exceptions.hpp>
|
|
#include <string>
|
|
#include <ast/identifiers/Identifier.hpp>
|
|
|
|
namespace Ast {
|
|
|
|
class Quantifier
|
|
: public UnaryOperator
|
|
, public IScope
|
|
{
|
|
protected:
|
|
SymbolTable* m_symbols;
|
|
IScope* m_parentScope;
|
|
|
|
Quantifier(ExpressionKind kind):
|
|
UnaryOperator(kind),
|
|
m_symbols (nullptr),
|
|
m_parentScope (nullptr)
|
|
{}
|
|
Quantifier(const Quantifier &toCopy):
|
|
UnaryOperator(toCopy),
|
|
m_symbols (toCopy.m_symbols),
|
|
m_parentScope (toCopy.m_parentScope)
|
|
{}
|
|
public:
|
|
~Quantifier() override {}
|
|
|
|
void init(std::int32_t line, std::int32_t pos,
|
|
Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef,
|
|
Expression* child, SymbolTable* symTabRef, IScope* scopeRef)
|
|
{
|
|
UnaryOperator::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef,child);
|
|
m_symbols = symTabRef;
|
|
m_parentScope = scopeRef;
|
|
}
|
|
|
|
SymbolTable* symbols() {return m_symbols;};
|
|
Identifier* resolveIdentifier(const std::string& aName) const override { return m_symbols->get(aName); };
|
|
IScope* getParentScope() const override {return m_parentScope;};
|
|
std::string getScopeName() const override {return "";}
|
|
void setParentScope(IScope* parentScope) override {m_parentScope = parentScope;};
|
|
void addIdentifier(Identifier* anIdentifier, void* ) override {m_symbols->addIdentifier(anIdentifier);};
|
|
};
|
|
}
|