diff options
author | rtk0c <[email protected]> | 2023-10-19 22:50:07 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2025-08-16 11:31:16 -0700 |
commit | 297232d21594b138bb368a42b5b0d085ff9ed6aa (patch) | |
tree | 075d5407e1e12a9d35cbee6e4c20ad34e0765c42 /source/20-codegen-compiler/CodegenLexer.hpp | |
parent | d5cd34ff69f7fd134d5450696f298af1a864afbc (diff) |
The great renaming: switch to "module style"
Diffstat (limited to 'source/20-codegen-compiler/CodegenLexer.hpp')
-rw-r--r-- | source/20-codegen-compiler/CodegenLexer.hpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/source/20-codegen-compiler/CodegenLexer.hpp b/source/20-codegen-compiler/CodegenLexer.hpp deleted file mode 100644 index ec8c8b7..0000000 --- a/source/20-codegen-compiler/CodegenLexer.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include <LookupTable.hpp> - -#include <stb_c_lexer.h> -#include <span> -#include <string> -#include <string_view> -#include <vector> - -enum { - CLEX_ext_single_char = CLEX_first_unused_token, - CLEX_ext_double_colon, - CLEX_ext_dot_dot_dot, - CLEX_ext_COUNT, -}; - -struct StbLexerToken { - std::string text; - - union { - double lexerRealNumber; - long lexerIntNumber; - }; - - // Can either be CLEX_* or CLEX_ext_* values - int type; - - int Reamalgamate() const; -}; - -bool StbTokenIsSingleChar(int lexerToken); -bool StbTokenIsMultiChar(int lexerToken); -std::string CombineTokens(std::span<const StbLexerToken> tokens, std::string_view separator = {}); - -struct CodegenLexer { - std::vector<StbLexerToken> tokens; - size_t idx = 0; - - void InitializeFrom(std::string_view source); - - const StbLexerToken& Current() const; - - const StbLexerToken* TryConsumeToken(int type); - const StbLexerToken* TryConsumeSingleCharToken(char c); - - void SkipUntilToken(int type); - void SkipUntilTokenSingleChar(char c); -}; |