/** * * 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 #include #include #include namespace Ast { enum class IdentifierBlockKind { normal = 0, nondeterministic = 1, seqential = 2, prioritized = 3 }; class IdentifierBlock : public Identifier { protected: IdentifierList m_list; IdentifierBlock(IdentifierKind kind): Identifier(kind), m_list() {} public: IdentifierBlock(const IdentifierBlock &toCopy): Identifier(toCopy), m_list(toCopy.m_list) {} IdentifierList& identifiers() {return m_list;}; void addElement(Identifier* toAdd) {m_list.push_back(toAdd);}; }; class UnspecIdentifierBlock final : public IdentifierBlock { UnspecIdentifierBlock(): IdentifierBlock(IdentifierKind::List_Normal) {} UnspecIdentifierBlock(const UnspecIdentifierBlock &toCopy): IdentifierBlock(toCopy) {} static UnspecIdentifierBlock* create() {return new UnspecIdentifierBlock();} static UnspecIdentifierBlock* createCopy(const UnspecIdentifierBlock& toCopy) {return new UnspecIdentifierBlock(toCopy);} public: friend class Ast; friend class Identifier; void accept(IAstVisitor& visitor) override {visitor.visit(this);}; }; class SeqIdentifierBlock final : public IdentifierBlock { protected: SeqIdentifierBlock(): IdentifierBlock(IdentifierKind::List_Seqential) {} SeqIdentifierBlock(const SeqIdentifierBlock &toCopy): IdentifierBlock(toCopy) {} static SeqIdentifierBlock* create() {return new SeqIdentifierBlock();} static SeqIdentifierBlock* createCopy(const SeqIdentifierBlock& toCopy) {return new SeqIdentifierBlock(toCopy);} public: friend class Ast; friend class Identifier; void accept(IAstVisitor& visitor) override {visitor.visit(this);}; }; class NondetIdentifierBlock final : public IdentifierBlock { protected: NondetIdentifierBlock(): IdentifierBlock(IdentifierKind::List_Nondeterministic) {} NondetIdentifierBlock(const NondetIdentifierBlock &toCopy): IdentifierBlock(toCopy) {} static NondetIdentifierBlock* create() {return new NondetIdentifierBlock();} static NondetIdentifierBlock* createCopy(const NondetIdentifierBlock& toCopy) {return new NondetIdentifierBlock(toCopy);} public: friend class Ast; friend class Identifier; void accept(IAstVisitor& visitor) override {visitor.visit(this);}; }; class PrioIdentifierBlock final : public IdentifierBlock { PrioIdentifierBlock(): IdentifierBlock(IdentifierKind::List_Prioritized) {} PrioIdentifierBlock(const PrioIdentifierBlock &toCopy): IdentifierBlock(toCopy) {} static PrioIdentifierBlock* create() {return new PrioIdentifierBlock();} static PrioIdentifierBlock* createCopy(const PrioIdentifierBlock& toCopy) {return new PrioIdentifierBlock(toCopy);} public: friend class Ast; friend class Identifier; void accept(IAstVisitor& visitor) override {visitor.visit(this);}; }; }