Added foundation for Lexer

This commit is contained in:
Pasha Bibko
2025-07-20 13:49:10 +01:00
parent 7768ba4522
commit 8f75e52a07
6 changed files with 47 additions and 4 deletions

View File

@@ -6,12 +6,24 @@ namespace LXC::Lexer
{
struct LexerContext
{
// Constructor to set the information of the context //
LexerContext(const std::string& _source);
// Trackers for the Lexer itself //
std::string source;
const std::string& source;
size_t index;
LexerOutput out;
const size_t len;
// Trackers for where the Lexer is within the user version of source //
unsigned short column;
unsigned short line;
};
struct LexerError
{};
// Turns a file into a vector of tokens //
Util::ReturnVal<LexerOutput, LexerError> TokenizeFile(const std::string& fileContents);
}

View File

@@ -112,4 +112,7 @@ namespace LXC::Lexer
// The data of the token //
const char* contents;
};
// Typedef for the output type of how the Lexer outputs //
typedef std::vector<Token> LexerOutput;
}