Types for furc #22

Merged
CHatingPython merged 3 commits from furc-types into master 2026-06-24 13:32:30 +00:00
2 changed files with 5 additions and 0 deletions
Showing only changes of commit 0baf896c3a - Show all commits
+4
View File
@@ -146,6 +146,8 @@ enum class keyword_token {
If, /**< `if` */
Else, /**< `else` */
While, /**< `while` */
Int32, /**< `int32` */
};
static inline std::ostream& operator<<(std::ostream& os, keyword_token keyword) {
@@ -156,6 +158,7 @@ static inline std::ostream& operator<<(std::ostream& os, keyword_token keyword)
case keyword_token::If: return os << "if";
case keyword_token::Else: return os << "else";
case keyword_token::While: return os << "while";
case keyword_token::Int32: return os << "int32";
}
return os;
}
@@ -168,6 +171,7 @@ static inline std::string operator+(const std::string& str, keyword_token keywor
case keyword_token::If: return str + "if";
case keyword_token::Else: return str + "else";
case keyword_token::While: return str + "while";
case keyword_token::Int32: return str + "int32";
}
return str;
}
+1
View File
@@ -100,6 +100,7 @@ token_r lexer::next_token() {
{ "if", keyword_token::If },
{ "else", keyword_token::Else },
{ "while", keyword_token::While },
{ "int32", keyword_token::Int32 },
};
if (auto it = s_keywords.find(value); it != s_keywords.end()) return { location, it->second };