From 0baf896c3af3b472977f75a536f39f3e6e65b0a7 Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Wed, 24 Jun 2026 15:27:29 +0200 Subject: [PATCH] feat: introduce int32 keyword Refs: #15 --- furc/include/furc/front/token.hpp | 4 ++++ furc/src/front/lexer.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/furc/include/furc/front/token.hpp b/furc/include/furc/front/token.hpp index e7c1058..386e6c4 100644 --- a/furc/include/furc/front/token.hpp +++ b/furc/include/furc/front/token.hpp @@ -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; } diff --git a/furc/src/front/lexer.cpp b/furc/src/front/lexer.cpp index 374b106..70007c0 100644 --- a/furc/src/front/lexer.cpp +++ b/furc/src/front/lexer.cpp @@ -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 };