diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-04 18:48:40 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-06 14:03:15 +0300 |
| commit | a3425edb46dfcc7031068b8bdda868e5a3b16ae1 (patch) | |
| tree | e62b7f6bd83cc5c3676e4df1f15b7c416667ca4a /src/libsyntax/parse/token.rs | |
| parent | 99b27d749c22117eccf862f5ee4eb540b65b681f (diff) | |
| download | rust-a3425edb46dfcc7031068b8bdda868e5a3b16ae1.tar.gz rust-a3425edb46dfcc7031068b8bdda868e5a3b16ae1.zip | |
syntax: Rename `TokenAndSpan` into `Token`
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index aa1e8fd060f..3679e4050ff 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -235,6 +235,12 @@ pub enum TokenKind { #[cfg(target_arch = "x86_64")] static_assert_size!(TokenKind, 16); +#[derive(Clone, Debug)] +pub struct Token { + pub kind: TokenKind, + pub span: Span, +} + impl TokenKind { /// Recovers a `TokenKind` from an `ast::Ident`. This creates a raw identifier if necessary. pub fn from_ast_ident(ident: ast::Ident) -> TokenKind { @@ -602,6 +608,12 @@ impl TokenKind { } } +impl PartialEq<TokenKind> for Token { + fn eq(&self, rhs: &TokenKind) -> bool { + self.kind == *rhs + } +} + #[derive(Clone, RustcEncodable, RustcDecodable)] /// For interpolation during macro expansion. pub enum Nonterminal { |
