mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 06:58:45 +00:00
access syntax changed, sync with grammar, type_chack_visitor in progress
This commit is contained in:
parent
3d74b1383e
commit
6fc91aafa0
19 changed files with 110221 additions and 102967 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
// for clangd
|
||||
#include "utils.hpp"
|
||||
#include "types_info.hpp"
|
||||
|
||||
namespace interpreter::tokens {
|
||||
|
||||
|
|
@ -87,12 +88,26 @@ using FlowControl = std::variant<
|
|||
|
||||
struct Block;
|
||||
|
||||
struct FloatNumberLiteral;
|
||||
struct NumberLiteral;
|
||||
struct StringLiteral;
|
||||
struct CharLiteral;
|
||||
|
||||
using Literal = std::variant<
|
||||
std::unique_ptr<FloatNumberLiteral>,
|
||||
std::unique_ptr<NumberLiteral>,
|
||||
std::unique_ptr<StringLiteral>,
|
||||
std::unique_ptr<CharLiteral>>;
|
||||
|
||||
//
|
||||
struct NameExpression;
|
||||
struct ScopedStatement;
|
||||
struct AccessExpression;
|
||||
using SubExpressionToken = std::variant<
|
||||
std::unique_ptr<NameExpression>,
|
||||
std::unique_ptr<ScopedStatement>>;
|
||||
std::unique_ptr<ScopedStatement>,
|
||||
std::unique_ptr<AccessExpression>,
|
||||
std::unique_ptr<Literal>>;
|
||||
//
|
||||
struct FunctionCallExpression;
|
||||
struct BinaryOperatorExpression;
|
||||
|
|
@ -224,29 +239,6 @@ struct ExtendedName {
|
|||
std::string name;
|
||||
};
|
||||
|
||||
struct FloatNumberLiteral;
|
||||
struct NumberLiteral;
|
||||
struct StringLiteral;
|
||||
struct CharLiteral;
|
||||
|
||||
using Literal = std::variant<
|
||||
std::unique_ptr<FloatNumberLiteral>,
|
||||
std::unique_ptr<NumberLiteral>,
|
||||
std::unique_ptr<StringLiteral>,
|
||||
std::unique_ptr<CharLiteral>>;
|
||||
|
||||
//
|
||||
|
||||
using NameSubExpression = std::variant<
|
||||
std::unique_ptr<ExtendedName>,
|
||||
std::unique_ptr<Literal>,
|
||||
std::unique_ptr<SuperExpression>>;
|
||||
|
||||
enum class ReferenceType {
|
||||
Reference,
|
||||
UniqueReference,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ----------------- Sources -----------------
|
||||
|
|
@ -267,6 +259,9 @@ struct Namespace {
|
|||
std::optional<ExtendedName> name;
|
||||
TypeIdentifier type;
|
||||
std::unique_ptr<Sources> scope;
|
||||
|
||||
std::optional<utils::IdType> type_id_;
|
||||
std::optional<info::type::Type> variable_type_;
|
||||
};
|
||||
|
||||
struct Partition {
|
||||
|
|
@ -323,6 +318,7 @@ struct FunctionDefinitionStatement {
|
|||
|
||||
utils::IdType function_id_;
|
||||
std::vector<utils::IdType> argument_graph_ids_;
|
||||
utils::IdType return_type_graph_id_;
|
||||
};
|
||||
|
||||
struct TypeDefinitionStatement {
|
||||
|
|
@ -437,10 +433,15 @@ struct UnaryOperatorExpression {
|
|||
};
|
||||
|
||||
struct ReferenceExpression {
|
||||
std::vector<ReferenceType> references;
|
||||
std::vector<utils::ReferenceType> references;
|
||||
std::unique_ptr<ScopedStatement> expression;
|
||||
};
|
||||
|
||||
struct AccessExpression {
|
||||
std::unique_ptr<NameExpression> name;
|
||||
SubExpressionToken id;
|
||||
};
|
||||
|
||||
// Other Expressions -----------------
|
||||
|
||||
struct FunctionCallExpression {
|
||||
|
|
@ -480,7 +481,7 @@ struct ArrayExpression {
|
|||
|
||||
struct NameExpression {
|
||||
std::vector<TypeSubExpression> namespaces;
|
||||
std::vector<NameSubExpression> expressions;
|
||||
std::vector<ExtendedName> expressions;
|
||||
};
|
||||
|
||||
struct TupleName {
|
||||
|
|
@ -528,7 +529,7 @@ struct TypeExpression {
|
|||
};
|
||||
|
||||
struct ExtendedScopedAnyType {
|
||||
std::vector<ReferenceType> references;
|
||||
std::vector<utils::ReferenceType> references;
|
||||
AnyType type;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue