Newlines in multi-line strings update the line number

This affects error and warning messages, and dbgPrint
This commit is contained in:
Rangi
2021-02-12 15:32:49 -05:00
committed by Eldred Habert
parent fc2bf3d11d
commit 96bce05be2
3 changed files with 10 additions and 3 deletions

View File

@@ -1457,9 +1457,12 @@ static void readString(void)
// We'll be staying in the string, so we can safely consume the char // We'll be staying in the string, so we can safely consume the char
shiftChars(1); shiftChars(1);
// Handle CRLF (in multiline strings only, already handled above otherwise) // Handle '\r' or '\n' (in multiline strings only, already handled above otherwise)
if (c == '\r' && peek(0) == '\n') { if (c == '\r' || c == '\n') {
shiftChars(1); /* Handle CRLF before nextLine() since shiftChars updates colNo */
if (c == '\r' && peek(0) == '\n')
shiftChars(1);
nextLine();
c = '\n'; c = '\n';
} }

View File

@@ -30,3 +30,5 @@ EMPTY3 EQUS """"""
EMPTY4 EQUS """\ ; comment EMPTY4 EQUS """\ ; comment
""" """
PRINTLN STRCAT("(", "{EMPTY1}", "{EMPTY2}", "{EMPTY3}", "{EMPTY4}", ")") PRINTLN STRCAT("(", "{EMPTY1}", "{EMPTY2}", "{EMPTY3}", "{EMPTY4}", ")")
warn "check the line number"

View File

@@ -0,0 +1,2 @@
warning: multi-line-strings.asm(34): [-Wuser]
check the line number