Rollup merge of #103598 - tshepang:token-kind-docs, r=jackh726
rustc_lexer::TokenKind improve docs
This commit is contained in:
commit
132883e455
@ -57,29 +57,42 @@ pub enum TokenKind {
|
|||||||
// Multi-char tokens:
|
// Multi-char tokens:
|
||||||
/// "// comment"
|
/// "// comment"
|
||||||
LineComment { doc_style: Option<DocStyle> },
|
LineComment { doc_style: Option<DocStyle> },
|
||||||
|
|
||||||
/// `/* block comment */`
|
/// `/* block comment */`
|
||||||
///
|
///
|
||||||
/// Block comments can be recursive, so the sequence like `/* /* */`
|
/// Block comments can be recursive, so a sequence like `/* /* */`
|
||||||
/// will not be considered terminated and will result in a parsing error.
|
/// will not be considered terminated and will result in a parsing error.
|
||||||
BlockComment { doc_style: Option<DocStyle>, terminated: bool },
|
BlockComment { doc_style: Option<DocStyle>, terminated: bool },
|
||||||
/// Any whitespace characters sequence.
|
|
||||||
|
/// Any whitespace character sequence.
|
||||||
Whitespace,
|
Whitespace,
|
||||||
|
|
||||||
/// "ident" or "continue"
|
/// "ident" or "continue"
|
||||||
/// At this step keywords are also considered identifiers.
|
///
|
||||||
|
/// At this step, keywords are also considered identifiers.
|
||||||
Ident,
|
Ident,
|
||||||
|
|
||||||
/// Like the above, but containing invalid unicode codepoints.
|
/// Like the above, but containing invalid unicode codepoints.
|
||||||
InvalidIdent,
|
InvalidIdent,
|
||||||
|
|
||||||
/// "r#ident"
|
/// "r#ident"
|
||||||
RawIdent,
|
RawIdent,
|
||||||
/// An unknown prefix like `foo#`, `foo'`, `foo"`. Note that only the
|
|
||||||
|
/// An unknown prefix, like `foo#`, `foo'`, `foo"`.
|
||||||
|
///
|
||||||
|
/// Note that only the
|
||||||
/// prefix (`foo`) is included in the token, not the separator (which is
|
/// prefix (`foo`) is included in the token, not the separator (which is
|
||||||
/// lexed as its own distinct token). In Rust 2021 and later, reserved
|
/// lexed as its own distinct token). In Rust 2021 and later, reserved
|
||||||
/// prefixes are reported as errors; in earlier editions, they result in a
|
/// prefixes are reported as errors; in earlier editions, they result in a
|
||||||
/// (allowed by default) lint, and are treated as regular identifier
|
/// (allowed by default) lint, and are treated as regular identifier
|
||||||
/// tokens.
|
/// tokens.
|
||||||
UnknownPrefix,
|
UnknownPrefix,
|
||||||
/// "12_u8", "1.0e-40", "b"123"". See `LiteralKind` for more details.
|
|
||||||
|
/// Examples: `"12_u8"`, `"1.0e-40"`, `b"123`.
|
||||||
|
///
|
||||||
|
/// See [LiteralKind] for more details.
|
||||||
Literal { kind: LiteralKind, suffix_start: u32 },
|
Literal { kind: LiteralKind, suffix_start: u32 },
|
||||||
|
|
||||||
/// "'a"
|
/// "'a"
|
||||||
Lifetime { starts_with_number: bool },
|
Lifetime { starts_with_number: bool },
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user