changes for new grammar, fixes

This commit is contained in:
ProgramSnail 2023-06-03 19:01:03 +03:00
parent 91f9affadc
commit 3106a64949
35 changed files with 605 additions and 550 deletions

View file

@ -212,13 +212,14 @@ struct FunctionType;
struct TupleType;
struct VariantType;
struct TypeExpression;
struct TypeExpression;
using WrappedTypeExpression = TypeExpression;
using Constructor = std::string;
// // ScopedAnyType <-> AnyType
using AnyType = std::variant<
std::unique_ptr<TypeExpression>,
std::unique_ptr<WrappedTypeExpression>,
std::unique_ptr<TupleType>,
std::unique_ptr<VariantType>,
std::unique_ptr<FunctionType>>;
@ -272,6 +273,8 @@ struct Namespace {
TypeIdentifier type;
NamespaceSources scope;
bool is_type_namespace = false; // TODO: use
std::optional<utils::IdType> link_type_id_;
std::optional<utils::IdType> link_typeclass_id_;
};
@ -292,7 +295,7 @@ struct AliasDefinitionStatement {
utils::AliasModifier modifier;
TypeIdentifier type;
std::vector<AbstractTypeIdentifier> parameters;
std::unique_ptr<TypeExpression> value;
std::unique_ptr<WrappedTypeExpression> value;
utils::IdType type_id_ = 0;
};
@ -516,7 +519,7 @@ struct FunctionCallExpression {
BaseNode base;
std::optional<std::variant<std::unique_ptr<SubExpressionToken>,
std::unique_ptr<TypeExpression>>> prefix;
std::unique_ptr<WrappedTypeExpression>>> prefix;
NameOrOperatorIdentifier name;
std::vector<std::unique_ptr<TypeExpression>> parameters;
std::vector<SubExpression> arguments;
@ -621,21 +624,21 @@ struct AnnotatedName {
struct FunctionType {
BaseNode base;
std::vector<ScopedAnyType> types;
std::vector<std::unique_ptr<ExtendedScopedAnyType>> types;
};
struct TupleType {
BaseNode base;
std::optional<Constructor> type;
std::optional<TypeIdentifier> type;
std::vector<std::pair<std::optional<NameIdentifier>, std::unique_ptr<ExtendedScopedAnyType>>> entities;
};
struct VariantType {
BaseNode base;
std::optional<Constructor> type;
std::vector<std::variant<Constructor, std::unique_ptr<TupleType>>> constructors;
std::optional<TypeIdentifier> type;
std::vector<std::pair<std::optional<Constructor>, std::optional<std::unique_ptr<TupleType>>>> constructors;
};
struct ParametrizedType {