Skip to content

Commit

Permalink
libsyntax: Accept ',' to separate struct fields. Closes #3263.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed Aug 25, 2012
1 parent 8ef4551 commit d77acf7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,19 @@ struct parser {
!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);
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ~",");
}
}
}
Expand Down

0 comments on commit d77acf7

Please sign in to comment.