mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix lexer capture sometimes not being reset
This commit is contained in:
@@ -1674,7 +1674,7 @@ static int skipIfBlock(bool toEndc)
|
|||||||
|
|
||||||
token = yylex();
|
token = yylex();
|
||||||
if (token == 0) { /* Pass EOF through */
|
if (token == 0) { /* Pass EOF through */
|
||||||
return token;
|
break;
|
||||||
} else if (atLineStart && token == T_POP_IF) { /* Increase nesting */
|
} else if (atLineStart && token == T_POP_IF) { /* Increase nesting */
|
||||||
nIFDepth++;
|
nIFDepth++;
|
||||||
} else if (atLineStart && nIFDepth == startingDepth) { /* An occasion to finish? */
|
} else if (atLineStart && nIFDepth == startingDepth) { /* An occasion to finish? */
|
||||||
@@ -1811,6 +1811,7 @@ void lexer_CaptureRept(char **capture, size_t *size)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
error("Unterminated REPT block\n");
|
error("Unterminated REPT block\n");
|
||||||
|
lexerState->capturing = false;
|
||||||
goto finish;
|
goto finish;
|
||||||
} else if (c == '\n') {
|
} else if (c == '\n') {
|
||||||
break;
|
break;
|
||||||
@@ -1824,6 +1825,7 @@ void lexer_CaptureRept(char **capture, size_t *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
assert(!lexerState->capturing);
|
||||||
*capture = captureStart;
|
*capture = captureStart;
|
||||||
*size = lexerState->captureSize - strlen("ENDR");
|
*size = lexerState->captureSize - strlen("ENDR");
|
||||||
lexerState->captureBuf = NULL;
|
lexerState->captureBuf = NULL;
|
||||||
@@ -1847,6 +1849,7 @@ void lexer_CaptureMacroBody(char **capture, size_t *size)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
error("Unterminated macro definition\n");
|
error("Unterminated macro definition\n");
|
||||||
|
lexerState->capturing = false;
|
||||||
goto finish;
|
goto finish;
|
||||||
} else if (c == '\n') {
|
} else if (c == '\n') {
|
||||||
break;
|
break;
|
||||||
@@ -1905,6 +1908,7 @@ void lexer_CaptureMacroBody(char **capture, size_t *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
assert(!lexerState->capturing);
|
||||||
*capture = captureStart;
|
*capture = captureStart;
|
||||||
*size = lexerState->captureSize - strlen("ENDM");
|
*size = lexerState->captureSize - strlen("ENDM");
|
||||||
lexerState->captureBuf = NULL;
|
lexerState->captureBuf = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user