Skip to content

Commit 0e7758e

Browse files
committed
Fix max line len for last line without /n
1 parent 7cca893 commit 0e7758e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/source/pl/core/lexer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ namespace pl::core {
305305
g_lexerStaticInitDone = true;
306306
initNewLexer();
307307
}
308+
m_longestLineLength = 0;
308309
}
309310

310311
void Lexer::reset() {
311-
this->m_longestLineLength = 0;
312+
m_longestLineLength = 0;
312313
this->m_tokens.clear();
313314
}
314315

@@ -538,6 +539,10 @@ namespace pl::core {
538539
#endif
539540
}
540541

542+
std::size_t len = results.first - lineStart;
543+
m_longestLineLength = std::max(len, m_longestLineLength);
544+
lineStart = results.second;
545+
541546
const auto &eop = tkn::Separator::EndOfProgram;
542547
m_tokens.emplace_back(eop.type, eop.value, location());
543548

0 commit comments

Comments
 (0)