bool literals, fixes

This commit is contained in:
ProgramSnail 2023-05-08 20:34:36 +03:00
parent b1aff1935d
commit d31979166e
24 changed files with 179 additions and 46 deletions

View file

@ -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;