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/identifiers/Module.hpp>
|
29 |
|
|
#include <ast/IAstVisitor.hpp>
|
30 |
|
|
#include <ast/identifiers/IdentifierBlock.hpp>
|
31 |
|
|
|
32 |
|
|
namespace Ast {
|
33 |
|
|
|
34 |
|
|
class MainModule final
|
35 |
|
|
: public Module
|
36 |
|
|
{
|
37 |
|
|
protected:
|
38 |
|
|
IdentifierBlock* m_systemDescription;
|
39 |
|
|
FunctionIdentifier* m_systemMainFunction;
|
40 |
|
|
|
41 |
|
|
MainModule():
|
42 |
|
|
Module(IdentifierKind::MainModule),
|
43 |
|
|
m_systemDescription (nullptr),
|
44 |
|
|
m_systemMainFunction (nullptr)
|
45 |
|
|
{}
|
46 |
|
|
MainModule(const MainModule &toCopy):
|
47 |
|
|
Module(toCopy),
|
48 |
|
|
m_systemDescription (toCopy.m_systemDescription),
|
49 |
|
|
m_systemMainFunction (toCopy.m_systemMainFunction)
|
50 |
|
|
{}
|
51 |
|
|
|
52 |
|
|
static MainModule* create() {return new MainModule();}
|
53 |
|
|
static MainModule* createCopy(const MainModule& toCopy) {return new MainModule(toCopy);}
|
54 |
|
|
public:
|
55 |
|
|
friend class Ast;
|
56 |
|
|
friend class Identifier;
|
57 |
|
|
|
58 |
|
|
void init(int line, int col, const char* text, IScope* scopeRef,
|
59 |
|
|
Type* typeRef, const char* prefix, SymbolTable* symTabRef, IdentifierBlock* list)
|
60 |
|
|
{
|
61 |
|
|
Module::init(line,col,text,scopeRef,typeRef,prefix,symTabRef);
|
62 |
|
|
m_systemDescription = list;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
IdentifierBlock* systemDescription() {return m_systemDescription;};
|
67 |
|
|
void setSystemDescription(IdentifierBlock* aDescr) {m_systemDescription = aDescr;};
|
68 |
|
|
void accept(IAstVisitor& visitor) override {visitor.visit(this);};
|
69 |
|
|
|
70 |
|
|
FunctionIdentifier* getMainFunction() {return m_systemMainFunction;}
|
71 |
|
|
void setMainFunction(FunctionIdentifier* mainFunction) {m_systemMainFunction = mainFunction;}
|
72 |
|
|
static std::string mainFunctionName() {return ".main";}
|
73 |
|
|
};
|
74 |
|
|
} |