mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Made Lexer errors fully hidden in global scope
Also improved general ease of use with debugging use __debugbreak when an error is thrown. NOTE: Parser errors currently crash the program
This commit is contained in:
@@ -6,17 +6,15 @@
|
||||
|
||||
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)
|
||||
Token::Token(const TokenType _type, const LexerInfo& info, std::streamsize _length, const std::string& source)
|
||||
: type(_type), index(info.index - _length + 1), line(info.line), column(info.column - _length), length(_length), contents(source.data() + index, length)
|
||||
{}
|
||||
|
||||
//
|
||||
// This function used to have a use //
|
||||
// Now it exists cause I'm lazy //
|
||||
std::string Token::GetContents() const
|
||||
{
|
||||
return std::string(source->data() + index, length);
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user