mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-07 23:48:43 +00:00
binary operator expression repalced with function call expression
This commit is contained in:
parent
5192ffe5f3
commit
94805c8662
15 changed files with 165 additions and 269 deletions
|
|
@ -129,12 +129,10 @@ using SubExpressionToken = std::variant<
|
|||
std::unique_ptr<Literal>>;
|
||||
//
|
||||
struct FunctionCallExpression;
|
||||
struct BinaryOperatorExpression;
|
||||
struct ArrayExpression;
|
||||
struct ReferenceExpression;
|
||||
using SubExpression = std::variant<
|
||||
using SubExpression = std::variant< // BiaryOperatorExpression is FunctionCallExpression
|
||||
std::unique_ptr<FunctionCallExpression>,
|
||||
std::unique_ptr<BinaryOperatorExpression>,
|
||||
std::unique_ptr<SubExpressionToken>,
|
||||
std::unique_ptr<ReferenceExpression>>;
|
||||
//
|
||||
|
|
@ -171,7 +169,6 @@ struct ScopedStatement;
|
|||
|
||||
// Operators
|
||||
|
||||
struct BinaryOperatorExpression;
|
||||
struct ReferenceExpression;
|
||||
|
||||
// Other expressions
|
||||
|
|
@ -482,17 +479,17 @@ struct ScopedStatement {
|
|||
|
||||
// Operators -----------------
|
||||
|
||||
struct BinaryOperatorExpression {
|
||||
BaseNode base;
|
||||
|
||||
OperatorIdentifier operator_name;
|
||||
SubExpression left_expression;
|
||||
SubExpression right_expression;
|
||||
size_t precedence = utils::MaxOperatorPrecedence;
|
||||
|
||||
utils::IdType function_id_;
|
||||
bool is_method_ = false;
|
||||
};
|
||||
// struct BinaryOperatorExpression {
|
||||
// BaseNode base;
|
||||
//
|
||||
// OperatorIdentifier operator_name;
|
||||
// SubExpression left_expression;
|
||||
// SubExpression right_expression;
|
||||
// size_t precedence = utils::MaxOperatorPrecedence;
|
||||
//
|
||||
// utils::IdType function_id_;
|
||||
// bool is_method_ = false;
|
||||
// };
|
||||
|
||||
struct ReferenceExpression {
|
||||
BaseNode base;
|
||||
|
|
@ -517,11 +514,15 @@ struct FunctionCallExpression {
|
|||
std::unique_ptr<TypeExpression>>> prefix;
|
||||
NameOrOperatorIdentifier name;
|
||||
std::vector<std::unique_ptr<TypeExpression>> parameters;
|
||||
std::vector<SubExpressionToken> arguments;
|
||||
std::vector<SubExpression> arguments;
|
||||
|
||||
std::optional<size_t> precedence; // for operators
|
||||
bool is_binary_operator_expression = false; // for operators
|
||||
|
||||
// only one from two is present
|
||||
std::optional<utils::IdType> function_id_;
|
||||
std::optional<utils::IdType> typeclass_graph_id_;
|
||||
bool is_method_of_first_argument_ = false;
|
||||
};
|
||||
|
||||
struct TupleExpression {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue