Enum syntax::parse::token::Token [−][src]
pub enum Token { Eq, Lt, Le, EqEq, Ne, Ge, Gt, AndAnd, OrOr, Not, Tilde, BinOp(BinOpToken), BinOpEq(BinOpToken), At, Dot, DotDot, DotDotDot, DotDotEq, DotEq, Comma, Semi, Colon, ModSep, RArrow, LArrow, FatArrow, Pound, Dollar, Question, SingleQuote, OpenDelim(DelimToken), CloseDelim(DelimToken), Literal(Lit, Option<Name>), Ident(Ident, bool), Lifetime(Ident), Interpolated(Lrc<(Nonterminal, LazyTokenStream)>), DocComment(Name), Whitespace, Comment, Shebang(Name), Eof, }
Variants
Eq
Lt
Le
EqEq
Ne
Ge
Gt
AndAnd
OrOr
Not
Tilde
BinOp(BinOpToken)
BinOpEq(BinOpToken)
At
Dot
DotDot
DotDotDot
DotDotEq
DotEq
Comma
Semi
Colon
ModSep
RArrow
LArrow
FatArrow
Pound
Dollar
Question
SingleQuote
Used by proc macros for representing lifetimes, not generated by lexer right now.
OpenDelim(DelimToken)
An opening delimiter, eg. {
CloseDelim(DelimToken)
A closing delimiter, eg. }
Literal(Lit, Option<Name>)
Ident(Ident, bool)
Lifetime(Ident)
Interpolated(Lrc<(Nonterminal, LazyTokenStream)>)
DocComment(Name)
Doc comment
Whitespace
Whitespace
Comment
Comment
Shebang(Name)
Eof
Methods
impl Token
[src]
impl Token
pub fn interpolated(nt: Nonterminal) -> Token
[src]
pub fn interpolated(nt: Nonterminal) -> Token
pub fn from_ast_ident(ident: Ident) -> Token
[src]
pub fn from_ast_ident(ident: Ident) -> Token
Recovers a Token
from an ast::Ident
. This creates a raw identifier if necessary.
pub fn ident(&self) -> Option<(Ident, bool)>
[src]
pub fn ident(&self) -> Option<(Ident, bool)>
Returns an identifier if this token is an identifier.
pub fn lifetime(&self) -> Option<Ident>
[src]
pub fn lifetime(&self) -> Option<Ident>
Returns a lifetime identifier if this token is a lifetime.
pub fn is_ident(&self) -> bool
[src]
pub fn is_ident(&self) -> bool
Returns true
if the token is an identifier.
pub fn is_keyword(&self, kw: Keyword) -> bool
[src]
pub fn is_keyword(&self, kw: Keyword) -> bool
Returns true
if the token is a given keyword, kw
.
pub fn is_path_segment_keyword(&self) -> bool
[src]
pub fn is_path_segment_keyword(&self) -> bool
pub fn is_special_ident(&self) -> bool
[src]
pub fn is_special_ident(&self) -> bool
pub fn is_reserved_ident(&self) -> bool
[src]
pub fn is_reserved_ident(&self) -> bool
Returns true
if the token is either a special identifier or a keyword.
pub fn interpolated_to_tokenstream(
&self,
sess: &ParseSess,
span: Span
) -> TokenStream
[src]
pub fn interpolated_to_tokenstream(
&self,
sess: &ParseSess,
span: Span
) -> TokenStream
Trait Implementations
impl Clone for Token
[src]
impl Clone for Token
fn clone(&self) -> Token
[src]
fn clone(&self) -> Token
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Encodable for Token
[src]
impl Encodable for Token
impl Decodable for Token
[src]
impl Decodable for Token
impl PartialEq for Token
[src]
impl PartialEq for Token
fn eq(&self, other: &Token) -> bool
[src]
fn eq(&self, other: &Token) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Token) -> bool
[src]
fn ne(&self, other: &Token) -> bool
This method tests for !=
.
impl Eq for Token
[src]
impl Eq for Token
impl Hash for Token
[src]
impl Hash for Token
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Token
[src]
impl Debug for Token
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl From<Token> for TokenStream
[src]
impl From<Token> for TokenStream
fn from(token: Token) -> TokenStream
[src]
fn from(token: Token) -> TokenStream
Performs the conversion.