shithub: rgbds

Download patch

ref: 192f2de704c9a0ac06e809cf962e9a9159d0117f
parent: c568b3a97656be4e2287d93d6d77f71893033f05
parent: cdd82009369ff348ccce7b40267c5079c8439679
author: Eldred Habert <eldredhabert0@gmail.com>
date: Sun Nov 3 11:40:34 EST 2019

Merge pull request #440 from ISSOtm/nested_brackets

Allow nested bracketed symbols

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -666,6 +666,11 @@
 				i += length;
 			else
 				fatalerror("Illegal character escape '%c'", ch);
+		} else if (ch == '{') {
+			/* Handle nested symbols */
+			++pLexBuffer;
+			i += yylex_ReadBracketedSymbol(sym, i);
+			--pLexBuffer;
 		} else if (ch == ':' && !mode) { /* Only grab 1st colon */
 			/* Use a whitelist of modes, which does prevent the
 			 * use of some features such as precision,
--- /dev/null
+++ b/test/asm/nested-brackets.asm
@@ -1,0 +1,5 @@
+STRING equs "OK"
+WRAPPER equs "TRIN"
+	PRINTT "{S{WRAPPER}G}\n"
+
+	PRINTT "{S{WRAPPER}G"
--- /dev/null
+++ b/test/asm/nested-brackets.out
@@ -1,0 +1,3 @@
+ERROR: nested-brackets.asm(5):
+    Missing }
+OK