Skip to content

Commit

Permalink
parse \r\n in discouragements
Browse files Browse the repository at this point in the history
  • Loading branch information
digama0 committed Jan 3, 2024
1 parent ee02227 commit d665bd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metamath-rs/src/comment_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ impl Discouragements {
static MODIFICATION: OnceLock<RegexSet> = 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()
});
Expand Down
10 changes: 10 additions & 0 deletions metamath-rs/src/comment_parser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit d665bd9

Please sign in to comment.