stdlib: "tag" -> "enum"

This commit is contained in:
Patrick Walton 2012-01-19 15:20:57 -08:00
parent 7e21be5304
commit c5a407b11b
15 changed files with 39 additions and 39 deletions

View File

@ -37,12 +37,12 @@ export ptr;
/*
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});
}

View File

@ -241,9 +241,9 @@ mod tests {
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);
}

View 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.

View File

@ -39,9 +39,9 @@ import option::{some, none};
// 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 @@ mod ct {
// 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 @@ mod rt {
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 {

View File

@ -31,7 +31,7 @@ type treemap<K, V> = @tree_node<K, V>;
/*
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>);
}

View File

@ -65,11 +65,11 @@ export opt_strs;
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 @@ Type: fail_
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 @@ tag fail_ {
/*
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_;

View File

@ -17,7 +17,7 @@ native mod rustrt {
// 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;

View File

@ -23,7 +23,7 @@ Tag: json
Represents a json value.
*/
tag json {
enum json {
/* Variant: num */
num(float);
/* Variant: string */

View File

@ -13,7 +13,7 @@ import option::{some, none};
/*
Tag: list
*/
tag list<T> {
enum list<T> {
/* Variant: cons */
cons(T, @list<T>);
/* Variant: nil */

View 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>);

View File

@ -12,7 +12,7 @@ Tag: ip_addr
An IP address
*/
tag ip_addr {
enum ip_addr {
/*
Variant: ipv4
@ -42,7 +42,7 @@ Function: parse_addr
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:

View 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);
}

View 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 run_tests_console(opts: test_opts,
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);

View File

@ -28,7 +28,7 @@ type treemap<K, V> = @mutable tree_node<K, V>;
/*
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 */

View 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 = '/';