Files
MIRROR-LX-OriginalRepo/Lexer/src/Token.cpp
Pasha Bibko c95d91b867 Changed how tokens are represented in memory
Also made string-literal tokens now include the quotes as part of their contents.
2025-04-22 10:55:35 +01:00

22 lines
527 B
C++

#include <Lexer.h>
#include <string>
#include <vector>
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);
}
}