diff options
Diffstat (limited to 'src/libsyntax/ext/format.rs')
| -rw-r--r-- | src/libsyntax/ext/format.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 87cd61c9b22..1b12ae67ee5 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -91,7 +91,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool, // Parse the leading function expression (maybe a block, maybe a path) let invocation = if allow_method { let e = p.parse_expr(); - if !p.eat(&token::COMMA) { + if !p.eat(&token::Comma) { ecx.span_err(sp, "expected token: `,`"); return (Call(e), None); } @@ -99,28 +99,27 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool, } else { Call(p.parse_expr()) }; - if !p.eat(&token::COMMA) { + if !p.eat(&token::Comma) { ecx.span_err(sp, "expected token: `,`"); return (invocation, None); } - if p.token == token::EOF { + if p.token == token::Eof { ecx.span_err(sp, "requires at least a format string argument"); return (invocation, None); } let fmtstr = p.parse_expr(); let mut named = false; - while p.token != token::EOF { - if !p.eat(&token::COMMA) { + while p.token != token::Eof { + if !p.eat(&token::Comma) { ecx.span_err(sp, "expected token: `,`"); return (invocation, None); } - if p.token == token::EOF { break } // accept trailing commas - if named || (token::is_ident(&p.token) && - p.look_ahead(1, |t| *t == token::EQ)) { + if p.token == token::Eof { break } // accept trailing commas + if named || (p.token.is_ident() && p.look_ahead(1, |t| *t == token::Eq)) { named = true; let ident = match p.token { - token::IDENT(i, _) => { + token::Ident(i, _) => { p.bump(); i } @@ -139,7 +138,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool, }; let interned_name = token::get_ident(ident); let name = interned_name.get(); - p.expect(&token::EQ); + p.expect(&token::Eq); let e = p.parse_expr(); match names.find_equiv(&name) { None => {} |
