shithub: rgbds

Download patch

ref: 57d966d6e00a94fe54d335cec750034af08c892a
parent: 4216f0a9b0bd08d66ecb50e453d22a5d8c23da6b
parent: 17752d7094e74752d5fc1efb2fc81f7efb3e5a2e
author: Rangi <35663410+Rangi42@users.noreply.github.com>
date: Fri Mar 26 09:33:11 EDT 2021

Merge pull request #804 from Rangi42/normal-backslash

Backslash in normal lexer mode must be a line continuation

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -2059,29 +2059,15 @@
 		case EOF:
 			return T_EOF;
 
-		/* Handle escapes */
+		/* Handle line continuations */
 
 		case '\\':
-			c = peek(0);
-
-			switch (c) {
-			case ' ':
-			case '\r':
-			case '\n':
-				readLineContinuation();
-				break;
-
-			case EOF:
-				error("Illegal character escape at end of input\n");
-				break;
-
-			default:
-				shiftChars(1);
-				error("Illegal character escape '%s'\n", print(c));
-			}
+			// Macro args were handled by `peek`, and character escapes do not exist
+			// outside of string literals, so this must be a line continuation.
+			readLineContinuation();
 			break;
 
-		/* Handle identifiers and escapes... or error out */
+		/* Handle identifiers... or report garbage characters */
 
 		default:
 			if (startsIdentifier(c)) {