yamleam/lexer
YAML lexer — line-oriented, block-style.
Splits the source into lines, drops blank/comment-only lines, and
tokenizes each remaining line into a Line(indent, line_number, tokens).
The parser consumes the resulting List(Line) using indent comparison.
v0.2 additions:
- Literal block scalars (
|) with chomping indicators (|,|-,|+). When the lexer sees|at end-of-line position, it reads continuation lines from the source until indent returns to the parent level, then emits aQuotedScalartoken containing the joined block content with chomping applied.
v0.1 limitations still in force:
- Multi-line quoted strings rejected (single- and double-quoted strings must open and close on the same source line)
- Tabs in indentation rejected
- Flow-style markers (
[,],{,}), anchors (&,*), folded scalars (>), tags (!) all returnUnsupportederrors with the version they’re targeted for
Values
pub fn tokenize(
source: String,
) -> Result(List(token.Line), error.YamlError)
Tokenize a YAML source string into a list of logical lines.