Closed olson-sean-k closed 3 years ago
I believe this is fixed by the changes currently on the flag
branch. :tada: Those changes introduce flags as described above and move state into the parser so that each literal token can read its case sensitivity from the latest flag state established during parsing. That information is used to determine the variance of literals when partitioning glob expressions.
As an aside, those changes add complexity to the parser, which must consider flags carefully. I should be sure to add even more testing around this...
Fixed in bc52751. :tada:
I plan to expose flags for controlling case sensitivity in glob expressions. For example,
**/*.(?i){jpg,jpeg}
would match the extensionsjpg
orjpeg
without case sensitivity (a la typical regular expressions). While working on this, it became clear that case sensitivity must be considered inGlob::partition
.Unix file systems do not consider case or related character classes at all, but Windows file systems do (specifically the Win32 API) and are effectively case insensitive. This means that glob matching may disagree with the resolution of paths done by the target platform and this (along with any future case sensitivity flags) must be reflected by
Glob::partition
and related APIs.For example, the glob
foo/*.bar
is split into the pathfoo
and glob*.bar
byGlob::partitioned
. However, globs are currently case sensitive, so on Windows this may lead to inconsistent behavior betweenGlob::new
withGlob::is_match
versusGlob::partitioned
withGlob::walk
: