From a36f2b3b7d1f516ae92b71fddfd33678c69ffc6a Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Thu, 31 Jul 2025 03:31:13 -0400 Subject: [PATCH] Add test for `{interpolation}` after two double quotes This is an edge case of how the lexer changes behavior when reading string literals versus reading unquoted source code. Three double quotes would begin a multi-line string literal, but just two are still ambiguous, so it has to `peek()` to see whether it's inside a multi-line string literal or outside an empty regular string. --- test/asm/interpolation-after-string.asm | 8 ++++++++ test/asm/interpolation-after-string.err | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/asm/interpolation-after-string.asm create mode 100644 test/asm/interpolation-after-string.err diff --git a/test/asm/interpolation-after-string.asm b/test/asm/interpolation-after-string.asm new file mode 100644 index 00000000..75403f8f --- /dev/null +++ b/test/asm/interpolation-after-string.asm @@ -0,0 +1,8 @@ +def hello = $11 +def goodbye = $22 + +def greeting equs "hello" +println ""{greeting} + +def string equs "\"goodbye\"" +println ""{goodbye}"" diff --git a/test/asm/interpolation-after-string.err b/test/asm/interpolation-after-string.err new file mode 100644 index 00000000..f5623655 --- /dev/null +++ b/test/asm/interpolation-after-string.err @@ -0,0 +1,14 @@ +error: interpolation-after-string.asm(5): + Unknown character '{' +error: interpolation-after-string.asm(5): + syntax error, unexpected symbol +while expanding symbol "greeting" +error: interpolation-after-string.asm(5): + Unknown character '}' +error: interpolation-after-string.asm(8): + Unknown character '{' +error: interpolation-after-string.asm(8): + syntax error, unexpected symbol +error: interpolation-after-string.asm(8): + Unknown character '}' +Assembly aborted with 6 errors!