53 lines
1018 B
C++
53 lines
1018 B
C++
#ifndef ACPA_ELEMENT_H
|
|
#define ACPA_ELEMENT_H
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using std::map;
|
|
using std::shared_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
using std::weak_ptr;
|
|
|
|
struct Struct;
|
|
struct ValType;
|
|
struct TemplateType;
|
|
struct StructType;
|
|
struct FunctionType;
|
|
|
|
struct Struct {
|
|
weak_ptr<Struct> fa;
|
|
vector<shared_ptr<TemplateType>> c1;
|
|
vector<shared_ptr<ValType>> c2;
|
|
map<string, shared_ptr<ValType>> vars;
|
|
map<string, shared_ptr<Struct>> structs;
|
|
};
|
|
|
|
struct ValType {
|
|
virtual int type() const = 0;
|
|
virtual ~ValType() = default;
|
|
};
|
|
|
|
struct TemplateType : ValType {
|
|
int type() const override;
|
|
};
|
|
|
|
struct StructType : ValType {
|
|
int type() const override;
|
|
shared_ptr<Struct> str;
|
|
map<shared_ptr<TemplateType>, shared_ptr<ValType>> mp;
|
|
};
|
|
|
|
struct FunctionType : ValType {
|
|
int type() const override;
|
|
vector<shared_ptr<TemplateType>> c1;
|
|
vector<shared_ptr<ValType>> c2;
|
|
shared_ptr<ValType> c3;
|
|
};
|
|
|
|
bool sameType(shared_ptr<ValType>, shared_ptr<ValType>);
|
|
|
|
#endif |