PureYAML/Sources/Parsing/LibYAML.ScannerError.swift
Mihaela Mihaljevic 9ce57e86e5 feat(parsing): port libyaml simple-key mechanism to Swift
Stage 2 of the faithful libyaml scanner port. Translates yaml_parser_save_simple_key, yaml_parser_remove_simple_key, yaml_parser_stale_simple_keys, and the flow-level push/pop (yaml_parser_increase_flow_level / decrease) onto a new PureYAML.Parsing.LibYAML.Scanner aggregate that embeds the indent engine. The simple-key mechanism is what lets a quoted scalar, a nested collection, or a property-carrying node become a mapping key when a ':' follows, and is required exactly at the block indent. Modelled faithfully: a potential key goes stale once it spans a line break or exceeds 1024 characters, and a required key that is removed or goes stale is the 'could not find expected colon' error. Unit-tested for the required/not-required, removal-error, staleness, and flow-level cases. No public behavior changed yet.
2026-06-24 02:55:07 +02:00

11 lines
402 B
Swift

extension PureYAML.Parsing.LibYAML {
/// A scanning error, mirroring libyaml's `yaml_parser_set_scanner_error`
/// (`context` plus `problem` at a mark). It is mapped to the package's public
/// `ParseError` when the port is integrated.
struct ScannerError: Swift.Error, Equatable {
var context: String
var problem: String
var mark: PureYAML.Parsing.Mark
}
}