Add comments to TokenType
and Scanner
.
This commit is contained in:
parent
19bd49865f
commit
f2b5946008
1 changed files with 18 additions and 2 deletions
|
@ -147,15 +147,26 @@ pub enum TokenType {
|
||||||
FlowMappingStart,
|
FlowMappingStart,
|
||||||
/// End of an inline mapping.
|
/// End of an inline mapping.
|
||||||
FlowMappingEnd,
|
FlowMappingEnd,
|
||||||
|
/// An entry in a block sequence (c.f.: [`TokenType::BlockSequenceStart`]).
|
||||||
BlockEntry,
|
BlockEntry,
|
||||||
|
/// An entry in a flow sequence (c.f.: [`TokenType::FlowSequenceStart`]).
|
||||||
FlowEntry,
|
FlowEntry,
|
||||||
|
/// A key in a mapping.
|
||||||
Key,
|
Key,
|
||||||
|
/// A value in a mapping.
|
||||||
Value,
|
Value,
|
||||||
|
/// A reference to an anchor.
|
||||||
Alias(String),
|
Alias(String),
|
||||||
/// A YAML anchor (`&`/`*`).
|
/// A YAML anchor (`&`/`*`).
|
||||||
Anchor(String),
|
Anchor(String),
|
||||||
/// handle, suffix
|
/// A YAML tag (starting with bangs `!`).
|
||||||
Tag(String, String),
|
Tag(
|
||||||
|
/// The handle of the tag.
|
||||||
|
String,
|
||||||
|
/// The suffix of the tag.
|
||||||
|
String,
|
||||||
|
),
|
||||||
|
/// A regular YAML scalar.
|
||||||
Scalar(TScalarStyle, String),
|
Scalar(TScalarStyle, String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,10 +220,15 @@ struct Indent {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
pub struct Scanner<T> {
|
pub struct Scanner<T> {
|
||||||
|
/// The reader, providing with characters.
|
||||||
rdr: T,
|
rdr: T,
|
||||||
|
/// The position of the cursor within the reader.
|
||||||
mark: Marker,
|
mark: Marker,
|
||||||
|
/// Buffer for tokens to be read.
|
||||||
tokens: VecDeque<Token>,
|
tokens: VecDeque<Token>,
|
||||||
|
/// Buffer for the next characters to consume.
|
||||||
buffer: VecDeque<char>,
|
buffer: VecDeque<char>,
|
||||||
|
/// The last error that happened.
|
||||||
error: Option<ScanError>,
|
error: Option<ScanError>,
|
||||||
|
|
||||||
/// Whether we have already emitted the `StreamStart` token.
|
/// Whether we have already emitted the `StreamStart` token.
|
||||||
|
|
Loading…
Reference in a new issue