olson-sean-k / wax

Opinionated and portable globs that can be matched against paths and directory trees.
https://glob.guide
MIT License
115 stars 10 forks source link

Wax should allow unescaped ',' and ':' outside Alternatives and Repetitions #37

Open brunoschmidt opened 1 year ago

brunoschmidt commented 1 year ago

Wax restricts the use of literals containing ',' and ':' because of their use on Alternatives and Repetitions and the fact that they recurse on glob, but it restricts literals unnecessarily with such characters.

I believe that literal should be parametrized with the restriction on those characters only when they are in use by the expression, making escaping optional when they are not in use.

Today a literal like this will break without scaping:

Glob::new("extra:dots.txt").unwrap();

Causing the following error:

panicked at 'called `Result::unwrap()` on an `Err` value: BuildError { kind: Parse(ParseError { expression: "extra:dots.txt", locations: [ErrorEntry { fragment: ":dots.txt", location: 5, kind: Nom(Eof) }] }) }'