diff options
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 86 |
1 files changed, 81 insertions, 5 deletions
@@ -99,7 +99,85 @@ namespace { std::unordered_set<std::string> keywords { "alignas", "alignof", - // ... Keywords table, p.15 + "asm", + "auto", + "bool", + "break", + "case", + "catch", + "char", + "char8_t", + "char16_t", + "char32_t", + "class", + "concept", + "const", + "consteval", + "constexpr", + "constinit", + "const_cast", + "continue", + "co_await", + "co_return", + "co_yield", + "decltype", + "default", + "delete", + "do", + "double", + "dynamic_cast", + "else", + "enum", + "explicit", + "export", + "extern", + "false", + "float", + "for", + "friend", + "goto", + "if", + "inline", + "int", + "long", + "mutable", + "namespace", + "new", + "noexcept", + "nullptr", + "operator", + "private", + "protected", + "public", + "register", + "reinterpret_cast", + "requires", + "return", + "short", + "signed", + "sizeof", + "static", + "static_assert", + "static_cast", + "struct", + "switch", + "template", + "this", + "thread_local", + "throw", + "true", + "try", + "typedef", + "typeid", + "typename", + "union", + "unsigned", + "using", + "virtual", + "void", + "volatile", + "wchar_t", + "while", }; } @@ -119,12 +197,10 @@ std::vector<Token> CPP::tokens_from_pptokens(std::vector<Token> pp_tokens) for (auto& token: pp_tokens) { if (pp_types.find(token.type) != pp_types.end()) { if (token.type == "identifier") { -#if 0 if (keywords.find(token.value) != keywords.end()) - result.emplace_back("keyword", token.value); + result.emplace_back(token.value, token.value); else -#endif - result.emplace_back(Token{"identifier"s, token.value}); + result.emplace_back(Token{"identifier"s, token.value}); } else if (token.type == "preprocessing-op-or-punc") result.emplace_back(Token{token.value, token.value}); |