Skip to content
This repository was archived by the owner on Oct 12, 2026. It is now read-only.

Commit d0d1942

Browse files
committed
chore: refactor lexer
1 parent 18f5b5e commit d0d1942

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎include/lbd/frontend/lexer.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace frontend {
2424
std::string source;
2525
size_t position = 0;
2626
size_t row = 1;
27-
size_t col = 1;
27+
size_t column = 1;
2828
const std::string filepath;
2929
const context::Options options;
3030

‎src/frontend/lexer.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace frontend {
1515
++position;
1616
if (c == '\n') {
1717
++row;
18-
col = 1;
18+
column = 1;
1919
} else {
20-
++col;
20+
++column;
2121
}
2222
}
2323
return c;
@@ -28,7 +28,7 @@ namespace frontend {
2828
}
2929

3030
Location Lexer::getCurrentLocation() const {
31-
return {row, col, filepath};
31+
return {row, column, filepath};
3232
}
3333

3434
Lexer Lexer::fromFile(const std::string &filepath, const context::Options options) {
@@ -91,7 +91,7 @@ namespace frontend {
9191
if (std::isdigit(currentCharacter)) {
9292
return {token::Float(lexFloat()), currentLocation};
9393
}
94-
// String Literal: " ... "
94+
// String Literal: " ... ".
9595
if (currentCharacter == '"') {
9696
get(); // Consume '"'.
9797
const size_t start = position;
@@ -135,11 +135,11 @@ namespace frontend {
135135
return {token::Arrow{}, currentLocation};
136136
}
137137
if (currentCharacter == '-') {
138-
// Comment
138+
// Comment.
139139
while (currentCharacter != '\n' && !isEof()) {
140140
currentCharacter = get();
141141
}
142-
// After skipping comment, return the next token
142+
// After skipping comment, return the next token.
143143
return nextToken();
144144
}
145145
// Negative Float

0 commit comments

Comments
 (0)