diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-01-19 14:24:03 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-01-19 14:24:03 -0800 |
| commit | bdb8f6cf52a2a4e2f78e6fa95d42140aa26ec31c (patch) | |
| tree | 0d0b55cfc904eeec0d4bf99bd92744ff81324b39 /src/comp/syntax | |
| parent | e6a7383a5f478b90b95556da25160ffee870b57d (diff) | |
| download | rust-bdb8f6cf52a2a4e2f78e6fa95d42140aa26ec31c.tar.gz rust-bdb8f6cf52a2a4e2f78e6fa95d42140aa26ec31c.zip | |
rustc: "tag" -> "enum"
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 72 | ||||
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/codemap.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 4 | ||||
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/comp/syntax/parse/token.rs | 4 | ||||
| -rw-r--r-- | src/comp/syntax/print/pp.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/visit.rs | 6 |
11 files changed, 60 insertions, 60 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 7449d8a53f8..a8bbf75aaa2 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -24,7 +24,7 @@ type def_id = {crate: crate_num, node: node_id}; const local_crate: crate_num = 0; const crate_node_id: node_id = 0; -tag ty_param_bound { +enum ty_param_bound { bound_copy; bound_send; bound_iface(@ty); @@ -32,7 +32,7 @@ tag ty_param_bound { type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]}; -tag def { +enum def { def_fn(def_id, purity); def_self(def_id); def_mod(def_id); @@ -40,7 +40,7 @@ tag def { def_const(def_id); def_arg(def_id, mode); def_local(def_id, let_style); - def_variant(def_id /* tag */, def_id /* variant */); + def_variant(def_id /* enum */, def_id /* variant */); def_ty(def_id); def_ty_param(def_id, uint); def_binding(def_id); @@ -62,13 +62,13 @@ type crate_ = attrs: [attribute], config: crate_cfg}; -tag crate_directive_ { +enum crate_directive_ { cdir_src_mod(ident, [attribute]); cdir_dir_mod(ident, [@crate_directive], [attribute]); // NB: cdir_view_item is *not* processed by the rest of the compiler; the // attached view_items are sunk into the crate's module during parsing, - // and processed (resolved, imported, etc.) there. This tag-variant exists + // and processed (resolved, imported, etc.) there. This enum-variant exists // only to preserve the view items in order in case we decide to // pretty-print crates in the future. cdir_view_item(@view_item); @@ -80,7 +80,7 @@ type crate_directive = spanned<crate_directive_>; type meta_item = spanned<meta_item_>; -tag meta_item_ { +enum meta_item_ { meta_word(ident); meta_list(ident, [@meta_item]); meta_name_value(ident, lit); @@ -95,12 +95,12 @@ type pat = {id: node_id, node: pat_, span: span}; type field_pat = {ident: ident, pat: @pat}; -tag pat_ { +enum pat_ { pat_wild; // A pat_ident may either be a new bound variable, - // or a nullary tag (in which case the second field + // or a nullary enum (in which case the second field // is none). - // In the nullary tag case, the parser can't determine + // In the nullary enum case, the parser can't determine // which it is. The resolver determines this, and // records this pattern's node_id in an auxiliary // set (of "pat_idents that refer to nullary tags") @@ -117,9 +117,9 @@ tag pat_ { pat_range(@expr, @expr); } -tag mutability { mut; imm; maybe_mut; } +enum mutability { mut; imm; maybe_mut; } -tag proto { +enum proto { proto_bare; // native fn proto_any; // fn proto_uniq; // fn~ @@ -134,7 +134,7 @@ pure fn is_blockish(p: ast::proto) -> bool { } } -tag binop { +enum binop { add; subtract; mul; @@ -156,17 +156,17 @@ tag binop { gt; } -tag unop { +enum unop { box(mutability); uniq(mutability); deref; not; neg; } -tag mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; } +enum mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; } type stmt = spanned<stmt_>; -tag stmt_ { +enum stmt_ { stmt_decl(@decl, node_id); // expr without trailing semi-colon (must have unit type): @@ -176,7 +176,7 @@ tag stmt_ { stmt_semi(@expr, node_id); } -tag init_op { init_assign; init_move; } +enum init_op { init_assign; init_move; } type initializer = {op: init_op, expr: @expr}; @@ -187,9 +187,9 @@ type local = spanned<local_>; type decl = spanned<decl_>; -tag let_style { let_copy; let_ref; } +enum let_style { let_copy; let_ref; } -tag decl_ { decl_local([(let_style, @local)]); decl_item(@item); } +enum decl_ { decl_local([(let_style, @local)]); decl_item(@item); } type arm = {pats: [@pat], guard: option::t<@expr>, body: blk}; @@ -197,13 +197,13 @@ type field_ = {mut: mutability, ident: ident, expr: @expr}; type field = spanned<field_>; -tag blk_check_mode { default_blk; unchecked_blk; unsafe_blk; } +enum blk_check_mode { default_blk; unchecked_blk; unsafe_blk; } -tag expr_check_mode { claimed_expr; checked_expr; } +enum expr_check_mode { claimed_expr; checked_expr; } type expr = {id: node_id, node: expr_, span: span}; -tag expr_ { +enum expr_ { expr_vec([@expr], mutability); expr_rec([field], option::t<@expr>); expr_call(@expr, [@expr], bool); @@ -267,7 +267,7 @@ type capture_clause = { /* // Says whether this is a block the user marked as // "unchecked" -tag blk_sort { +enum blk_sort { blk_unchecked; // declared as "exception to effect-checking rules" blk_checked; // all typing rules apply } @@ -275,7 +275,7 @@ tag blk_sort { type mac = spanned<mac_>; -tag mac_ { +enum mac_ { mac_invoc(@path, @expr, option::t<str>); mac_embed_type(@ty); mac_embed_block(blk); @@ -284,7 +284,7 @@ tag mac_ { type lit = spanned<lit_>; -tag lit_ { +enum lit_ { lit_str(str); lit_int(i64, int_ty); lit_uint(u64, uint_ty); @@ -303,15 +303,15 @@ type ty_field = spanned<ty_field_>; type ty_method = {ident: ident, decl: fn_decl, tps: [ty_param], span: span}; -tag int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; } +enum int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; } -tag uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; } +enum uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; } -tag float_ty { ty_f; ty_f32; ty_f64; } +enum float_ty { ty_f; ty_f32; ty_f64; } type ty = spanned<ty_>; -tag ty_ { +enum ty_ { ty_nil; ty_bot; /* return type of ! functions and type of ret/fail/break/cont. there is no syntax @@ -354,7 +354,7 @@ so that the typestate pass doesn't have to map a function name onto its decl. So, the constr_arg type is parameterized: it's instantiated with uint for declarations, and ident for uses. */ -tag constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); } +enum constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); } type fn_constr_arg = constr_arg_general_<uint>; type sp_constr_arg<T> = spanned<constr_arg_general_<T>>; @@ -389,13 +389,13 @@ type fn_decl = cf: ret_style, constraints: [@constr]}; -tag purity { +enum purity { pure_fn; // declared with "pure fn" unsafe_fn; // declared with "unsafe fn" impure_fn; // declared with "fn" } -tag ret_style { +enum ret_style { noreturn; // functions with return type _|_ that always // raise an error or exit (i.e. never return to the caller) return_val; // everything else @@ -406,7 +406,7 @@ type method = {ident: ident, tps: [ty_param], decl: fn_decl, body: blk, type _mod = {view_items: [@view_item], items: [@item]}; -tag native_abi { +enum native_abi { native_abi_rust_intrinsic; native_abi_cdecl; native_abi_stdcall; @@ -433,7 +433,7 @@ type import_ident_ = {name: ident, id: node_id}; type import_ident = spanned<import_ident_>; -tag view_item_ { +enum view_item_ { view_item_use(ident, [@meta_item], node_id); view_item_import(ident, @simple_path, node_id); view_item_import_glob(@simple_path, node_id); @@ -448,14 +448,14 @@ type attribute = spanned<attribute_>; // Distinguishes between attributes that decorate items and attributes that // are contained as statements within items. These two cases need to be // distinguished for pretty-printing. -tag attr_style { attr_outer; attr_inner; } +enum attr_style { attr_outer; attr_inner; } type attribute_ = {style: attr_style, value: meta_item}; type item = {ident: ident, attrs: [attribute], id: node_id, node: item_, span: span}; -tag item_ { +enum item_ { item_const(@ty, @expr); item_fn(fn_decl, [ty_param], blk); item_mod(_mod); @@ -476,7 +476,7 @@ type native_item = id: node_id, span: span}; -tag native_item_ { +enum native_item_ { native_item_ty; native_item_fn(fn_decl, [ty_param]); } diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 6e8de806348..b1513b24e24 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -201,7 +201,7 @@ fn ternary_to_if(e: @expr) -> @expr { // FIXME this doesn't handle big integer/float literals correctly (nor does // the rest of our literal handling) -tag const_val { +enum const_val { const_float(float); const_int(i64); const_uint(u64); diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index 3bedf018eb7..7844e9c197e 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -65,7 +65,7 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc { ret lookup_pos(map, pos, lookup); } -tag opt_span { +enum opt_span { //hack (as opposed to option::t), to make `span` compile os_none; diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 0dee29db0f9..bead9a5d85b 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -11,7 +11,7 @@ type macro_def = {ident: str, ext: syntax_extension}; type macro_definer = fn@(ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def; -tag syntax_extension { +enum syntax_extension { normal(syntax_expander); macro_defining(macro_definer); } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index a71bb650f3c..85d6d451810 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -25,10 +25,10 @@ fn path_to_ident(pth: @path) -> option::t<ident> { type clause = {params: binders, body: @expr}; /* logically, an arb_depth should contain only one kind of matchable */ -tag arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); } +enum arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); } -tag matchable { +enum matchable { match_expr(@expr); match_path(@path); match_ident(ast::spanned<ident>); diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 176e70cc65a..78cde98a9c5 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -510,7 +510,7 @@ fn next_token_inner(rdr: reader) -> token::token { } } -tag cmnt_style { +enum cmnt_style { isolated; // No code on either side of each line of the comment trailing; // Code exists to the left of the comment mixed; // Code before /* foo */ and after the comment diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index a5980465048..373b1f22a44 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -13,14 +13,14 @@ import front::attr; import lexer::reader; import driver::diagnostic; -tag restriction { +enum restriction { UNRESTRICTED; RESTRICT_STMT_EXPR; RESTRICT_NO_CALL_EXPRS; RESTRICT_NO_BAR_OP; } -tag file_type { CRATE_FILE; SOURCE_FILE; } +enum file_type { CRATE_FILE; SOURCE_FILE; } type parse_sess = @{ cm: codemap::codemap, @@ -147,7 +147,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> { "cont", "ret", "be", "fail", "type", "resource", "check", "assert", "claim", "native", "fn", "pure", "unsafe", "block", "import", "export", "let", "const", - "log", "copy", "sendfn", "impl", "iface", "enum"] { + "log", "copy", "sendfn", "impl", "iface", "tag", "enum"] { words.insert(word, ()); } words @@ -719,9 +719,9 @@ fn mk_lit_u32(p: parser, i: u32) -> @ast::expr { // parsing because `(while{...})+3` parses differently from `while{...}+3`. // // To reflect the fact that the @ast::expr is not a true expr that should be -// part of the AST, we wrap such expressions in the pexpr tag. They +// part of the AST, we wrap such expressions in the pexpr enum. They // can then be converted to true expressions by a call to `to_expr()`. -tag pexpr { +enum pexpr { pexpr(@ast::expr); } @@ -1508,7 +1508,7 @@ fn parse_pat(p: parser) -> @ast::pat { } _ { args = []; } } - // at this point, we're not sure whether it's a tag or a bind + // at this point, we're not sure whether it's a enum or a bind if vec::len(args) == 0u && vec::len(tag_path.node.idents) == 1u { pat = ast::pat_ident(tag_path, none); @@ -2026,7 +2026,7 @@ fn parse_item_tag(p: parser, attrs: [ast::attribute]) -> @ast::item { // Newtype syntax if p.token == token::EQ { if p.bad_expr_words.contains_key(id) { - p.fatal("found " + id + " in tag constructor position"); + p.fatal("found " + id + " in enum constructor position"); } p.bump(); let ty = parse_ty(p, false); diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs index e5dcc8b61f7..e1851d831b1 100644 --- a/src/comp/syntax/parse/token.rs +++ b/src/comp/syntax/parse/token.rs @@ -5,7 +5,7 @@ import lexer::reader; type str_num = uint; -tag binop { +enum binop { PLUS; MINUS; STAR; @@ -19,7 +19,7 @@ tag binop { ASR; } -tag token { +enum token { /* Expression-operator symbols. */ EQ; LT; diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index 455e9d916c9..4950af7b624 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -55,13 +55,13 @@ import io::writer_util; * line (which it can't) and so naturally place the content on its own line to * avoid combining it with other lines and making matters even worse. */ -tag breaks { consistent; inconsistent; } +enum breaks { consistent; inconsistent; } type break_t = {offset: int, blank_space: int}; type begin_t = {offset: int, breaks: breaks}; -tag token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; } +enum token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; } fn tok_str(t: token) -> str { alt t { @@ -91,7 +91,7 @@ fn buf_str(toks: [mutable token], szs: [mutable int], left: uint, right: uint, ret s; } -tag print_stack_break { fits; broken(breaks); } +enum print_stack_break { fits; broken(breaks); } type print_stack_elt = {offset: int, pbreak: print_stack_break}; diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index d666e0e3fab..3717dc83780 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -12,8 +12,8 @@ import pp::{break_offset, word, printer, import driver::diagnostic; // The ps is stored here to prevent recursive type. -// FIXME use a nominal tag instead -tag ann_node { +// FIXME use a nominal enum instead +enum ann_node { node_block(ps, ast::blk); node_item(ps, @ast::item); node_expr(ps, @ast::expr); @@ -565,7 +565,7 @@ fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: [ast::attribute]) { print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs); } -tag embed_type { block_macro; block_block_fn; block_normal; } +enum embed_type { block_macro; block_block_fn; block_normal; } fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type, indented: uint) { diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index bf544c09900..8f0f1f6f558 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -12,10 +12,10 @@ import codemap::span; // override the context), or prevent deeper traversal by doing nothing. // Our typesystem doesn't do circular types, so the visitor record can not -// hold functions that take visitors. A vt tag is used to break the cycle. -tag vt<E> { mk_vt(visitor<E>); } +// hold functions that take visitors. A vt enum is used to break the cycle. +enum vt<E> { mk_vt(visitor<E>); } -tag fn_kind { +enum fn_kind { fk_item_fn(ident, [ty_param]); //< an item declared with fn() fk_method(ident, [ty_param]); fk_res(ident, [ty_param]); |
