mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
visitor, print_visitor and build_visitor fixed
This commit is contained in:
parent
776b6cccc6
commit
4d0b527416
9 changed files with 212 additions and 139 deletions
|
|
@ -25,12 +25,13 @@ using TypeclassIdentifier = std::string;
|
|||
// Sources -----------------
|
||||
|
||||
struct SourceFile;
|
||||
struct Sources;
|
||||
|
||||
// Namespaces, partitions -----------------
|
||||
|
||||
struct Partition;
|
||||
struct PartitionSources;
|
||||
struct Namespace;
|
||||
struct NamespaceSources;
|
||||
|
||||
// Definitions -----------------
|
||||
|
||||
|
|
@ -43,15 +44,24 @@ struct TypeDefinitionStatement;
|
|||
struct AbstractTypeDefinitionStatement;
|
||||
struct TypeclassDefinitionStatement;
|
||||
|
||||
using SourceStatement = std::variant<
|
||||
std::unique_ptr<ImportStatement>,
|
||||
//
|
||||
using NamespaceStatement = std::variant<
|
||||
std::unique_ptr<AliasDefinitionStatement>,
|
||||
std::unique_ptr<FunctionDeclaration>,
|
||||
std::unique_ptr<FunctionDefinitionStatement>,
|
||||
std::unique_ptr<TypeDefinitionStatement>,
|
||||
std::unique_ptr<Namespace>>;
|
||||
//
|
||||
using PartitionStatement = std::variant<
|
||||
std::unique_ptr<AbstractTypeDefinitionStatement>,
|
||||
std::unique_ptr<TypeclassDefinitionStatement>,
|
||||
std::unique_ptr<Namespace>>;
|
||||
std::unique_ptr<NamespaceStatement>>;
|
||||
//
|
||||
using SourceStatement = std::variant<
|
||||
std::unique_ptr<ImportStatement>,
|
||||
std::unique_ptr<Partition>,
|
||||
std::unique_ptr<PartitionStatement>>;
|
||||
//
|
||||
|
||||
// Definition parts
|
||||
|
||||
|
|
@ -257,22 +267,13 @@ using Pattern = std::variant<
|
|||
// ----------------- Sources -----------------
|
||||
|
||||
struct SourceFile {
|
||||
std::vector<std::variant<SourceStatement, Partition>> statements;
|
||||
};
|
||||
|
||||
struct Sources {
|
||||
std::vector<SourceStatement> statements;
|
||||
};
|
||||
|
||||
// ----------------- Namespaces, partittions -----------------
|
||||
|
||||
struct Namespace {
|
||||
enum Modifier { Const, Var };
|
||||
std::optional<Modifier> modifier; // modifier => variable namespace
|
||||
TypeIdentifier type;
|
||||
std::unique_ptr<Sources> scope;
|
||||
|
||||
std::optional<utils::IdType> type_id_;
|
||||
struct PartitionSources {
|
||||
std::vector<PartitionStatement> statements;
|
||||
};
|
||||
|
||||
struct Partition {
|
||||
|
|
@ -283,7 +284,20 @@ struct Partition {
|
|||
};
|
||||
|
||||
PartitionName name;
|
||||
std::unique_ptr<Sources> scope;
|
||||
PartitionSources scope;
|
||||
};
|
||||
|
||||
struct NamespaceSources {
|
||||
std::vector<NamespaceStatement> statements;
|
||||
};
|
||||
|
||||
struct Namespace {
|
||||
enum Modifier { Const, Var };
|
||||
std::optional<Modifier> modifier; // modifier => variable namespace
|
||||
TypeIdentifier type;
|
||||
NamespaceSources scope;
|
||||
|
||||
std::optional<utils::IdType> type_id_;
|
||||
};
|
||||
|
||||
// ----------------- Definitions -----------------
|
||||
|
|
@ -559,7 +573,6 @@ struct ExtendedScopedAnyType {
|
|||
// Typeclass -----------------
|
||||
|
||||
struct TypeclassExpression {
|
||||
std::vector<TypeSubExpression> path;
|
||||
TypeclassSubExpression typeclass;
|
||||
|
||||
utils::IdType type_id_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue