mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-06 15:08:48 +00:00
type structure change, mostly done
This commit is contained in:
parent
522dd16f79
commit
a7c1e3f658
9 changed files with 183 additions and 66 deletions
39
include/builtin_types.hpp
Normal file
39
include/builtin_types.hpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "basic_nodes.hpp"
|
||||
|
||||
namespace builtin {
|
||||
|
||||
const static std::string TUPLE_IDENTIFIER = "Tuple";
|
||||
|
||||
const static std::string VARIANT_IDENTIFIER = "Variant";
|
||||
|
||||
const static std::string ARRAY_IDENTIFIER = "Array";
|
||||
|
||||
const static std::string OPTIONAL_IDENTIFIER = "Optional";
|
||||
|
||||
const static std::string RESULT_IDENTIFIER = "Result";
|
||||
|
||||
enum class BuiltinType {
|
||||
TUPLE,
|
||||
VARIANT,
|
||||
ARRAY,
|
||||
OPTIONAL,
|
||||
RESULT,
|
||||
NONE,
|
||||
};
|
||||
|
||||
inline nodes::Modifier builtin_to_modifier(BuiltinType type) {
|
||||
switch (type) {
|
||||
case BuiltinType::OPTIONAL:
|
||||
return nodes::Modifier::OPTIONAL;
|
||||
case BuiltinType::RESULT:
|
||||
return nodes::Modifier::RESULT;
|
||||
default:
|
||||
return nodes::Modifier::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace builtin
|
||||
Loading…
Add table
Add a link
Reference in a new issue