Expand description
TOOLSET.md parse pipeline.
The public entry point is parse_toolset. It reads TOOLSET.md from the given
toolset directory, splits the YAML frontmatter, drives the bounded iterative-event
parse, validates all fields, and returns a typed Toolset.
§Parse pipeline
- Read
TOOLSET.md(256 KiB size cap before parse). - UTF-8 decode (non-UTF-8 →
NotUtf8; never a panic). - Split the leading
----fenced frontmatter. - Drive the yaml-rust2 ITERATIVE event pull loop over the frontmatter string.
- Each event is pulled one at a time via
Parser::next_token()— the parser’s state machine uses an explicit heap stack; there is no C-stack recursion on the pull path (onlyParser::loadis C-stack recursive; we do not call it). - Reject YAML anchors/aliases at the event level (pre-expansion).
- Track nesting depth (both BLOCK and FLOW); exceed 8 →
FrontmatterTooDeep. Because we stop pulling events the instant depth > MAX_DEPTH, C-stack depth stays O(1) for any nesting; scanner heap is bounded by the 256 KiB file cap (a single-line flow document may buffer up to the capped input as tokens — finite, no OOM/overflow — before the depth bound fires). - Track keys at each mapping level; duplicate →
DuplicateKey.
- Each event is pulled one at a time via
- Map the event stream to a
Frontmatterstruct. - Validate
name/description/compatibility. - Extract and parse the capability manifest.
- Return
Toolsetor the firstToolsetFormatError.
Structs§
- Toolset
- A parsed and validated toolset.
Functions§
- parse_
toolset - Parse and validate a toolset directory.