mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-01 11:48:15 +00:00
apart of build_visitor done
This commit is contained in:
parent
36eb3390aa
commit
622b86f6c6
8 changed files with 987 additions and 312 deletions
|
|
@ -16,7 +16,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void Visit(Node* node) override;
|
||||
// // void Visit(Node* node) override;
|
||||
|
||||
// Sources -----------------
|
||||
|
||||
|
|
@ -56,6 +56,7 @@ private:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
void Visit(MatchCase* node) override;
|
||||
void Visit(Match* node) override;
|
||||
void Visit(Condition* node) override;
|
||||
void Visit(DoWhileLoop* node) override;
|
||||
|
|
@ -130,7 +131,7 @@ private:
|
|||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
||||
void Visit(AnyIdentifier* node) override; // std::string
|
||||
// // void Visit(AnyIdentifier* node) override; // std::string
|
||||
|
||||
void Visit(FloatNumberLiteral* node) override;
|
||||
void Visit(NumberLiteral* node) override;
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ struct VariableDefinition : public Node {
|
|||
};
|
||||
|
||||
struct FunctionDeclaration : public Node {
|
||||
NameIdentifier name;
|
||||
NameOrOperatorIdentifier name;
|
||||
std::vector<std::unique_ptr<DefinitionParameter>> parameters;
|
||||
std::vector<FunctionDeclarationType> argument_types;
|
||||
};
|
||||
|
|
@ -324,17 +324,18 @@ struct FunctionDefinition : public Node {
|
|||
};
|
||||
|
||||
struct AliasTypeDefinition : public Node {
|
||||
std::unique_ptr<DefinedType> name;
|
||||
std::unique_ptr<DefinedType> type;
|
||||
std::unique_ptr<ParametrizedType> value;
|
||||
};
|
||||
|
||||
struct TypeDefinition : public Node {
|
||||
std::unique_ptr<DefinedType> name;
|
||||
bool is_class; // class vs struct
|
||||
std::unique_ptr<DefinedType> type;
|
||||
AnyType value;
|
||||
};
|
||||
|
||||
struct TypeclassDefinition : public Node {
|
||||
std::unique_ptr<DefinedTypeclass> name;
|
||||
std::unique_ptr<DefinedTypeclass> typeclass;
|
||||
std::vector<std::unique_ptr<FunctionDeclaration>> requirements;
|
||||
};
|
||||
|
||||
|
|
@ -497,7 +498,7 @@ struct VariantName : public Node {
|
|||
|
||||
struct AnnotatedName : public Node {
|
||||
NameIdentifier name;
|
||||
std::unique_ptr<ParametrizedType> type; // optional
|
||||
std::optional<std::unique_ptr<ParametrizedType>> type; // optional
|
||||
};
|
||||
|
||||
// TODO ?? mark all optional fields ??
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ const std::string Sources = "sources";
|
|||
// Namespaces, partittions -----------------
|
||||
|
||||
const std::string Partition = "partition";
|
||||
const std::string Namespace = "namespace";
|
||||
|
||||
// Definitions -----------------
|
||||
|
||||
|
|
@ -57,11 +58,11 @@ const std::string FlowControl = "flow_control";
|
|||
const std::string Block = "block";
|
||||
const std::string ScopedStatement = "scoped_statement";
|
||||
|
||||
const std::string LoopExpressionToken = "loop_expression_token";
|
||||
const std::string LoopControlExpression = "loop_control_expression";
|
||||
|
||||
const std::string SubExpreessionToken = "subexpression_token";
|
||||
const std::string SubExpressionToken = "subexpression_token";
|
||||
const std::string SubExpression = "subexpression";
|
||||
const std::string PrefixedExprerssion = "prefixed_expression";
|
||||
const std::string PrefixedExpression = "prefixed_expression";
|
||||
const std::string Expression = "expression";
|
||||
const std::string SuperExpression = "super_expression";
|
||||
|
||||
|
|
@ -76,7 +77,7 @@ const std::string UnaryOperatorExpression = "unary_operator_expression";
|
|||
|
||||
const std::string FunctionCallExpression = "function_call_expression";
|
||||
const std::string TupleExpression = "tuple_expression";
|
||||
const std::string VarinatExpression = "variant_expression";
|
||||
const std::string VariantExpression = "variant_expression";
|
||||
const std::string ReturnExpression = "return_expression";
|
||||
|
||||
const std::string FunctionArgument = "function_argument";
|
||||
|
|
@ -112,7 +113,7 @@ const std::string TypeParameter = "type_parameter";
|
|||
// Typeclass
|
||||
|
||||
const std::string AnnotatedTypeclass = "annotated_typeclass";
|
||||
const std::string ParamatrizedTypeclass = "parametrized_typeclass";
|
||||
const std::string ParametrizedTypeclass = "parametrized_typeclass";
|
||||
const std::string TypeclassExpression = "typeclass_expression";
|
||||
|
||||
// Identifiers, constants, etc. -----------------
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ private:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
void Visit(MatchCase* node) override;
|
||||
void Visit(Match* node) override;
|
||||
void Visit(Condition* node) override;
|
||||
void Visit(DoWhileLoop* node) override;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
Visit(source_file);
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
virtual void Visit(Node* node) {}
|
||||
|
||||
// Sources -----------------
|
||||
|
|
@ -54,6 +54,7 @@ private:
|
|||
|
||||
// Flow control -----------------
|
||||
|
||||
virtual void Visit(MatchCase* node) {}
|
||||
virtual void Visit(Match* node) {}
|
||||
virtual void Visit(Condition* node) {}
|
||||
virtual void Visit(DoWhileLoop* node) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue