Keep more non-declaration initialization within the for loop clause

This commit is contained in:
Rangi42
2026-04-19 22:01:56 +02:00
parent 71dfab3365
commit 12186fdccc
3 changed files with 8 additions and 13 deletions
+4 -6
View File
@@ -192,15 +192,16 @@ static yy::parser::symbol_type parseAnyNumber(int c) {
static yy::parser::symbol_type parseString() {
LexerStackEntry &context = lexerStack.back();
int c = context.file.sgetc();
std::string str;
for (; c != '"'; c = context.file.sgetc()) {
for (int c = context.file.sgetc();; c = context.file.sgetc()) {
if (c == EOF || isNewline(c)) {
scriptError("Unterminated string");
break;
}
context.file.sbumpc();
if (c == '\\') {
if (c == '"') {
break;
} else if (c == '\\') {
c = context.file.sgetc();
if (c == EOF || isNewline(c)) {
scriptError("Unterminated string");
@@ -220,9 +221,6 @@ static yy::parser::symbol_type parseString() {
}
str.push_back(c);
}
if (c == '"') {
context.file.sbumpc();
}
return yy::parser::make_string(std::move(str));
}