shithub: rgbds

Download patch

ref: 21b58b08b8e3961e16b2b21d4fa821d392d04570
parent: af530859f013d52507efcdc4c8f00ade0d7193c2
author: ISSOtm <eldredhabert0@gmail.com>
date: Thu Dec 10 10:21:32 EST 2020

Fix not shifting CRLF at end of raw lines

Fixes line reporting errors on Windows

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -1777,7 +1777,7 @@
 				if (c == EOF)
 					return 0;
 				shiftChars(1);
-				if (c == '\r' && peek(0) == '\r')
+				if (c == '\r' && peek(0) == '\n')
 					shiftChars(1);
 				return c == ',' ? T_COMMA : T_NEWLINE;
 			}
@@ -2033,10 +2033,8 @@
 				error("Unterminated REPT block\n");
 				lexerState->capturing = false;
 				goto finish;
-			} else if (c == '\n') {
-				break;
-			} else if (c == '\r') {
-				if (peek(0) == '\n')
+			} else if (c == '\n' || c == '\r') {
+				if (c == '\r' && peek(0) == '\n')
 					shiftChars(1);
 				break;
 			}