Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Allow macros in identifier position #14266

Closed
wants to merge 10 commits into from
Prev Previous commit
parser: Parse macro fields
  • Loading branch information
bgamari committed May 18, 2014
commit 2bebe8549bc999b901d87cf847288630f62ec3be
15 changes: 15 additions & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
@@ -2020,6 +2020,21 @@ impl<'a> Parser<'a> {
// expr.f
if self.eat(&token::DOT) {
match self.token {
token::LPAREN => {
let es = self.parse_unspanned_seq(
&token::LPAREN,
&token::RPAREN,
seq_sep_none(),
|p| p.parse_ident_or_macro()
);
if es.len() == 1 {
let i = *es.get(0);
let field = self.mk_field(e, i, Vec::new());
e = self.mk_expr(self.span.lo, self.span.hi, field)
} else {
fail!("uh oh");
}
}
token::IDENT(i, _) => {
let dot = self.last_span.hi;
hi = self.span.hi;