-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid regex in fnmatch crate #191
base: main
Are you sure you want to change the base?
Conversation
33a2087
to
ecac8b8
Compare
Clippy complains about code I did not touch ._. please ignore it. |
703e701
to
c943499
Compare
Rebased. spellcheck yells at me because I named a variable |
136f930
to
261d403
Compare
261d403
to
d9402b8
Compare
d9402b8
to
03d9ce9
Compare
|
1 similar comment
|
This PR replaces the regex backend with an in-house glob parser.
The parser is two-pass:
Pattern
then walks through a given file path and returns the result.By avoiding regex we mainly avoid to fall victim of unescaped characters that may compromise globbing. We probably also increase performance, but I haven't run any benchmark and it'd be likely a negligible advantage, since file paths are short strings.
Extensive testing is very welcome. Ideally, we should fuzzy testing this too.
Limitations
[abcd]
). It only supports*
and?
.*
wouldn't be useful, but two consecutive?
may be. Should such need arise, I'll work on supporting it.