From ffdb7f97f8027ed18348f1b5069a000c79a1b0ca Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 10 Jan 2012 15:29:50 -0800 Subject: [PATCH] rustc: Accept "enum" in addition to "tag" --- src/comp/syntax/parse/parser.rs | 5 +++-- src/comp/syntax/print/pprust.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 2025d8312c47..ca14bf6e8703 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -170,7 +170,8 @@ fn bad_expr_word_table() -> hashmap { "cont", "ret", "be", "fail", "type", "resource", "check", "assert", "claim", "native", "fn", "pure", "unsafe", "block", "import", "export", "let", "const", - "log", "tag", "obj", "copy", "sendfn", "impl", "iface"] { + "log", "tag", "obj", "copy", "sendfn", "impl", "iface", + "enum"] { words.insert(word, ()); } words @@ -2148,7 +2149,7 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> { ret some(parse_item_native_mod(p, attrs)); } if eat_word(p, "type") { ret some(parse_item_type(p, attrs)); - } else if eat_word(p, "tag") { + } else if eat_word(p, "tag") || eat_word(p, "enum") { ret some(parse_item_tag(p, attrs)); } else if is_word(p, "obj") && p.look_ahead(1u) != token::LPAREN { p.bump(); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index b35ccc456d52..45eb37ca9330 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -410,8 +410,8 @@ fn print_item(s: ps, &&item: @ast::item) { vec::len(variants[0].node.args) == 1u; if newtype { ibox(s, indent_unit); - word_space(s, "tag"); - } else { head(s, "tag"); } + word_space(s, "enum"); + } else { head(s, "enum"); } word(s.s, item.ident); print_type_params(s, params); space(s.s);