diff options
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/glob.rs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs index 984a09aed3e..2811b939cc2 100644 --- a/src/libextra/glob.rs +++ b/src/libextra/glob.rs @@ -137,7 +137,17 @@ fn list_dir_sorted(path: &Path) -> ~[Path] { /** * A compiled Unix shell style pattern. */ -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Zero)] +#[cfg(stage0)] +#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)] +pub struct Pattern { + priv tokens: ~[PatternToken] +} + +/** + * A compiled Unix shell style pattern. + */ +#[cfg(not(stage0))] +#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)] pub struct Pattern { priv tokens: ~[PatternToken] } @@ -458,7 +468,37 @@ fn is_sep(c: char) -> bool { /** * Configuration options to modify the behaviour of `Pattern::matches_with(..)` */ -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Zero)] +#[cfg(stage0)] +#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)] +pub struct MatchOptions { + + /** + * Whether or not patterns should be matched in a case-sensitive manner. This + * currently only considers upper/lower case relationships between ASCII characters, + * but in future this might be extended to work with Unicode. + */ + case_sensitive: bool, + + /** + * If this is true then path-component separator characters (e.g. `/` on Posix) + * must be matched by a literal `/`, rather than by `*` or `?` or `[...]` + */ + require_literal_separator: bool, + + /** + * If this is true then paths that contain components that start with a `.` will + * not match unless the `.` appears literally in the pattern: `*`, `?` or `[...]` + * will not match. This is useful because such files are conventionally considered + * hidden on Unix systems and it might be desirable to skip them when listing files. + */ + require_literal_leading_dot: bool +} + +/** + * Configuration options to modify the behaviour of `Pattern::matches_with(..)` + */ +#[cfg(not(stage0))] +#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)] pub struct MatchOptions { /** |
