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,
OpenDelim(DelimToken),
CloseDelim(DelimToken),
Literal(Lit, Option<Name>),
Ident(Ident),
Underscore,
Lifetime(Ident),
Interpolated(Lrc<(Nonterminal, LazyTokenStream)>),
DocComment(Name),
Whitespace,
Comment,
Shebang(Name),
Eof,
}Variants
EqLtLeEqEqNeGeGtAndAndOrOrNotTildeBinOp(BinOpToken)BinOpEq(BinOpToken)AtDotDotDotDotDotDotDotDotEqDotEqCommaSemiColonModSepRArrowLArrowFatArrowPoundDollarQuestionOpenDelim(DelimToken)An opening delimiter, eg. {
CloseDelim(DelimToken)A closing delimiter, eg. }
Literal(Lit, Option<Name>)Ident(Ident)UnderscoreLifetime(Ident)Interpolated(Lrc<(Nonterminal, LazyTokenStream)>)DocComment(Name)Doc comment
WhitespaceWhitespace
CommentComment
Shebang(Name)Eof
Methods
impl Token[src]
pub fn interpolated(nt: Nonterminal) -> Token[src]
pub fn is_like_gt(&self) -> bool[src]
Returns true if the token starts with '>'.
pub fn can_begin_expr(&self) -> bool[src]
Returns true if the token can appear at the start of an expression.
pub fn can_begin_type(&self) -> bool[src]
Returns true if the token can appear at the start of a type.
pub fn can_begin_bound(&self) -> bool[src]
Returns true if the token can appear at the start of a generic bound.
pub fn is_lit(&self) -> bool[src]
Returns true if the token is any literal
pub fn ident(&self) -> Option<Ident>[src]
pub fn is_ident(&self) -> bool[src]
Returns true if the token is an identifier.
pub fn is_doc_comment(&self) -> bool[src]
Returns true if the token is a documentation comment.
pub fn is_interpolated(&self) -> bool[src]
Returns true if the token is interpolated.
pub fn is_path(&self) -> bool[src]
Returns true if the token is an interpolated path.
pub fn lifetime(&self, span: Span) -> Option<Lifetime>[src]
Returns a lifetime with the span and a dummy id if it is a lifetime, or the original lifetime if it is an interpolated lifetime, ignoring the span.
pub fn is_lifetime(&self) -> bool[src]
Returns true if the token is a lifetime.
pub fn is_mutability(&self) -> bool[src]
Returns true if the token is either the mut or const keyword.
pub fn is_qpath_start(&self) -> bool[src]
pub fn is_path_start(&self) -> bool[src]
pub fn is_keyword(&self, kw: Keyword) -> bool[src]
Returns true if the token is a given keyword, kw.
pub fn is_path_segment_keyword(&self) -> bool[src]
pub fn is_special_ident(&self) -> bool[src]
pub fn is_used_keyword(&self) -> bool[src]
Returns true if the token is a keyword used in the language.
pub fn is_unused_keyword(&self) -> bool[src]
Returns true if the token is a keyword reserved for possible future use.
pub fn glue(self, joint: Token) -> Option<Token>[src]
pub fn similar_tokens(&self) -> Option<Vec<Token>>[src]
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 is_reserved_ident(&self) -> bool[src]
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]
&self,
sess: &ParseSess,
span: Span
) -> TokenStream
Trait Implementations
impl Clone for Token[src]
fn clone(&self) -> Token[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Encodable for Token[src]
impl Decodable for Token[src]
impl PartialEq for Token[src]
fn eq(&self, __arg_0: &Token) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Token) -> bool[src]
This method tests for !=.
impl Eq for Token[src]
impl Hash for Token[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
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]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for Token[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl From<Token> for TokenStream[src]
fn from(token: Token) -> TokenStream[src]
Performs the conversion.