#[non_exhaustive]pub enum SyntaxKind {
Show 36 variants
Whitespace = 0,
Bom,
LineComment,
BlockComment,
Ident,
Integer,
Float,
String,
RawString,
Char,
TrueKw,
FalseKw,
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
Colon,
Comma,
Hash,
Bang,
EnableKw,
LexError,
Root,
Struct,
StructField,
Tuple,
List,
Map,
MapEntry,
EnumVariant,
Unit,
Literal,
ExtensionAttr,
Error,
}Expand description
Closed classification of every CST node and token.
#[repr(u16)] with explicit, stable discriminants so the mapping to/from
rowan’s raw kind is total and order-independent. New variants MUST be added
before SyntaxKind::__Last and existing discriminants MUST NOT be
renumbered (the value is part of the on-tree representation).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Whitespace = 0
Run of ASCII/Unicode whitespace (spaces, tabs, newlines — CR and LF preserved verbatim).
Bom
A leading UTF-8 byte-order mark (\u{FEFF}), kept as trivia (AD-008).
LineComment
Line comment: // ... up to (but not including) the line break.
BlockComment
Block comment: /* ... */, nestable.
Ident
Bare identifier or struct/variant/field name (e.g. Foo, x).
Integer
Integer literal (any base, with optional _ separators / type suffix).
Float
Floating-point literal (with optional _ separators / type suffix).
String
Normal string literal "..." (with escapes), verbatim including quotes.
RawString
Raw string literal r#"..."#, verbatim including delimiters.
Char
Character literal 'c' (with escapes), verbatim including quotes.
TrueKw
The true keyword token.
FalseKw
The false keyword token.
LParen
(
RParen
)
LBracket
[
RBracket
]
LBrace
{
RBrace
}
Colon
:
Comma
,
Hash
#
Bang
!
EnableKw
enable keyword inside an extension attribute.
LexError
Any byte run the lexer could not classify (recovery sentinel token).
Always wrapped in an SyntaxKind::Error node by the parser.
Root
The document root node. Holds the single top-level value plus any leading extension attributes and surrounding trivia.
Struct
Named struct Name( field: value, ... ) or anonymous struct
( field: value, ... ).
StructField
A single field: value entry inside a SyntaxKind::Struct.
Tuple
Tuple / tuple-struct ( a, b, c ) (positional, no field names).
List
List / sequence [ a, b, c ].
Map
Map { k: v, ... } (keys may be non-string values).
MapEntry
A single key: value entry inside a SyntaxKind::Map.
EnumVariant
Enum variant: a bare Ident, or Ident(...) / Ident{...} payload.
Unit
Unit value ().
Literal
Wrapper around a scalar literal token so scalar values are uniform nodes.
ExtensionAttr
Extension attribute #![enable(ext, ...)]. Unknown extensions are still
preserved verbatim as text within this node.
Error
Recovery node wrapping unexpected/unparseable tokens so the tree still covers all input (TR-005/INV-3).
Implementations§
Trait Implementations§
Source§impl Clone for SyntaxKind
impl Clone for SyntaxKind
Source§fn clone(&self) -> SyntaxKind
fn clone(&self) -> SyntaxKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more