Avoid use of goto in shiftChar

This commit is contained in:
Rangi42
2025-02-27 14:07:55 -05:00
parent d8192560b0
commit 2cdbb145da

View File

@@ -862,14 +862,14 @@ static void shiftChar() {
lexerState->macroArgScanDistance--;
restart:
for (;;) {
if (!lexerState->expansions.empty()) {
// Advance within the current expansion
if (Expansion &exp = lexerState->expansions.front(); exp.advance()) {
// When advancing would go past an expansion's end,
// move up to its parent and try again to advance
lexerState->expansions.pop_front();
goto restart;
continue;
}
} else {
// Advance within the file contents
@@ -879,6 +879,8 @@ restart:
lexerState->content.get<BufferedContent>().advance();
}
}
return;
}
}
static int nextChar() {
@@ -2114,7 +2116,7 @@ append:
}
}
finish:
finish: // Can't `break` out of a nested `for`-`switch`
// Trim right whitespace
auto rightPos = std::find_if_not(str.rbegin(), str.rend(), isWhitespace);
str.resize(rightPos.base() - str.begin());