Skip to content

Commit 5a83e9e

Browse files
authored
fix: multiline comments and max line length. (#162)
Multi-line comments were being counted as a single line when calculating maximum line length.
1 parent a6fca08 commit 5a83e9e

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

lib/include/pl/core/lexer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace pl::core {
4949
std::optional<u128> parseInteger(std::string_view literal);
5050

5151
Token makeToken(const Token& token, size_t length = 1);
52-
Token makeTokenAt(const Token& token, Location& location, size_t length = 1);
52+
static Token makeTokenAt(const Token& token, Location& location, size_t length = 1);
5353
void addToken(const Token& token);
5454
bool hasTheLineEnded(const char &ch) {
5555
if(ch == '\n') {

lib/source/pl/core/lexer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,11 @@ namespace pl::core {
458458
Token Lexer::makeToken(const Token &token, const size_t length) {
459459
auto location = this->location();
460460
location.length = length;
461-
m_longestLineLength = std::max(m_longestLineLength, location.column + location.length);
462461
return { token.type, token.value, location };
463462
}
464463

465464
Token Lexer::makeTokenAt(const Token &token, Location& location, const size_t length) {
466465
location.length = length;
467-
m_longestLineLength = std::max(m_longestLineLength, location.column + location.length);
468466
return { token.type, token.value, location };
469467
}
470468

0 commit comments

Comments
 (0)