about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-11 21:51:13 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-12 18:54:13 -0700
commita0e123eb6e2c0a971dd4e9e2c49e2ceed0d73672 (patch)
treeeb7e9454e47fb5a582cc739e25b676f46cf44ae1 /src/libextra
parentca47eebb44431c1ded5cc5c412d95210f3955ef4 (diff)
downloadrust-a0e123eb6e2c0a971dd4e9e2c49e2ceed0d73672.tar.gz
rust-a0e123eb6e2c0a971dd4e9e2c49e2ceed0d73672.zip
syntax: add #[deriving(Default)] syntax extension
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/glob.rs44
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 {
 
     /**