mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Avoid use of goto in shiftChar
This commit is contained in:
@@ -862,22 +862,24 @@ static void shiftChar() {
|
|||||||
|
|
||||||
lexerState->macroArgScanDistance--;
|
lexerState->macroArgScanDistance--;
|
||||||
|
|
||||||
restart:
|
for (;;) {
|
||||||
if (!lexerState->expansions.empty()) {
|
if (!lexerState->expansions.empty()) {
|
||||||
// Advance within the current expansion
|
// Advance within the current expansion
|
||||||
if (Expansion &exp = lexerState->expansions.front(); exp.advance()) {
|
if (Expansion &exp = lexerState->expansions.front(); exp.advance()) {
|
||||||
// When advancing would go past an expansion's end,
|
// When advancing would go past an expansion's end,
|
||||||
// move up to its parent and try again to advance
|
// move up to its parent and try again to advance
|
||||||
lexerState->expansions.pop_front();
|
lexerState->expansions.pop_front();
|
||||||
goto restart;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Advance within the file contents
|
|
||||||
if (lexerState->content.holds<ViewedContent>()) {
|
|
||||||
lexerState->content.get<ViewedContent>().offset++;
|
|
||||||
} else {
|
} else {
|
||||||
lexerState->content.get<BufferedContent>().advance();
|
// Advance within the file contents
|
||||||
|
if (lexerState->content.holds<ViewedContent>()) {
|
||||||
|
lexerState->content.get<ViewedContent>().offset++;
|
||||||
|
} else {
|
||||||
|
lexerState->content.get<BufferedContent>().advance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2114,7 +2116,7 @@ append:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish: // Can't `break` out of a nested `for`-`switch`
|
||||||
// Trim right whitespace
|
// Trim right whitespace
|
||||||
auto rightPos = std::find_if_not(str.rbegin(), str.rend(), isWhitespace);
|
auto rightPos = std::find_if_not(str.rbegin(), str.rend(), isWhitespace);
|
||||||
str.resize(rightPos.base() - str.begin());
|
str.resize(rightPos.base() - str.begin());
|
||||||
|
|||||||
Reference in New Issue
Block a user