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 is_like_gt(&self) -> bool[src]
pub fn is_like_gt(&self) -> boolReturns true if the token starts with '>'.
pub fn can_begin_expr(&self) -> bool[src]
pub fn can_begin_expr(&self) -> boolReturns true if the token can appear at the start of an expression.
pub fn can_begin_type(&self) -> bool[src]
pub fn can_begin_type(&self) -> boolReturns true if the token can appear at the start of a type.
pub fn can_begin_bound(&self) -> bool[src]
pub fn can_begin_bound(&self) -> boolReturns true if the token can appear at the start of a generic bound.
pub fn is_lit(&self) -> bool[src]
pub fn is_lit(&self) -> boolReturns true if the token is any literal
pub fn can_begin_literal_or_bool(&self) -> bool[src]
pub fn can_begin_literal_or_bool(&self) -> boolReturns true if the token is any literal, a minus (which can follow a literal,
for example a '-42', or one of the boolean idents).
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_lifetime(&self) -> bool[src]
pub fn is_lifetime(&self) -> boolReturns true if the token is a lifetime.
pub fn is_ident_named(&self, name: &str) -> bool[src]
pub fn is_ident_named(&self, name: &str) -> boolReturns true if the token is a identifier whose name is the given
string slice.
pub fn is_doc_comment(&self) -> bool[src]
pub fn is_doc_comment(&self) -> boolReturns true if the token is a documentation comment.
pub fn is_interpolated(&self) -> bool[src]
pub fn is_interpolated(&self) -> boolReturns true if the token is interpolated.
pub fn is_path(&self) -> bool[src]
pub fn is_path(&self) -> boolReturns true if the token is an interpolated path.
pub fn is_mutability(&self) -> bool[src]
pub fn is_mutability(&self) -> boolReturns true if the token is either the mut or const keyword.
pub fn is_qpath_start(&self) -> bool[src]
pub fn is_qpath_start(&self) -> boolpub fn is_path_start(&self) -> bool[src]
pub fn is_path_start(&self) -> boolpub 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_used_keyword(&self) -> bool[src]
pub fn is_used_keyword(&self) -> boolReturns true if the token is a keyword used in the language.
pub fn is_unused_keyword(&self) -> bool[src]
pub fn is_unused_keyword(&self) -> boolReturns true if the token is a keyword reserved for possible future use.
pub 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 glue(self, joint: Token) -> Option<Token>[src]
pub fn glue(self, joint: Token) -> Option<Token>pub fn similar_tokens(&self) -> Option<Vec<Token>>[src]
pub fn similar_tokens(&self) -> Option<Vec<Token>>Returns tokens that are likely to be typed accidentally instead of the current token. Enables better error recovery when the wrong token is found.
pub fn interpolated_to_tokenstream(
&self,
sess: &ParseSess,
span: Span
) -> TokenStream[src]
pub fn interpolated_to_tokenstream(
&self,
sess: &ParseSess,
span: Span
) -> TokenStreampub fn probably_equal_for_proc_macro(&self, other: &Token) -> bool[src]
pub fn probably_equal_for_proc_macro(&self, other: &Token) -> boolTrait 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 Eq for Token[src]
impl Eq for Tokenimpl Hash for Token[src]
impl Hash for Tokenfn 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 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.