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
EqLtLeEqEqNeGeGtAndAndOrOrNotTildeBinOp(BinOpToken)BinOpEq(BinOpToken)AtDotDotDotDotDotDotDotDotEqDotEqCommaSemiColonModSepRArrowLArrowFatArrowPoundDollarQuestionSingleQuoteUsed 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
WhitespaceWhitespace
CommentComment
Shebang(Name)Eof
Methods
impl Token[src]
impl Tokenpub fn interpolated(nt: Nonterminal) -> Token[src]
pub fn interpolated(nt: Nonterminal) -> Tokenpub fn from_ast_ident(ident: Ident) -> Token[src]
pub fn from_ast_ident(ident: Ident) -> TokenRecovers 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) -> boolReturns true if the token is an identifier.
pub fn is_keyword(&self, kw: Keyword) -> bool[src]
pub fn is_keyword(&self, kw: Keyword) -> boolReturns 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) -> boolpub fn is_special_ident(&self) -> bool[src]
pub fn is_special_ident(&self) -> boolpub fn is_reserved_ident(&self) -> bool[src]
pub fn is_reserved_ident(&self) -> boolReturns 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
) -> TokenStreamTrait Implementations
impl Clone for Token[src]
impl Clone for Tokenfn clone(&self) -> Token[src]
fn clone(&self) -> TokenReturns 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 Tokenimpl Decodable for Token[src]
impl Decodable for Tokenimpl PartialEq for Token[src]
impl PartialEq for Tokenfn eq(&self, other: &Token) -> bool[src]
fn eq(&self, other: &Token) -> boolThis 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) -> boolThis method tests for !=.
impl Debug for Token[src]
impl Debug for Tokenfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<Token> for TokenStream[src]
impl From<Token> for TokenStreamfn from(token: Token) -> TokenStream[src]
fn from(token: Token) -> TokenStreamPerforms the conversion.