Added foundation for Lexer
This commit is contained in:
@@ -5,4 +5,22 @@
|
||||
|
||||
namespace LXC::Lexer
|
||||
{
|
||||
LexerContext::LexerContext(const std::string& _source) :
|
||||
source(_source), index(0), out{}, len(_source.length()), column(0), line(0)
|
||||
{}
|
||||
|
||||
Util::ReturnVal<LexerOutput, LexerError> TokenizeFile(const std::string& fileContents)
|
||||
{
|
||||
// Creates the context for the lexer //
|
||||
LexerContext context(fileContents);
|
||||
|
||||
while (context.index > context.len)
|
||||
{
|
||||
// Iterates to the next index //
|
||||
context.column++;
|
||||
context.index++;
|
||||
}
|
||||
|
||||
return context.out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user