From d10651c907fb30283ab4fc602fb366690ec0c7f1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 8 Jul 2023 22:02:29 -0700 Subject: [PATCH 1/2] Revert "Require \r whitespace to be followed by \n" This reverts commit 0c550b285eeccedf57e4310469827fa6964a1ba2. --- src/parse.rs | 6 +----- tests/test.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/parse.rs b/src/parse.rs index 6c5cb41..66657af 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -104,14 +104,10 @@ fn skip_whitespace(input: Cursor) -> Cursor { } } match byte { - b' ' | 0x09..=0x0c => { + b' ' | 0x09..=0x0d => { s = s.advance(1); continue; } - b'\r' if s.as_bytes().get(1) == Some(&b'\n') => { - s = s.advance(2); - continue; - } b if b <= 0x7f => {} _ => { let ch = s.chars().next().unwrap(); diff --git a/tests/test.rs b/tests/test.rs index 32e4199..1aa3951 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -740,7 +740,7 @@ fn whitespace() { assert_eq!(tokens.into_iter().count(), 0); let lone_carriage_return = " \r "; - lone_carriage_return.parse::().unwrap_err(); + lone_carriage_return.parse::().unwrap(); // FIXME } #[test] From 261ad4d6efab9138efb4291704039a8046eae225 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 8 Jul 2023 22:03:15 -0700 Subject: [PATCH 2/2] Extend lone carriage returns test --- tests/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test.rs b/tests/test.rs index 1aa3951..7792a02 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -739,8 +739,8 @@ fn whitespace() { let tokens = various_spaces.parse::().unwrap(); assert_eq!(tokens.into_iter().count(), 0); - let lone_carriage_return = " \r "; - lone_carriage_return.parse::().unwrap(); // FIXME + let lone_carriage_returns = " \r \r\r\n "; + lone_carriage_returns.parse::().unwrap(); } #[test]