Fixed bugs with lexer
This commit is contained in:
@@ -57,7 +57,7 @@ namespace LXC::Lexer
|
||||
|
||||
// Creates the token (if at the end of the string literal) //
|
||||
if (!trackers.inStrLiteral)
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart, (USHORT)(ctx.index - trackers.sectionStart), Token::String_Literal);
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart + 1, (USHORT)(ctx.index - trackers.sectionStart - 1), Token::String_Literal);
|
||||
|
||||
} else if (trackers.inStrLiteral) {}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace LXC::Lexer
|
||||
// Checks for the end of the number literal to create the token //
|
||||
if (!IsNumeric(next)) _UNLIKELY
|
||||
{
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart, (USHORT)(ctx.index - trackers.sectionStart), Token::Num_Literal);
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart, (USHORT)(ctx.index - trackers.sectionStart + 1), Token::Num_Literal);
|
||||
trackers.inNumLiteral = false;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace LXC::Lexer
|
||||
// Checks for the end of the word to create the token //
|
||||
if (!IsAlpha(next)) _UNLIKELY
|
||||
{
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart, static_cast<unsigned short>(ctx.index - trackers.sectionStart), Token::Identifier);
|
||||
ctx.out.emplace_back(ctx, trackers.sectionStart, (USHORT)(ctx.index - trackers.sectionStart + 1), Token::Identifier);
|
||||
trackers.inIdentifier = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,12 +78,12 @@ namespace LXC::Lexer
|
||||
{
|
||||
// Output stream to log to //
|
||||
std::ostringstream os;
|
||||
os << std::setw(15) << std::left << TokenTypeToCStr(type) << " | ";
|
||||
os << std::setw(25) << std::left << TokenTypeToCStr(type) << " | ";
|
||||
|
||||
if (contents != nullptr)
|
||||
os << '"' << contents << '"';
|
||||
os << std::setw(25) << std::left << std::string('"' + std::string(contents) + '"');
|
||||
else
|
||||
os << "EMPTY";
|
||||
os << std::setw(25) << std::left << "EMPTY";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user