#[non_exhaustive]#[repr(u8)]pub enum SyntaxKind {
Show 39 variants
Stream = 0,
Document = 1,
BlockMapping = 2,
FlowMapping = 3,
FlowPair = 4,
BlockSequence = 5,
FlowSequence = 6,
Scalar = 7,
Alias = 8,
Error = 9,
PlainScalar = 10,
SingleQuotedScalar = 11,
DoubleQuotedScalar = 12,
LiteralScalar = 13,
FoldedScalar = 14,
AliasName = 15,
YamlDirective = 16,
TagDirective = 17,
ReservedDirective = 18,
DocumentStartMarker = 19,
DocumentEndMarker = 20,
StrayDocumentEndMarker = 21,
FlowMappingOpen = 22,
FlowMappingClose = 23,
FlowSequenceOpen = 24,
FlowSequenceClose = 25,
ByteOrderMark = 26,
Whitespace = 27,
LineBreak = 28,
Comment = 29,
SequenceEntry = 30,
MappingKey = 31,
MappingValue = 32,
FlowEntry = 33,
Anchor = 34,
Tag = 35,
BlockScalarHeader = 36,
ErrorText = 37,
Skipped = 38,
}Expand description
The kind of a syntax tree element: an interior node or a leaf
token (SyntaxKind::is_token).
Tokens cover source bytes, and in document order they tile the source:
every byte belongs to exactly one token. A token may be
zero-width only when it is the text of an empty scalar
(SyntaxKind::PlainScalar) or the text of an SyntaxKind::Error
that points at a position (SyntaxKind::ErrorText). Nodes cover the
bytes of their tokens; a node’s span runs from its first token to its
last.
Stored as one byte per element.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Stream = 0
The whole input (l-yaml-stream, production 211); always the root.
Holds documents and the bytes between them: byte order marks,
comments, blank lines, stray ... markers.
Document = 1
One document (productions 206-210): its directives, its --- and
... markers when written, the trivia between them and the root,
and the root node. Trivia after an implicitly ended document belongs
to the SyntaxKind::Stream (event contract C4, “ends early”).
BlockMapping = 2
A block mapping (production 187): its properties, then keys, values,
?/: indicators and the trivia between them, flat.
FlowMapping = 3
A flow mapping { … } (production 140).
FlowPair = 4
A single-pair mapping inside a flow sequence, [ a: b ]
(productions 150-151).
BlockSequence = 5
A block sequence (production 183): - indicators, entries, and the
trivia between them, flat.
FlowSequence = 6
A flow sequence [ … ] (production 137).
Scalar = 7
A scalar node: its properties (and block scalar header), then exactly one scalar text token, always its last child.
Alias = 8
An alias node: exactly one SyntaxKind::AliasName token.
Error = 9
A syntax error (event contract C6): exactly one
SyntaxKind::ErrorText token. Read-only for the edit layer; the
bytes skipped while resynchronising follow it as
SyntaxKind::Skipped tokens.
PlainScalar = 10
A plain scalar’s text (may be zero-width: an empty node).
SingleQuotedScalar = 11
A single-quoted scalar’s text, quotes included.
DoubleQuotedScalar = 12
A double-quoted scalar’s text, quotes included.
LiteralScalar = 13
A literal block scalar’s content lines (header excluded, C5).
FoldedScalar = 14
A folded block scalar’s content lines (header excluded, C5).
AliasName = 15
*name.
YamlDirective = 16
A %YAML directive.
TagDirective = 17
A %TAG directive.
ReservedDirective = 18
A reserved directive.
DocumentStartMarker = 19
--- of an explicit document start.
DocumentEndMarker = 20
... ending a document.
StrayDocumentEndMarker = 21
... that ends no document (e.g. at the start of a stream).
FlowMappingOpen = 22
{.
FlowMappingClose = 23
}.
FlowSequenceOpen = 24
[.
FlowSequenceClose = 25
].
ByteOrderMark = 26
U+FEFF between documents.
Whitespace = 27
A run of spaces and/or tabs.
LineBreak = 28
One line break (\n, \r\n, or \r).
Comment = 29
# to the end of the line.
SequenceEntry = 30
- block sequence entry indicator.
MappingKey = 31
? mapping key indicator.
MappingValue = 32
: mapping value indicator.
FlowEntry = 33
, flow entry separator.
Anchor = 34
&name anchor property.
Tag = 35
A tag property.
BlockScalarHeader = 36
A block scalar header (|, >-, |2+, …).
ErrorText = 37
The offending bytes of an SyntaxKind::Error (may be zero-width).
Skipped = 38
One line of bytes skipped while resynchronising after an error.
Implementations§
Source§impl SyntaxKind
impl SyntaxKind
Sourcepub const fn is_trivia(self) -> bool
pub const fn is_trivia(self) -> bool
true for presentation-only tokens that carry no meaning: white
space, line breaks, comments, and byte order marks.
Sourcepub const fn is_yaml_node(self) -> bool
pub const fn is_yaml_node(self) -> bool
true for the node kinds that hold a YAML node’s content: mappings,
sequences, scalars, and aliases.