#4291 rules parser updates - #4365
Open
cielbellerose wants to merge 10 commits into
Open
Conversation
cielbellerose
marked this pull request as ready for review
August 11, 2026 02:08
wavehassman
reviewed
Aug 11, 2026
| export const extractSubRules = (ruleCode: string, content: string): ParsedRule[] => { | ||
| // "a." and "(a)" styles mark a subrule at a line start or after a colon | ||
| // "a)" style marks a subrule if following any whitespace | ||
| const letterPattern = /(?:(?<=^|:\s)([a-z])\.|(?<=^|:\s)\(([a-z])\)|(?<=^|\s)([a-z])\))\s+/gm; |
Contributor
There was a problem hiding this comment.
The three formats aren't treated equally: a) is allowed to start a subrule after any whitespace, anywhere mid-sentence, but (a) is only recognized at line-start or right after ": ". So "then either: a) foo or b) bar" splits correctly, but the equally common "then either (a) foo or (b) bar" does not, because (a) here is preceded by "either ", not ": " or a line start.
Is this how you want it should work?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
subrules are now caught with format "(a)" and "a)" instead of just "a."
combined duplicate logic for FHE/FSAE
User input first page -> Removed TOC exclusion, the formatting was just too hard to perfect, and I didn't want the chance of excluding any rules. Users now have the option to specify a first page to skip over the beginning pdf sections
Removed automatic header/footer exclusion, the logic was too specific/unreliable and risked removing real rule content
Test Cases
Added parsing test coverage!
Screenshots
Checklist
It can be helpful to check the
ChecksandFiles changedtabs.Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
yarn.lockchanges (unless dependencies have changed)Closes #4291