shithub: rgbds

Download patch

ref: 03bb5105883c997471a3d6b37600eb2ad4ae1a6f
parent: 695dfe9dbd34ddf7d5541450bce41c6e67dd0fd8
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Jul 4 14:31:46 EDT 2021

`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`.

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -2431,7 +2431,6 @@
 	lexerState->captureBuf = NULL;
 	lexerState->disableMacroArgs = false;
 	lexerState->disableInterpolation = false;
-	lexerState->atLineStart = false;
 }
 
 bool lexer_CaptureRept(struct CaptureBody *capture)
@@ -2490,6 +2489,8 @@
 
 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 @@
 
 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;