From d703afdbe01c4b6f83df9eaa23acedf9ff41bd98 Mon Sep 17 00:00:00 2001 From: Mario Carneiro Date: Wed, 3 Jan 2024 14:35:11 -0500 Subject: [PATCH] parse `\r\n` in discouragements --- metamath-rs/src/comment_parser.rs | 4 ++-- metamath-rs/src/comment_parser_tests.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/metamath-rs/src/comment_parser.rs b/metamath-rs/src/comment_parser.rs index 5d967d9..0ab7962 100644 --- a/metamath-rs/src/comment_parser.rs +++ b/metamath-rs/src/comment_parser.rs @@ -475,8 +475,8 @@ impl Discouragements { static MODIFICATION: OnceLock = OnceLock::new(); let modification = MODIFICATION.get_or_init(|| { RegexSet::new([ - r"\(Proof[ \n]+modification[ \n]+is[ \n]+discouraged\.\)", - r"\(New[ \n]+usage[ \n]+is[ \n]+discouraged\.\)", + r"\(Proof[ \r\n]+modification[ \r\n]+is[ \r\n]+discouraged\.\)", + r"\(New[ \r\n]+usage[ \r\n]+is[ \r\n]+discouraged\.\)", ]) .unwrap() }); diff --git a/metamath-rs/src/comment_parser_tests.rs b/metamath-rs/src/comment_parser_tests.rs index e6b5201..6abf6b8 100644 --- a/metamath-rs/src/comment_parser_tests.rs +++ b/metamath-rs/src/comment_parser_tests.rs @@ -326,6 +326,16 @@ fn test_discouragements() { usage_discouraged: true, } ); + assert_eq!( + Discouragements::new( + b"A false axiom, experimental. (Proof modification\r\n\ + is discouraged.) (New usage is discouraged.)" + ), + Discouragements { + modification_discouraged: true, + usage_discouraged: true, + } + ); } #[track_caller]