mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
bool literals, fixes
This commit is contained in:
parent
b1aff1935d
commit
d31979166e
24 changed files with 179 additions and 46 deletions
|
|
@ -78,6 +78,37 @@ enum class InternalType {
|
|||
Unit = 5,
|
||||
};
|
||||
|
||||
inline std::optional<InternalType> ToInternalType(const std::string& type) {
|
||||
if (type.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
switch (type[0]) {
|
||||
case 'F':
|
||||
if (type == "Float") { return InternalType::Float; }
|
||||
break;
|
||||
case 'I':
|
||||
if (type == "Int") { return InternalType::Int; }
|
||||
break;
|
||||
case 'S':
|
||||
if (type == "String") { return InternalType::String; }
|
||||
break;
|
||||
case 'C':
|
||||
if (type == "Char") { return InternalType::Char; }
|
||||
break;
|
||||
case 'B':
|
||||
if (type == "Bool") { return InternalType::Bool; }
|
||||
break;
|
||||
case 'U':
|
||||
if (type == "Unit") { return InternalType::Unit; }
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
class TupleType {
|
||||
public:
|
||||
TupleType() = default;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue