From 03bb5105883c997471a3d6b37600eb2ad4ae1a6f Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 4 Jul 2021 18:31:46 -0400 Subject: [PATCH] `endCapture` shouldn't handle `lexerState->atLineStart` `startCapture` did not initialize `lexerState->atLineStart`; its final value is a consequence of the separate but similar behaviors within `lexer_CaptureRept` and `lexer_CaptureMacroBody`. --- src/asm/lexer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 8a05611d..4d80f4dd 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -2431,7 +2431,6 @@ static void endCapture(struct CaptureBody *capture) lexerState->captureBuf = NULL; lexerState->disableMacroArgs = false; lexerState->disableInterpolation = false; - lexerState->atLineStart = false; } bool lexer_CaptureRept(struct CaptureBody *capture) @@ -2490,6 +2489,8 @@ bool lexer_CaptureRept(struct CaptureBody *capture) finish: endCapture(capture); + /* ENDR or EOF puts us past the start of the line */ + lexerState->atLineStart = false; /* Returns true if an ENDR terminated the block, false if it reached EOF first */ return c != EOF; @@ -2545,6 +2546,8 @@ bool lexer_CaptureMacroBody(struct CaptureBody *capture) finish: endCapture(capture); + /* ENDM or EOF puts us past the start of the line */ + lexerState->atLineStart = false; /* Returns true if an ENDM terminated the block, false if it reached EOF first */ return c != EOF;