Cleaned up Lexer

This commit is contained in:
Pasha Bibko
2025-05-07 18:10:15 +01:00
parent 6783564f10
commit 98fc4589ab
11 changed files with 246 additions and 203 deletions

View File

@@ -7,6 +7,11 @@ namespace LX
// Struct to store the current information of the lexer //
struct LexerInfo
{
// Constructor to set the constants //
LexerInfo(const std::string& _source)
: source(_source), len(_source.length())
{}
// Current trackers of where in the source it is //
std::streamsize line = 1; // <- Lines start on 1 (probably because of non-programmer's)
@@ -19,6 +24,11 @@ namespace LX
std::streamsize startOfNumberLiteral = 0;
std::streamsize startOfStringLiteral = 0;
// Information about the source //
const std::string& source;
const std::streamsize len;
// Different flags of the lexer //
// Stored as a bitset to minimse memory allocated //
// - Basically no difference, because only one exists at any given time //