mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 06:58:45 +00:00
partition syntax changed, interface modifier added
This commit is contained in:
parent
3fca384446
commit
b1aff1935d
22 changed files with 299 additions and 266 deletions
|
|
@ -35,8 +35,6 @@ struct SourceFile;
|
|||
|
||||
// Namespaces, partitions -----------------
|
||||
|
||||
struct Partition;
|
||||
struct PartitionSources;
|
||||
struct Namespace;
|
||||
struct NamespaceSources;
|
||||
|
||||
|
|
@ -50,6 +48,7 @@ struct FunctionDefinitionStatement;
|
|||
struct TypeDefinitionStatement;
|
||||
struct AbstractTypeDefinitionStatement;
|
||||
struct TypeclassDefinitionStatement;
|
||||
struct PartitionStatement;
|
||||
|
||||
//
|
||||
using NamespaceStatement = std::variant<
|
||||
|
|
@ -57,17 +56,14 @@ using NamespaceStatement = std::variant<
|
|||
std::unique_ptr<FunctionDeclaration>,
|
||||
std::unique_ptr<FunctionDefinitionStatement>,
|
||||
std::unique_ptr<TypeDefinitionStatement>,
|
||||
std::unique_ptr<PartitionStatement>,
|
||||
std::unique_ptr<Namespace>>;
|
||||
//
|
||||
using PartitionStatement = std::variant<
|
||||
std::unique_ptr<AbstractTypeDefinitionStatement>,
|
||||
std::unique_ptr<TypeclassDefinitionStatement>,
|
||||
std::unique_ptr<NamespaceStatement>>;
|
||||
//
|
||||
using SourceStatement = std::variant<
|
||||
std::unique_ptr<ImportStatement>,
|
||||
std::unique_ptr<Partition>,
|
||||
std::unique_ptr<PartitionStatement>>;
|
||||
std::unique_ptr<AbstractTypeDefinitionStatement>,
|
||||
std::unique_ptr<TypeclassDefinitionStatement>,
|
||||
std::unique_ptr<NamespaceStatement>>;
|
||||
//
|
||||
|
||||
// Definition parts
|
||||
|
|
@ -193,6 +189,13 @@ struct ArrayExpression;
|
|||
|
||||
// Name
|
||||
|
||||
struct PartitionName {
|
||||
BaseNode base;
|
||||
|
||||
std::vector<TypeIdentifier> path;
|
||||
NameIdentifier name;
|
||||
};
|
||||
|
||||
struct NameExpression;
|
||||
struct TupleName;
|
||||
struct VariantName;
|
||||
|
|
@ -268,25 +271,6 @@ struct SourceFile {
|
|||
|
||||
// ----------------- Namespaces, partittions -----------------
|
||||
|
||||
struct PartitionSources {
|
||||
BaseNode base;
|
||||
|
||||
std::vector<PartitionStatement> statements;
|
||||
};
|
||||
|
||||
struct Partition {
|
||||
BaseNode base;
|
||||
|
||||
enum PartitionName {
|
||||
Test,
|
||||
Interface,
|
||||
Code,
|
||||
};
|
||||
|
||||
PartitionName name;
|
||||
PartitionSources scope;
|
||||
};
|
||||
|
||||
struct NamespaceSources {
|
||||
BaseNode base;
|
||||
|
||||
|
|
@ -337,6 +321,7 @@ struct VariableDefinitionStatement {
|
|||
struct FunctionDeclaration {
|
||||
BaseNode base;
|
||||
|
||||
bool is_in_interface = false;
|
||||
ExtendedName name;
|
||||
std::vector<std::unique_ptr<AnnotatedAbstractType>> parameters;
|
||||
std::unique_ptr<FunctionType> type;
|
||||
|
|
@ -347,7 +332,6 @@ struct FunctionDeclaration {
|
|||
struct FunctionDefinitionStatement {
|
||||
BaseNode base;
|
||||
|
||||
bool is_inline;
|
||||
std::unique_ptr<FunctionDefinition> definition;
|
||||
SuperExpression value;
|
||||
|
||||
|
|
@ -357,6 +341,7 @@ struct FunctionDefinitionStatement {
|
|||
struct TypeDefinitionStatement {
|
||||
BaseNode base;
|
||||
|
||||
bool is_in_interface = false;
|
||||
utils::ClassModifier modifier;
|
||||
std::unique_ptr<TypeDefinition> definition;
|
||||
AnyType value;
|
||||
|
|
@ -383,6 +368,16 @@ struct TypeclassDefinitionStatement {
|
|||
utils::IdType typeclass_id_;
|
||||
};
|
||||
|
||||
struct PartitionStatement {
|
||||
BaseNode base;
|
||||
|
||||
utils::PartitionModifier modifier;
|
||||
PartitionName name;
|
||||
SuperExpression value;
|
||||
|
||||
utils::IdType executable_id_;
|
||||
};
|
||||
|
||||
// Definition parts -----------------
|
||||
|
||||
struct FunctionDefinition {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue