about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-01-10 15:29:50 -0800
committerPatrick Walton <pcwalton@mimiga.net>2012-01-10 15:32:39 -0800
commitffdb7f97f8027ed18348f1b5069a000c79a1b0ca (patch)
treec5557fbe673e40dd69a581ef852a1afe07988beb
parent0fba2d02559e16c7b243aff60bb5c2cbeacf0e58 (diff)
downloadrust-ffdb7f97f8027ed18348f1b5069a000c79a1b0ca.tar.gz
rust-ffdb7f97f8027ed18348f1b5069a000c79a1b0ca.zip
rustc: Accept "enum" in addition to "tag"
-rw-r--r--src/comp/syntax/parse/parser.rs5
-rw-r--r--src/comp/syntax/print/pprust.rs4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 2025d8312c4..ca14bf6e870 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<str, ()> {
                  "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 b35ccc456d5..45eb37ca933 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);