Files
MIRROR-LX-OriginalRepo/Lexer/src/Token.cpp
2025-05-05 16:45:34 +01:00

21 lines
514 B
C++

#include <Lexer.h>
#include <LX-Common.h>
namespace LX
{
// Creates the memory for the pointer to the source //
std::string* Token::source = nullptr;
// Passes the constructor args to the values //
Token::Token(const TokenType _type, const LexerInfo& info, std::streamsize _length)
: type(_type), index(info.index - _length + 1), line(info.line), column(info.column - _length), length(_length)
{}
//
std::string Token::GetContents() const
{
return std::string(source->data() + index, length);
}
}