Skip to content

Commit ffdb7f9

Browse files
committed
rustc: Accept "enum" in addition to "tag"
1 parent 0fba2d0 commit ffdb7f9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/comp/syntax/parse/parser.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
170170
"cont", "ret", "be", "fail", "type", "resource", "check",
171171
"assert", "claim", "native", "fn", "pure",
172172
"unsafe", "block", "import", "export", "let", "const",
173-
"log", "tag", "obj", "copy", "sendfn", "impl", "iface"] {
173+
"log", "tag", "obj", "copy", "sendfn", "impl", "iface",
174+
"enum"] {
174175
words.insert(word, ());
175176
}
176177
words
@@ -2148,7 +2149,7 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> {
21482149
ret some(parse_item_native_mod(p, attrs));
21492150
} if eat_word(p, "type") {
21502151
ret some(parse_item_type(p, attrs));
2151-
} else if eat_word(p, "tag") {
2152+
} else if eat_word(p, "tag") || eat_word(p, "enum") {
21522153
ret some(parse_item_tag(p, attrs));
21532154
} else if is_word(p, "obj") && p.look_ahead(1u) != token::LPAREN {
21542155
p.bump();

src/comp/syntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ fn print_item(s: ps, &&item: @ast::item) {
410410
vec::len(variants[0].node.args) == 1u;
411411
if newtype {
412412
ibox(s, indent_unit);
413-
word_space(s, "tag");
414-
} else { head(s, "tag"); }
413+
word_space(s, "enum");
414+
} else { head(s, "enum"); }
415415
word(s.s, item.ident);
416416
print_type_params(s, params);
417417
space(s.s);

0 commit comments

Comments
 (0)