Skip to content

Commit

Permalink
Remove colNo column tracking from lexer
Browse files Browse the repository at this point in the history
This was added as part of 71f8871 just for debug and fstack trace
output, but we no longer output it anyway.
  • Loading branch information
Rangi42 committed Jan 28, 2025
1 parent e49291b commit d54619a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 0 additions & 2 deletions include/asm/lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct LexerState {
LexerMode mode;
bool atLineStart;
uint32_t lineNo;
uint32_t colNo;
int lastToken;

std::deque<IfStackEntry> ifStack;
Expand Down Expand Up @@ -147,7 +146,6 @@ void lexer_ReachELSEBlock();

void lexer_CheckRecursionDepth();
uint32_t lexer_GetLineNo();
uint32_t lexer_GetColNo();
void lexer_DumpStringExpansions();

struct Capture {
Expand Down
14 changes: 1 addition & 13 deletions src/asm/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ bool lexer_AtTopLevel() {

void LexerState::clear(uint32_t lineNo_) {
mode = LEXER_NORMAL;
atLineStart = true; // yylex() will init colNo due to this
atLineStart = true;
lastToken = T_(YYEOF);

ifStack.clear();
Expand All @@ -365,7 +365,6 @@ void LexerState::clear(uint32_t lineNo_) {

static void nextLine() {
lexerState->lineNo++;
lexerState->colNo = 1;
}

uint32_t lexer_GetIFDepth() {
Expand Down Expand Up @@ -852,7 +851,6 @@ static void shiftChar() {
}
} else {
// Advance within the file contents
lexerState->colNo++;
if (lexerState->content.holds<ViewedContent>()) {
lexerState->content.get<ViewedContent>().offset++;
} else {
Expand Down Expand Up @@ -892,10 +890,6 @@ uint32_t lexer_GetLineNo() {
return lexerState->lineNo;
}

uint32_t lexer_GetColNo() {
return lexerState->colNo;
}

void lexer_DumpStringExpansions() {
if (!lexerState) {
return;
Expand All @@ -921,7 +915,6 @@ static void discardBlockComment() {
error("Unterminated block comment\n");
return;
case '\r':
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
[[fallthrough]];
case '\n':
Expand Down Expand Up @@ -965,7 +958,6 @@ static void discardLineContinuation() {
shiftChar();
} else if (c == '\r' || c == '\n') {
shiftChar();
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
if (lexerState->expansions.empty()) {
nextLine();
Expand Down Expand Up @@ -1376,7 +1368,6 @@ static std::string readString(bool raw) {

// Handle '\r' or '\n' (in multiline strings only, already handled above otherwise)
if (c == '\r' || c == '\n') {
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
nextLine();
c = '\n';
Expand Down Expand Up @@ -1521,7 +1512,6 @@ static void appendStringLiteral(std::string &str, bool raw) {

// Handle '\r' or '\n' (in multiline strings only, already handled above otherwise)
if (c == '\r' || c == '\n') {
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
nextLine();
c = '\n';
Expand Down Expand Up @@ -2212,7 +2202,6 @@ static Token skipIfBlock(bool toEndc) {
}

if (c == '\r' || c == '\n') {
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
// Do this both on line continuations and plain EOLs
nextLine();
Expand Down Expand Up @@ -2294,7 +2283,6 @@ static Token yylex_SKIP_TO_ENDR() {
}

if (c == '\r' || c == '\n') {
// Handle CRLF before nextLine() since shiftChar updates colNo
handleCRLF(c);
// Do this both on line continuations and plain EOLs
nextLine();
Expand Down

0 comments on commit d54619a

Please sign in to comment.