mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-10 08:58:47 +00:00
fixes, refactoring (shorter names, visitor)
This commit is contained in:
parent
57b1172a4f
commit
f58bfd938c
20 changed files with 564 additions and 764 deletions
|
|
@ -5,7 +5,33 @@
|
|||
|
||||
#include "basic_nodes.hpp"
|
||||
|
||||
namespace builtin::types {
|
||||
namespace builtin {
|
||||
|
||||
enum class Type {
|
||||
// -- containers
|
||||
TUPLE,
|
||||
VARIANT,
|
||||
FUNCTION,
|
||||
ARRAY,
|
||||
OPTIONAL,
|
||||
RESULT,
|
||||
ERROR,
|
||||
// -- basic types
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
INT,
|
||||
LONG,
|
||||
INDEX,
|
||||
CHAR,
|
||||
UNICODE,
|
||||
BOOL,
|
||||
UNIT,
|
||||
NULL_OPTION,
|
||||
// -- none
|
||||
NONE,
|
||||
};
|
||||
|
||||
namespace types {
|
||||
|
||||
// -- containers
|
||||
|
||||
|
|
@ -50,30 +76,6 @@ const static std::string NULL_OPTION_IDENTIFIER = "Null";
|
|||
|
||||
//
|
||||
|
||||
enum class Type {
|
||||
// -- containers
|
||||
TUPLE,
|
||||
VARIANT,
|
||||
FUNCTION,
|
||||
ARRAY,
|
||||
OPTIONAL,
|
||||
RESULT,
|
||||
ERROR,
|
||||
// -- basic types
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
INT,
|
||||
LONG,
|
||||
INDEX,
|
||||
CHAR,
|
||||
UNICODE,
|
||||
BOOL,
|
||||
UNIT,
|
||||
NULL_OPTION,
|
||||
// -- none
|
||||
NONE,
|
||||
};
|
||||
|
||||
inline std::string to_string(Type type) {
|
||||
switch (type) {
|
||||
// -- containers
|
||||
|
|
@ -202,4 +204,6 @@ inline std::optional<size_t> get_parameters_count(Type type) {
|
|||
exit(1); // unreachable
|
||||
}
|
||||
|
||||
} // namespace builtin::types
|
||||
} // namespace types
|
||||
|
||||
} // namespace builtin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue