Token in rustc_ast::token - Rust (original) (raw)

pub struct Token {
    pub kind: TokenKind,
    pub span: Span,
}

Source§

Source

Source

Some token that will be thrown away later.

Source

Recovers a Token from an Ident. This creates a raw identifier if necessary.

Source

Source

Source

Source

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

NB: Take care when modifying this function, since it will change the stable set of tokens that are allowed to match an expr nonterminal.

Source

Returns true if the token can appear at the start of a pattern.

Shamelessly borrowed from can_begin_expr, only used for diagnostics right now.

Source

Returns true if the token can appear at the start of a type.

Source

Returns true if the token can appear at the start of a const param.

Source

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

Source

Returns true if the token is any literal.

Source

Returns true if the token is any literal, a minus (which can prefix a literal, for example a ‘-42’, or one of the boolean idents).

In other words, would this token be a valid start of parse_literal_maybe_minus?

Keep this in sync with Lit::from_token and Parser::eat_token_lit(excluding unary negation).

Source

Source

A convenience function for matching on identifiers during parsing. Turns interpolated identifier ($i: ident) or lifetime ($l: lifetime) token into the regular identifier or lifetime token it refers to, otherwise returns the original token.

Source

Returns an identifier if this token is an identifier.

Source

Returns a lifetime identifier if this token is a lifetime.

Source

Returns true if the token is an identifier.

Source

Returns true if the token is a lifetime.

Source

Returns true if the token is an identifier whose name is the given string slice.

Source

Is this a pre-parsed expression dropped into the token stream (which happens while parsing the result of macro expansion)?

Source

Are we at a block from a metavar ($b:block)?

Source

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

Source

Source

Source

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

Source

Returns true if the token is a given keyword, kw or if case is Insensitive and this token is an identifier equal to kw ignoring the case.

Source

Source

Returns true for reserved identifiers used internally for elided lifetimes, unnamed method parameters, crate root module, error recovery etc.

Source

Returns true if the token is a keyword used in the language.

Source

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

Source

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

Source

Returns true if the token is the identifier true or false.

Source

Source

Returns true if the token is the integer literal.

Source

Returns true if the token is a non-raw identifier for which pred holds.

Source

Is this an invisible open delimiter at the start of a token sequence from an expanded metavar?

Source

§

§

§

§

§

§

§

§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes