]> git.lizzy.rs Git - rust.git/commitdiff
stdlib: "tag" -> "enum"
authorPatrick Walton <pcwalton@mimiga.net>
Thu, 19 Jan 2012 23:20:57 +0000 (15:20 -0800)
committerPatrick Walton <pcwalton@mimiga.net>
Thu, 19 Jan 2012 23:22:25 +0000 (15:22 -0800)
15 files changed:
src/libstd/c_vec.rs
src/libstd/deque.rs
src/libstd/ebml.rs
src/libstd/extfmt.rs
src/libstd/fun_treemap.rs
src/libstd/getopts.rs
src/libstd/io.rs
src/libstd/json.rs
src/libstd/list.rs
src/libstd/map.rs
src/libstd/net.rs
src/libstd/rope.rs
src/libstd/test.rs
src/libstd/treemap.rs
src/libstd/win32_fs.rs

index 5bab771ab7d95fb6d66688cefc61808108f244e5..05d59c2b50ba9ae5844745fbca986ce11788c341 100644 (file)
 /*
  Type: t
 
- The type representing a native chunk of memory.  Wrapped in a tag for
+ The type representing a native chunk of memory.  Wrapped in a enum for
  opacity; FIXME #818 when it is possible to have truly opaque types, this
  should be revisited.
  */
 
-tag t<T> {
+enum t<T> {
     t({ base: *mutable T, len: uint, rsrc: @dtor_res});
 }
 
index 356b27d0c5b7ec68b4d4b7ca19982406d09631e5..b5f46732cfc0f092c95942fa3c18fb88a84407fa 100644 (file)
@@ -241,9 +241,9 @@ fn test_parameterized<T: copy>(e: eqfn<T>, a: T, b: T, c: T, d: T) {
         assert (e(deq.get(3), d));
     }
 
-    tag taggy { one(int); two(int, int); three(int, int, int); }
+    enum taggy { one(int); two(int, int); three(int, int, int); }
 
-    tag taggypar<T> {
+    enum taggypar<T> {
         onepar(int); twopar(int, int); threepar(int, int, int);
     }
 
index fafec1894146220b33abc2dd55f2b2f69289b8c7..24e072692a95cbc8b5d44128feaeb0ce49bbaf45 100644 (file)
@@ -67,7 +67,7 @@ fn get_doc(d: doc, tg: uint) -> doc {
     alt maybe_get_doc(d, tg) {
       some(d) { ret d; }
       none {
-        #error("failed to find block with tag %u", tg);
+        #error("failed to find block with enum %u", tg);
         fail;
       }
     }
@@ -155,7 +155,7 @@ fn create_writer(w: io::writer) -> writer {
 
 // TODO: Provide a function to write the standard ebml header.
 fn start_tag(w: writer, tag_id: uint) {
-    // Write the tag ID:
+    // Write the enum ID:
 
     write_vint(w.writer, tag_id);
     // Write a placeholder four-byte size.
index a729fba905f43d975f055580f198c739c20b7e2c..441ff01a3c138329790fd475161f815de3fa487d 100644 (file)
@@ -39,9 +39,9 @@
 
 // Functions used by the fmt extension at compile time
 mod ct {
-    tag signedness { signed; unsigned; }
-    tag caseness { case_upper; case_lower; }
-    tag ty {
+    enum signedness { signed; unsigned; }
+    enum caseness { case_upper; case_lower; }
+    enum ty {
         ty_bool;
         ty_str;
         ty_char;
@@ -52,14 +52,14 @@ mod ct {
         ty_float;
         // FIXME: More types
     }
-    tag flag {
+    enum flag {
         flag_left_justify;
         flag_left_zero_pad;
         flag_space_for_sign;
         flag_sign_always;
         flag_alternate;
     }
-    tag count {
+    enum count {
         count_is(int);
         count_is_param(int);
         count_is_next_param;
@@ -76,7 +76,7 @@ mod ct {
 
 
     // A fragment of the output sequence
-    tag piece { piece_string(str); piece_conv(conv); }
+    enum piece { piece_string(str); piece_conv(conv); }
     type error_fn = fn@(str) -> ! ;
 
     fn parse_fmt_string(s: str, error: error_fn) -> [piece] {
@@ -260,7 +260,7 @@ fn parse_type(s: str, i: uint, lim: uint, error: error_fn) ->
 // conditions can be evaluated at compile-time. For now though it's cleaner to
 // implement it this way, I think.
 mod rt {
-    tag flag {
+    enum flag {
         flag_left_justify;
         flag_left_zero_pad;
         flag_space_for_sign;
@@ -273,8 +273,8 @@ mod rt {
         // comments in front::extfmt::make_flags
         flag_none;
     }
-    tag count { count_is(int); count_implied; }
-    tag ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; }
+    enum count { count_is(int); count_implied; }
+    enum ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; }
 
     // FIXME: May not want to use a vector here for flags;
     // instead just use a bool per flag
@@ -384,7 +384,7 @@ fn str_init_elt(c: char, n_elts: uint) -> str {
 
         ret str::unsafe_from_bytes(svec);
     }
-    tag pad_mode { pad_signed; pad_unsigned; pad_nozero; }
+    enum pad_mode { pad_signed; pad_unsigned; pad_nozero; }
     fn pad(cv: conv, s: str, mode: pad_mode) -> str {
         let uwidth;
         alt cv.width {
index 34a393b6a8e7540583bbb9355de8110111d806b1..8bd4a38d40bebeb89cdb0357357b8508743b2079 100644 (file)
@@ -31,7 +31,7 @@
 /*
 Tag: tree_node
 */
-tag tree_node<K, V> {
+enum tree_node<K, V> {
     empty;
     node(@K, @V, @tree_node<K, V>, @tree_node<K, V>);
 }
index 39b6de0e34fb31cd5da4136780a6af742412eade..29df5770a17fee4c7fd87200e95d64ee371cc506 100644 (file)
 export opt_maybe_str;
 export opt_default;
 
-tag name { long(str); short(char); }
+enum name { long(str); short(char); }
 
-tag hasarg { yes; no; maybe; }
+enum hasarg { yes; no; maybe; }
 
-tag occur { req; optional; multi; }
+enum occur { req; optional; multi; }
 
 /*
 Type: opt
@@ -130,7 +130,7 @@ fn optmulti(name: str) -> opt {
     ret {name: mkname(name), hasarg: yes, occur: multi};
 }
 
-tag optval { val(str); given; }
+enum optval { val(str); given; }
 
 /*
 Type: match
@@ -158,7 +158,7 @@ fn find_opt(opts: [opt], nm: name) -> option::t<uint> {
 The type returned when the command line does not conform to the
 expected format. Pass this value to <fail_str> to get an error message.
 */
-tag fail_ {
+enum fail_ {
     argument_missing(str);
     unrecognized_option(str);
     option_missing(str);
@@ -169,7 +169,7 @@ fn find_opt(opts: [opt], nm: name) -> option::t<uint> {
 /*
 Function: fail_str
 
-Convert a <fail_> tag into an error string
+Convert a <fail_> enum into an error string
 */
 fn fail_str(f: fail_) -> str {
     ret alt f {
@@ -381,7 +381,7 @@ mod tests {
     import opt = getopts;
     import result::{err, ok};
 
-    tag fail_type {
+    enum fail_type {
         argument_missing_;
         unrecognized_option_;
         option_missing_;
index 9a0cb10c8588933c9bf8748c6cbde8a7747652ff..eca266ecfa953edad4bb9b49c240338bb4b11bc7 100644 (file)
@@ -17,7 +17,7 @@
 // Reading
 
 // FIXME This is all buffered. We might need an unbuffered variant as well
-tag seek_style { seek_set; seek_end; seek_cur; }
+enum seek_style { seek_set; seek_end; seek_cur; }
 
 
 // The raw underlying reader iface. All readers must implement this.
@@ -264,7 +264,7 @@ fn string_reader(s: str) -> reader {
 
 
 // Writing
-tag fileflag { append; create; truncate; none; }
+enum fileflag { append; create; truncate; none; }
 
 // FIXME: Seekable really should be orthogonal.
 // FIXME: eventually u64
@@ -495,7 +495,7 @@ fn read_whole_file(file: str) -> result::t<[u8], str> {
 
 mod fsync {
 
-    tag level {
+    enum level {
         // whatever fsync does on that platform
         fsync;
 
index d433b12ec682656bbb02f9cf1ce6b65449f09207..5b7523e03fdf2e1c38b3dfe5e0cee1150961c9cb 100644 (file)
@@ -23,7 +23,7 @@
 
 Represents a json value.
 */
-tag json {
+enum json {
     /* Variant: num */
     num(float);
     /* Variant: string */
index 03aef97857f3836944a227e13efe90ebb8b22a07..3286127bb1b05aa1b3063d6f27e32ca6cacbaf44 100644 (file)
@@ -13,7 +13,7 @@
 /*
 Tag: list
 */
-tag list<T> {
+enum list<T> {
     /* Variant: cons */
     cons(T, @list<T>);
     /* Variant: nil */
index 9496f2febedc2adff05a977f6097419ebb4ceede..f7b3132b86d1fe461e11c70eb8ba9c5749170091 100644 (file)
@@ -112,7 +112,7 @@ mod chained {
         mutable next: chain<K, V>
     };
 
-    tag chain<K, V> {
+    enum chain<K, V> {
         present(@entry<K, V>);
         absent;
     }
@@ -124,7 +124,7 @@ mod chained {
         eqer: eqfn<K>
     };
 
-    tag search_result<K, V> {
+    enum search_result<K, V> {
         not_found;
         found_first(uint, @entry<K,V>);
         found_after(@entry<K,V>, @entry<K,V>);
index ba00ae649333cac93d8e3526d73624f5fefc1f22..e73eed27864521ebd001e1186d756eb710eaa04d 100644 (file)
@@ -12,7 +12,7 @@
 
 An IP address
 */
-tag ip_addr {
+enum ip_addr {
     /*
     Variant: ipv4
 
@@ -42,7 +42,7 @@ fn format_addr(ip: ip_addr) -> str {
 
 Convert a str to <ip_addr>
 
-Converts a string of the format "x.x.x.x" into an ip_addr tag.
+Converts a string of the format "x.x.x.x" into an ip_addr enum.
 
 Failure:
 
index 013e903f7e08824ad2da52f7c8b659db4d930a89..54d22dde3a2a311731e98e9927f7d017de385823 100644 (file)
@@ -585,7 +585,7 @@ mod node {
        empty   - An empty rope
        content - A non-empty rope
     */
-    tag root {
+    enum root {
         empty;
         content(@node);
     }
@@ -688,7 +688,7 @@ mod node {
     leaf - A leaf consisting in a `str`
     concat - The concatenation of two ropes
     */
-    tag node {
+    enum node {
         leaf(leaf);
         concat(concat);
     }
index 440ef272cedc452ac72aef720bf26d6cf4873abc..6131943c2fd77fd9476523159bc6fb7c381e2908 100644 (file)
@@ -84,7 +84,7 @@ fn parse_opts(args: [str]) : vec::is_not_empty(args) -> opt_res {
     ret either::left(test_opts);
 }
 
-tag test_result { tr_ok; tr_failed; tr_ignored; }
+enum test_result { tr_ok; tr_failed; tr_ignored; }
 
 // A simple console test runner
 fn run_tests_console(opts: test_opts,
@@ -186,7 +186,7 @@ fn write_pretty(out: io::writer, word: str, color: u8, use_color: bool) {
 
 fn use_color() -> bool { ret get_concurrency() == 1u; }
 
-tag testevent {
+enum testevent {
     te_filtered([test_desc]);
     te_wait(test_desc);
     te_result(test_desc, test_result);
index 14e9c30a83c95d77c2d6ba7ce25fe96c9adbf6ae..e5e6a433e2d82c8e110c112180a54ef765e1205a 100644 (file)
@@ -28,7 +28,7 @@
 /*
 Tag: tree_node
 */
-tag tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
+enum tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
 
 /* Section: Operations */
 
index 87c97fe35c96c80d0ce53afdcd195e319f651fd6..bca09fcf835acd17fcdac080602893a96df64817 100644 (file)
@@ -21,7 +21,7 @@ fn path_is_absolute(p: str) -> bool {
  * different semantics for each. Since we build on mingw, we are usually
  * dealing with /-separated paths. But the whole interface to splitting and
  * joining pathnames needs a bit more abstraction on win32. Possibly a vec or
- * tag type.
+ * enum type.
  */
 const path_sep: char = '/';