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,
    Comma,
    Semi,
    Colon,
    ModSep,
    RArrow,
    LArrow,
    FatArrow,
    Pound,
    Dollar,
    Question,
    OpenDelim(DelimToken),
    CloseDelim(DelimToken),
    Literal(Lit, Option<Name>),
    Ident(Ident, IdentStyle),
    Underscore,
    Lifetime(Ident),
    Interpolated(Nonterminal),
    DocComment(Name),
    MatchNt(Ident, Ident, IdentStyle, IdentStyle),
    SubstNt(Ident, IdentStyle),
    SpecialVarNt(SpecialMacroVar),
    Whitespace,
    Comment,
    Shebang(Name),
    Eof,
}
Unstable

Variants

Eq
Unstable
Lt
Unstable
Le
Unstable
EqEq
Unstable
Ne
Unstable
Ge
Unstable
Gt
Unstable
AndAnd
Unstable
OrOr
Unstable
Not
Unstable
Tilde
Unstable
BinOp
Unstable
BinOpEq
Unstable
At
Unstable
Dot
Unstable
DotDot
Unstable
DotDotDot
Unstable
Comma
Unstable
Semi
Unstable
Colon
Unstable
ModSep
Unstable
RArrow
Unstable
LArrow
Unstable
FatArrow
Unstable
Pound
Unstable
Dollar
Unstable
Question
Unstable
OpenDelim
Unstable

An opening delimiter, eg. {

CloseDelim
Unstable

A closing delimiter, eg. }

Literal
Unstable
Ident
Unstable
Underscore
Unstable
Lifetime
Unstable
Interpolated
Unstable
DocComment
Unstable

Doc comment

MatchNt
Unstable

Parse a nonterminal (name to bind, name of NT, styles of their idents)

SubstNt
Unstable

A syntactic variable that will be filled in by macro expansion.

SpecialVarNt
Unstable

A macro variable with special meaning.

Whitespace
Unstable

Whitespace

Comment
Unstable

Comment

Shebang
Unstable
Eof
Unstable

Methods

impl Token

fn is_like_gt(&self) -> bool

Unstable

Returns true if the token starts with '>'.

fn can_begin_expr(&self) -> bool

Unstable

Returns true if the token can appear at the start of an expression.

fn is_lit(&self) -> bool

Unstable

Returns true if the token is any literal

fn is_ident(&self) -> bool

Unstable

Returns true if the token is an identifier.

fn is_path(&self) -> bool

Unstable

Returns true if the token is an interpolated path.

fn is_plain_ident(&self) -> bool

Unstable

Returns true if the token is a path that is not followed by a :: token.

fn is_lifetime(&self) -> bool

Unstable

Returns true if the token is a lifetime.

fn is_mutability(&self) -> bool

Unstable

Returns true if the token is either the mut or const keyword.

fn to_binop(&self) -> Option<BinOp_>

Unstable

Maps a token to its corresponding binary operator.

fn is_keyword(&self, kw: Keyword) -> bool

Unstable

Returns true if the token is a given keyword, kw.

fn is_keyword_allow_following_colon(&self, kw: Keyword) -> bool

Unstable

fn is_any_keyword(&self) -> bool

Unstable

Returns true if the token is either a special identifier, or a strict or reserved keyword.

fn is_strict_keyword(&self) -> bool

Unstable

Returns true if the token may not appear as an identifier.

fn is_reserved_keyword(&self) -> bool

Unstable

Returns true if the token is a keyword that has been reserved for possible future use.

fn mtwt_eq(&self, other: &Token) -> bool

Unstable

Hygienic identifier equality comparison.

See styntax::ext::mtwt.

Trait Implementations

Derived Implementations

impl Debug for Token

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Hash for Token

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Eq for Token

impl PartialEq for Token

fn eq(&self, __arg_0: &Token) -> bool

fn ne(&self, __arg_0: &Token) -> bool

impl Decodable for Token

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Token, __D>

impl Encodable for Token

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S>

impl Clone for Token

fn clone(&self) -> Token

fn clone_from(&mut self, source: &Self)