mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Move more statements into for loop clauses
This commit is contained in:
@@ -1084,12 +1084,11 @@ static void discardComment(void)
|
|||||||
dbgPrint("Discarding comment\n");
|
dbgPrint("Discarding comment\n");
|
||||||
lexerState->disableMacroArgs = true;
|
lexerState->disableMacroArgs = true;
|
||||||
lexerState->disableInterpolation = true;
|
lexerState->disableInterpolation = true;
|
||||||
for (;;) {
|
for (;; shiftChar()) {
|
||||||
int c = peek();
|
int c = peek();
|
||||||
|
|
||||||
if (c == EOF || c == '\r' || c == '\n')
|
if (c == EOF || c == '\r' || c == '\n')
|
||||||
break;
|
break;
|
||||||
shiftChar();
|
|
||||||
}
|
}
|
||||||
lexerState->disableMacroArgs = false;
|
lexerState->disableMacroArgs = false;
|
||||||
lexerState->disableInterpolation = false;
|
lexerState->disableInterpolation = false;
|
||||||
@@ -1111,13 +1110,13 @@ static void readLineContinuation(void)
|
|||||||
handleCRLF(c);
|
handleCRLF(c);
|
||||||
if (!lexerState->expansions)
|
if (!lexerState->expansions)
|
||||||
nextLine();
|
nextLine();
|
||||||
return;
|
break;
|
||||||
} else if (c == ';') {
|
} else if (c == ';') {
|
||||||
discardComment();
|
discardComment();
|
||||||
} else {
|
} else {
|
||||||
error("Begun line continuation, but encountered character %s\n",
|
error("Begun line continuation, but encountered character %s\n",
|
||||||
printChar(c));
|
printChar(c));
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2240,11 +2239,10 @@ static int skipIfBlock(bool toEndc)
|
|||||||
if (atLineStart) {
|
if (atLineStart) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
for (;;) {
|
for (;; shiftChar()) {
|
||||||
c = peek();
|
c = peek();
|
||||||
if (!isWhitespace(c))
|
if (!isWhitespace(c))
|
||||||
break;
|
break;
|
||||||
shiftChar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsIdentifier(c)) {
|
if (startsIdentifier(c)) {
|
||||||
@@ -2514,7 +2512,7 @@ bool lexer_CaptureRept(struct CaptureBody *capture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Just consume characters until EOL or EOF */
|
/* Just consume characters until EOL or EOF */
|
||||||
for (;;) {
|
for (;; c = nextChar()) {
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
error("Unterminated REPT/FOR block\n");
|
error("Unterminated REPT/FOR block\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
@@ -2522,7 +2520,6 @@ bool lexer_CaptureRept(struct CaptureBody *capture)
|
|||||||
handleCRLF(c);
|
handleCRLF(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
c = nextChar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2571,7 +2568,7 @@ bool lexer_CaptureMacroBody(struct CaptureBody *capture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Just consume characters until EOL or EOF */
|
/* Just consume characters until EOL or EOF */
|
||||||
for (;;) {
|
for (;; c = nextChar()) {
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
error("Unterminated macro definition\n");
|
error("Unterminated macro definition\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
@@ -2579,7 +2576,6 @@ bool lexer_CaptureMacroBody(struct CaptureBody *capture)
|
|||||||
handleCRLF(c);
|
handleCRLF(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
c = nextChar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,17 +218,14 @@ void processWarningFlag(char *flag)
|
|||||||
errx(1, "Cannot make meta warning \"%s\" into an error",
|
errx(1, "Cannot make meta warning \"%s\" into an error",
|
||||||
flag);
|
flag);
|
||||||
|
|
||||||
uint8_t const *ptr = metaWarningCommands[id - META_WARNINGS_START];
|
for (uint8_t const *ptr = metaWarningCommands[id - META_WARNINGS_START];
|
||||||
|
*ptr != META_WARNING_DONE; ptr++) {
|
||||||
for (;;) {
|
|
||||||
if (*ptr == META_WARNING_DONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Warning flag, set without override */
|
/* Warning flag, set without override */
|
||||||
if (warningStates[*ptr] == WARNING_DEFAULT)
|
if (warningStates[*ptr] == WARNING_DEFAULT)
|
||||||
warningStates[*ptr] = WARNING_ENABLED;
|
warningStates[*ptr] = WARNING_ENABLED;
|
||||||
ptr++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user