shithub: rgbds

Download patch

ref: f16e34b8046ad62653a68b979c78cc9b225c06fa
parent: c3ccdc548ee002dea38032d008cb89981ef660d8
author: ISSOtm <eldredhabert0@gmail.com>
date: Wed Dec 9 04:54:55 EST 2020

Fix captures beginning in expansions

Fixes #590

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -1962,13 +1962,11 @@
 
 static char *startCapture(void)
 {
-	assert(!lexerState->expansions);
-
 	lexerState->capturing = true;
 	lexerState->captureSize = 0;
 	lexerState->disableMacroArgs = true;
 
-	if (lexerState->isMmapped) {
+	if (lexerState->isMmapped && !lexerState->expansions) {
 		return &lexerState->ptr[lexerState->offset];
 	} else {
 		lexerState->captureCapacity = 128; /* The initial size will be twice that */
--- /dev/null
+++ b/test/asm/equs-macrodef.asm
@@ -1,0 +1,3 @@
+DEFINE equs "mac: MACRO\nPRINTT \"Hello :D\\n\"\nENDM"
+DEFINE
+	mac
--- /dev/null
+++ b/test/asm/equs-macrodef.out
@@ -1,0 +1,1 @@
+Hello :D