diff options
| author | bors <bors@rust-lang.org> | 2014-10-29 10:22:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-10-29 10:22:01 +0000 |
| commit | 3bc545373df4c81ba223a8bece14cbc27eb85a4d (patch) | |
| tree | 6f2bc6000e1b8b10a1a74aedc57fa9d1f0fc565b /src/libsyntax/ext/format.rs | |
| parent | 124508dea1caf213886e5e1a02d425cac8dd0b54 (diff) | |
| parent | 665ad9c175f746b78c7eae81432b543d2e16c3c9 (diff) | |
| download | rust-3bc545373df4c81ba223a8bece14cbc27eb85a4d.tar.gz rust-3bc545373df4c81ba223a8bece14cbc27eb85a4d.zip | |
auto merge of #18365 : bjz/rust/token, r=alexcrichton
[breaking-change]
(for syntax-extensions)
- Token variant identifiers have been converted to PascalCase for consistency with Rust coding standards
- Some free-functions in `syntax::token` have been converted to methods on `syntax::token::Token`:
- `can_begin_expr` -> `Token::can_begin_expr`
- `close_delimiter_for` -> `Token::get_close_delimiter`
- `is_lit` -> `Token::is_lit`
- `is_ident` -> `Token::is_ident`
- `is_path` -> `Token::is_path`
- `is_plain_ident` -> `Token::is_plain_ident`
- `is_lifetime` -> `Token::is_lifetime`
- `is_mutability` -> `Token::is_mutability`
- `to_binop` -> `Token::to_binop`
- `is_keyword` -> `Token::is_keyword`
- `is_any_keyword` -> `Token:is_any_keyword`
- `is_strict_keyword` -> `Token::is_strict_keyword`
- `is_reserved_keyword` -> `Token::is_reserved_keyword`
- `mtwt_token_eq` -> `Token::mtwt_eq`
- `token::Ident` now takes an enum instead of a boolean for clarity
- `token::{to_string, binop_to_string}` were moved to `pprust::{token_to_string, binop_to_string}`
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 => {} |
