#pragma once #include "interpreter_tree.hpp" #include #include #include #include #include #include // for clangd namespace interpreter { class Node; } // namespace interpreter namespace info { using NumberValue = long long; using FloatNumberValue = float; using StringValue = std::string; struct SimpleValue { std::variant value; }; struct Value { enum class ValueStructure { Simple, // one value Variant, // one value from list, can have arguments // MultiVariant, // constructed variant // ?? Tuple, // tuple of values }; ValueStructure structure; std::vector> values; }; // better variant value storage (then string) ?? struct VariantTypeInfo; struct TupleTypeInfo; struct AliasTypeInfo; struct TypeInfo; struct TypeclassInfo; enum class BuiltInTypeInfo { StringT, IntT, FloatT, }; struct TypeUsageInfo { // TODO: typeclass_expression std::vector param_names; std::vector params; std::vector arg_names; // ??, arg expr ?? }; struct ParameterInfo { std::string name; std::vector param_names; // TODO: paramaters std::vector param_types; }; struct SymbolDefinitionInfo { std::string name; std::vector params; std::vector arg_names; }; struct AnyTypeInfo : SymbolDefinitionInfo { std::variant, std::unique_ptr, std::unique_ptr> info; }; // struct VariableInfo { // std::string name; // std::optional value; // TypeInfo* type = nullptr; // }; // TODO lambda functions as value // TODO: decide= struct TupleTypeInfo { std::optional name; std::vector, AnyTypeInfo>> fields; }; struct VariantTypeInfo { std::optional name; std::vector> constructors; // ?? any type instead of tuple type ?? }; struct AliasTypeInfo { std::vector params; bool isAnotherType; TypeUsageInfo value; }; struct TypeInfo { std::variant type; }; // struct PointerInfo { // ?? // VariableInfo* variable; // }; struct FunctionDeclarationInfo { std::vector params; std::vector arg_types; }; struct FunctionDefinitionInfo : SymbolDefinitionInfo { interpreter::tokens::SuperExpression* expression; }; struct FunctionInfo { FunctionDeclarationInfo declaration; FunctionDefinitionInfo definition; }; struct TypeclassInfo : SymbolDefinitionInfo { std::vector requirements; }; struct ImportInfo { std::string module_name; std::vector symbols; }; struct NamespaceInfo { std::unordered_map types; std::unordered_map typeclasses; // std::unordered_map variables; // TODO std::unordered_map functions; std::unordered_map> namespaces; std::optional var; std::string type_name; TypeInfo* type_info = nullptr; }; using AnyTypeVariant = std::variant; } // namespace info