diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-24 02:04:56 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-06 14:01:57 +0300 |
| commit | eac3846b65b068a5cbdfafc786e258554b875dae (patch) | |
| tree | 7f8aeac93382bd664ac49d1791181cf6d659dcc3 /src/libsyntax/ext/tt | |
| parent | daf1ed0e98e75c64c3b883fd845b37bfa42358de (diff) | |
| download | rust-eac3846b65b068a5cbdfafc786e258554b875dae.tar.gz rust-eac3846b65b068a5cbdfafc786e258554b875dae.zip | |
Always use token kinds through `token` module rather than `Token` type
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 40 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 2 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 7b7cf80760f..473a5f414df 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -835,12 +835,12 @@ fn may_begin_with(name: Symbol, token: &Token) -> bool { sym::literal => token.can_begin_literal_or_bool(), sym::vis => match *token { // The follow-set of :vis + "priv" keyword + interpolated - Token::Comma | Token::Ident(..) | Token::Interpolated(_) => true, + token::Comma | token::Ident(..) | token::Interpolated(_) => true, _ => token.can_begin_type(), }, sym::block => match *token { - Token::OpenDelim(token::Brace) => true, - Token::Interpolated(ref nt) => match **nt { + token::OpenDelim(token::Brace) => true, + token::Interpolated(ref nt) => match **nt { token::NtItem(_) | token::NtPat(_) | token::NtTy(_) @@ -853,32 +853,32 @@ fn may_begin_with(name: Symbol, token: &Token) -> bool { _ => false, }, sym::path | sym::meta => match *token { - Token::ModSep | Token::Ident(..) => true, - Token::Interpolated(ref nt) => match **nt { + token::ModSep | token::Ident(..) => true, + token::Interpolated(ref nt) => match **nt { token::NtPath(_) | token::NtMeta(_) => true, _ => may_be_ident(&nt), }, _ => false, }, sym::pat => match *token { - Token::Ident(..) | // box, ref, mut, and other identifiers (can stricten) - Token::OpenDelim(token::Paren) | // tuple pattern - Token::OpenDelim(token::Bracket) | // slice pattern - Token::BinOp(token::And) | // reference - Token::BinOp(token::Minus) | // negative literal - Token::AndAnd | // double reference - Token::Literal(..) | // literal - Token::DotDot | // range pattern (future compat) - Token::DotDotDot | // range pattern (future compat) - Token::ModSep | // path - Token::Lt | // path (UFCS constant) - Token::BinOp(token::Shl) => true, // path (double UFCS) - Token::Interpolated(ref nt) => may_be_ident(nt), + token::Ident(..) | // box, ref, mut, and other identifiers (can stricten) + token::OpenDelim(token::Paren) | // tuple pattern + token::OpenDelim(token::Bracket) | // slice pattern + token::BinOp(token::And) | // reference + token::BinOp(token::Minus) | // negative literal + token::AndAnd | // double reference + token::Literal(..) | // literal + token::DotDot | // range pattern (future compat) + token::DotDotDot | // range pattern (future compat) + token::ModSep | // path + token::Lt | // path (UFCS constant) + token::BinOp(token::Shl) => true, // path (double UFCS) + token::Interpolated(ref nt) => may_be_ident(nt), _ => false, }, sym::lifetime => match *token { - Token::Lifetime(_) => true, - Token::Interpolated(ref nt) => match **nt { + token::Lifetime(_) => true, + token::Interpolated(ref nt) => match **nt { token::NtLifetime(_) | token::NtTT(_) => true, _ => false, }, diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index e6b49e61937..c2a1866b03a 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -225,7 +225,7 @@ pub fn transcribe( result.push(tt.clone().into()); } else { sp = sp.apply_mark(cx.current_expansion.mark); - let token = TokenTree::Token(sp, Token::Interpolated(nt.clone())); + let token = TokenTree::Token(sp, token::Interpolated(nt.clone())); result.push(token.into()); } } else { |
