ref: 96bce05be2d899fda544a480672cdf76c6737468
parent: fc2bf3d11d14170f5aeee171cbb3f3cf1bced825
author: Rangi <[email protected]>
date: Fri Feb 12 10:32:49 EST 2021
Newlines in multi-line strings update the line number This affects error and warning messages, and dbgPrint
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -1457,9 +1457,12 @@
// We'll be staying in the string, so we can safely consume the char
shiftChars(1);
- // Handle CRLF (in multiline strings only, already handled above otherwise)
- if (c == '\r' && peek(0) == '\n') {
- shiftChars(1);
+ // Handle '\r' or '\n' (in multiline strings only, already handled above otherwise)
+ if (c == '\r' || c == '\n') {
+ /* Handle CRLF before nextLine() since shiftChars updates colNo */
+ if (c == '\r' && peek(0) == '\n')
+ shiftChars(1);
+ nextLine();
c = '\n';
}
--- a/test/asm/multi-line-strings.asm
+++ b/test/asm/multi-line-strings.asm
@@ -30,3 +30,5 @@
EMPTY4 EQUS """\ ; comment
"""
PRINTLN STRCAT("(", "{EMPTY1}", "{EMPTY2}", "{EMPTY3}", "{EMPTY4}", ")")
+
+ warn "check the line number"
--- a/test/asm/multi-line-strings.err
+++ b/test/asm/multi-line-strings.err
@@ -1,0 +1,2 @@
+warning: multi-line-strings.asm(34): [-Wuser]
+ check the line number