From b08fc6dae512dc02573ef4eccf563b5d7e5029ce Mon Sep 17 00:00:00 2001 From: PhilippR Date: Sat, 6 Apr 2024 09:45:47 +0200 Subject: [PATCH] handles dos-style carriage return --- wrecc_compiler/src/preprocessor/scanner.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrecc_compiler/src/preprocessor/scanner.rs b/wrecc_compiler/src/preprocessor/scanner.rs index 4b4e454..eedd211 100644 --- a/wrecc_compiler/src/preprocessor/scanner.rs +++ b/wrecc_compiler/src/preprocessor/scanner.rs @@ -117,6 +117,9 @@ pub struct Scanner { } impl Scanner { pub fn new(source: String) -> Scanner { + // replace windows style carriage return + let source = source.replace("\r\n", "\n"); + Scanner { column: 1, line: 1,