Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
==========================================
+ Coverage 95.28% 97.10% +1.81%
==========================================
Files 6 6
Lines 1422 2207 +785
Branches 140 244 +104
==========================================
+ Hits 1355 2143 +788
+ Misses 66 64 -2
+ Partials 1 0 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
GNU grep testsuite comparison: |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
| normalize_null_data_posix_dollar_anchors(pattern, config.regex_mode) | ||
| } | ||
| RegexMode::Perl => normalize_null_data_perl_dollar_anchors(pattern), | ||
| RegexMode::Fixed => unreachable!(), |
There was a problem hiding this comment.
could be a single match config.regex_mode with if config.null_data guards returning Option, no?
then there's no need for the matches! + unreachable!()
| false | ||
| } | ||
|
|
||
| fn find_bracket_expression_end(pattern: &[u8], start: usize) -> Option<usize> { |
There was a problem hiding this comment.
this is almost the same scan as scan_bracket below, could you please reuse it?
| && matches!(bytes.get(i + 2), Some(b')' | b'|'))) | ||
| } | ||
| RegexMode::Extended => true, | ||
| _ => false, |
There was a problem hiding this comment.
a basic: bool would be simpler than passing the mode, then the debug_assert and this _ => false can go
| } | ||
|
|
||
| #[test] | ||
| fn null_data_anchors_are_record_anchors() { |
There was a problem hiding this comment.
please add BRE alpha$\|x and \(alpha$\), -E '^beta', and a positive beta$ on alpha\nbeta\0 for each mode
|
GNU grep testsuite comparison: |
| } | ||
|
|
||
| #[test] | ||
| fn null_data_anchors_cover_bre_ere_and_record_end() { |
There was a problem hiding this comment.
could be merged into the table of null_data_anchors_are_record_anchors (one list of failing, one of matching args), no?
six almost identical blocks here
rstest is probably good to use here
|
GNU grep testsuite comparison: |
Fixes #195.
With
-z, records end at NUL, so newline is just data and^/$should onlyanchor at record edges. The matcher only set
REGEX_OPTION_MULTILINE, which in Oniguruma just makes.match newline. The anchors stayed line-based, and under-P$stillmatched before a trailing newline.
Now BRE/ERE also set
REGEX_OPTION_SINGLELINEunder-zand rewrite$to\', and Perl rewrites$to\z. Added a regression test and a unit testfor the Perl rewrite.
cargo testpasses.