At the moment rhg compiles all patterns into a single big regular expression,
so it’s not practical to find out which file the invalid bit of syntax
came from.
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG262a38f10427: rhg: Accept different "invalid ignore pattern" error message formatting
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
This might become a nuisance with a really big regex as it will print it in its entirety... but I'm not sure I have a good solution that isn't over-engineered right now.
Ideally we’d have a way to parse and validate separate regexps from individual patterns (reporting errors with only the relevant line), then combine them (like in https://twitter.com/thingskatedid/status/1472360823058157569 and the preceding thread). If it’s cheap to combine already-fully-compiled DFAs, maybe the regex crate could have an API that takes multiple Regex values? In the meantime if we accept some duplicated setup-time work we could validate each pattern with Regex::new, report errors individually, throw away successful results and then at the end build the mega-regex from concatenated strings like now.
The second option was my idea, I don't know how much churn that would imply, but I feel like it would make the debugging experience much better.