diff --git a/src/token/token.hpp b/src/token/token.hpp index 4c4f3e5..115b75c 100644 --- a/src/token/token.hpp +++ b/src/token/token.hpp @@ -4,7 +4,7 @@ #include -struct Token { +struct token { TokenType type; std::string literal; }; diff --git a/src/token/type.hpp b/src/token/type.hpp index e86978a..eb75005 100644 --- a/src/token/type.hpp +++ b/src/token/type.hpp @@ -4,8 +4,6 @@ #include #include -namespace lexer { - // X-macro list of token types and their string representations #define TOKEN_LIST \ X(ILLEGAL, "ILLEGAL") \ @@ -23,28 +21,26 @@ namespace lexer { X(FUNCTION, "FUNCTION") \ X(LET, "LET") - // Define the TokenType enum using the X-macro - enum class TokenType { +// Define the TokenType enum using the X-macro +enum class TokenType { #define X(name, str) name, - TOKEN_LIST + TOKEN_LIST #undef X - }; +}; - // Array mapping enum values to their string representations - static constexpr std:: - array(TokenType::LET) + 1> - tokenTypeStrings = { +// Array mapping enum values to their string representations +static constexpr std:: + array(TokenType::LET) + 1> + tokenTypeStrings = { #define X(name, str) str, - TOKEN_LIST + TOKEN_LIST #undef X - }; +}; - // Stream insertion operator using the lookup array - inline std::ostream& operator<<(std::ostream& os, TokenType type) { - auto idx = static_cast(type); - if (idx < tokenTypeStrings.size()) - return os << tokenTypeStrings[idx]; - return os << "Unknown"; - } - -} // namespace lexer +// Stream insertion operator using the lookup array +inline std::ostream& operator<<(std::ostream& os, TokenType type) { + auto idx = static_cast(type); + if (idx < tokenTypeStrings.size()) + return os << tokenTypeStrings[idx]; + return os << "Unknown"; +}