extended name removed, dereference added, unary operators removed, fixes

This commit is contained in:
ProgramSnail 2023-05-13 13:11:12 +03:00
parent e62144feac
commit 79bd30c1ee
20 changed files with 101 additions and 274 deletions

View file

@ -151,12 +151,10 @@ using PrefixedExpression = std::variant<
//
struct LambdaFunction;
struct TypeConstructor;
struct UnaryOperatorExpression;
using Expression = std::variant<
std::unique_ptr<LambdaFunction>,
std::unique_ptr<TypeConstructor>,
std::unique_ptr<PrefixedExpression>,
std::unique_ptr<UnaryOperatorExpression>,
std::unique_ptr<SubExpression>>;
//
struct TupleExpression;
@ -174,7 +172,6 @@ struct ScopedStatement;
// Operators
struct BinaryOperatorExpression;
struct UnaryOperatorExpression;
struct ReferenceExpression;
// Other expressions
@ -246,14 +243,8 @@ struct ParametrizedType;
// Comments [IGNORE] -----------------
// Identifiers, constants, etc. -----------------
struct ExtendedName {
BaseNode base;
std::string name;
};
using Pattern = std::variant<
std::unique_ptr<ExtendedName>,
std::unique_ptr<NameIdentifier>,
std::unique_ptr<Literal>,
std::unique_ptr<TypeConstructorPattern>>;
@ -323,7 +314,7 @@ struct FunctionDeclaration {
BaseNode base;
bool is_in_interface = false;
ExtendedName name;
NameOrOperatorIdentifier name;
std::vector<std::unique_ptr<AnnotatedAbstractType>> parameters;
std::unique_ptr<FunctionType> type;
@ -384,9 +375,8 @@ struct PartitionStatement {
struct FunctionDefinition {
BaseNode base;
utils::FunctionTypeModifier modifier;
ExtendedName name;
std::vector<ExtendedName> arguments;
NameOrOperatorIdentifier name;
std::vector<NameIdentifier> arguments;
};
struct TypeDefinition {
@ -408,7 +398,7 @@ struct AnyAnnotatedType {
struct TypeConstructorPatternParameter {
BaseNode base;
std::optional<ExtendedName> name;
std::optional<NameIdentifier> name;
ScopedPattern value;
};
@ -498,20 +488,12 @@ struct BinaryOperatorExpression {
OperatorIdentifier operator_name;
SubExpression left_expression;
SubExpression right_expression;
size_t precedence = utils::MaxOperatorPrecedence;
utils::IdType function_id_;
bool is_method_ = false;
};
struct UnaryOperatorExpression {
BaseNode base;
OperatorIdentifier operator_name;
Expression expression;
utils::IdType function_id_;
};
struct ReferenceExpression {
BaseNode base;
@ -533,7 +515,7 @@ struct FunctionCallExpression {
std::optional<std::variant<std::unique_ptr<SubExpressionToken>,
std::unique_ptr<TypeExpression>>> prefix;
ExtendedName name;
NameOrOperatorIdentifier name;
std::vector<std::unique_ptr<TypeExpression>> parameters;
std::vector<SubExpressionToken> arguments;
@ -561,7 +543,7 @@ struct ReturnExpression {
struct TypeConstructorParameter {
BaseNode base;
std::optional<ExtendedName> name;
std::optional<NameIdentifier> name;
std::optional<utils::AssignmentModifier> asignment_modifier;
SubExpression value;
};
@ -577,7 +559,7 @@ struct LambdaFunction {
BaseNode base;
std::vector<std::unique_ptr<AnnotatedAbstractType>> parameters;
std::vector<ExtendedName> arguments;
std::vector<NameIdentifier> arguments;
Expression expression;
std::vector<utils::IdType> argument_graph_ids_;
@ -595,7 +577,7 @@ struct ArrayExpression {
struct NameExpression {
BaseNode base;
std::vector<ExtendedName> names;
std::vector<NameIdentifier> names;
};
struct TupleName {
@ -631,7 +613,7 @@ struct TupleType {
BaseNode base;
std::optional<Constructor> type;
std::vector<std::pair<std::optional<ExtendedName>, std::unique_ptr<ExtendedScopedAnyType>>> entities;
std::vector<std::pair<std::optional<NameIdentifier>, std::unique_ptr<ExtendedScopedAnyType>>> entities;
};
struct VariantType {