Regex Improvements
- inline the take_while_ascii_pred function
- change flag handling to stack allocation by using a fixed sized array
- Parse regex literals at an earlier opportunity when inspecting expressions (to reduce stack depth)
Codecov Report
Attention: Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.
Project coverage is 50.31%. Comparing base (
6ddc2b4) to head (1cb09f4). Report is 460 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| core/parser/src/lexer/regex.rs | 71.42% | 8 Missing :warning: |
| core/parser/src/lexer/cursor.rs | 33.33% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #4310 +/- ##
==========================================
+ Coverage 47.24% 50.31% +3.07%
==========================================
Files 476 498 +22
Lines 46892 49924 +3032
==========================================
+ Hits 22154 25120 +2966
- Misses 24738 24804 +66
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
I took your suggestion in the issues and made a new function for this issue using an arrayvec which I believe will be marginally more memory efficient in the vast majority of cases (where no flags are given) than allocating an array. Additionally, I added error handling for the case where more than 8 regex flags are added and preserved the original version of the function for future use.
However, your pull request covers a lot of area that mine does not we should merge them!