提交 d77acf7d 编写于 作者: P Patrick Walton

libsyntax: Accept ',' to separate struct fields. Closes #3263.

上级 8ef45519
......@@ -2698,7 +2698,19 @@ fn parse_single_class_item(vis: visibility) -> @class_member {
!self.is_any_keyword(copy self.token)) &&
!self.token_is_pound_or_doc_comment(self.token) {
let a_var = self.parse_instance_var(vis);
self.expect(token::SEMI);
match self.token {
token::SEMI | token::COMMA => {
self.bump();
}
token::RBRACE => {}
_ => {
self.span_fatal(copy self.span,
fmt!("expected `;`, `,`, or '}' but \
found `%s`",
token_to_str(self.reader,
self.token)));
}
}
return a_var;
} else {
let m = self.parse_method(vis);
......
......@@ -646,7 +646,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
print_ident(s, ident);
word_nbsp(s, ~":");
print_type(s, field.node.ty);
word(s.s, ~";");
word(s.s, ~",");
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册