Automattic / Automattic/harper
A non-greedy `RepeatingPattern` would be handy
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 102
Description
## Description
For patterns that can match multiple variants you often have to figure out which one was matched inside `match_to_lint()`.
One way to do that would be to use another pattern inside `match_to_lint()` that did the equivalent of `/.*?"word"/`.
Currently `RepeatingPattern` is always greedy so it will match to the end of the chunk. Then whatever is after it can't match.
This is my use case but there's bound to be others since this is common in pattern matching.
## Component
- Core grammar checking engine
Contributor guide
Research direction
Start by tracing RepeatingPattern and match_to_lint() in the core grammar checking engine, then inspect how a repeated match currently consumes the chunk. Define how a non-greedy option should interact with following patterns and cover the /.*?"word"/ use case; done means later pattern components can match after the shortest valid repetition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100