mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibJS: Fix incorrect token column values (#2401)
- initializing m_line_column to 1 in the lexer results in incorrect column values in tokens on the first line of input. - not incrementing m_line_column when EOF is reached results in an incorrect column value on the last token.
This commit is contained in:
parent
7bb69bb9bf
commit
11405c5139
Notes:
sideshowbarker
2024-07-19 06:06:35 +09:00
Author: https://github.com/predmond
Commit: 11405c5139
Pull-request: https://github.com/SerenityOS/serenity/pull/2401
4 changed files with 15 additions and 17 deletions
|
@ -149,8 +149,12 @@ Lexer::Lexer(StringView source)
|
|||
|
||||
void Lexer::consume()
|
||||
{
|
||||
if (m_position >= m_source.length()) {
|
||||
m_position = m_source.length() + 1;
|
||||
if (m_position > m_source.length())
|
||||
return;
|
||||
|
||||
if (m_position == m_source.length()) {
|
||||
m_position++;
|
||||
m_line_column++;
|
||||
m_current_char = EOF;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue