PureYAML/Sources/Parsing
Mihaela Mihaljevic f9fe2325f7 fix(parsing): reject raw control characters in parse(), matching libyaml
PureYAML.parse() silently accepted raw C0 control characters anywhere in
the input; Yams's underlying libyaml rejects them unconditionally at the
reader level. Found by comparing parse() directly against Yams on a
real-world OpenAPI corpus. The printable-character predicate this needed
already existed (CharacterClass.isPrintable, matching libyaml's
c-printable set) but was only ever wired into anchor-name validation, and
the separate PreflightScanner control-character check is opt-in via
validate(), not part of what parse() itself runs.

Reader now records the index of the first non-printable scalar as it
buffers input (covering both batch and streaming), and fetchNextToken()
throws once scanning has actually reached that position, not merely once
one exists, so an earlier real syntax error is not hidden behind a later
control character.

Verified with 5 new tests and a full re-run of the official yaml-test-suite
conformance (333/333 parse-level, 208/208 value-level, unchanged) and the
whole-suite streaming differential (still clean), confirming no regression.
2026-07-10 11:03:27 +02:00
..
BlockScalarChomping.swift fix(parsing): classify the keep block-scalar chomping indicator 2026-06-26 07:50:07 +02:00
BlockScalarStyle.swift feat(parsing): add reader scanner core 2026-06-05 07:40:23 +02:00
CollectionStyle.swift feat(parsing): add parse event model 2026-06-05 07:16:23 +02:00
Event.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
EventComposer.Merge.swift refactor(parsing): share merge-key resolution between composers 2026-06-26 05:50:28 +02:00
EventComposer.swift Merge conformance/yaml-test-suite-gaps: the libyaml port becomes the engine on main 2026-07-05 00:23:48 +02:00
EventStreamComposedNode.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
EventStreamComposer.Located.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
EventStreamComposer.swift Merge conformance/yaml-test-suite-gaps: the libyaml port becomes the engine on main 2026-07-05 00:23:48 +02:00
EventStreamComposerMode.swift refactor(code-style): one top-level type per source file 2026-06-26 06:14:21 +02:00
EventStreamContainer.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
EventStreamContainerKind.swift refactor(code-style): one top-level type per source file 2026-06-26 06:14:21 +02:00
LibYAML.CharacterClass.swift fix(parsing): treat flow '?' before a non-indicator as scalar content 2026-06-24 18:50:46 +02:00
LibYAML.IndentEngine.swift feat(parsing): add a resumable scanner increment and broaden the mutation suite 2026-07-09 23:38:39 +02:00
LibYAML.NodeProperties.swift feat(parsing): port libyaml parser state machine to Swift 2026-06-24 17:05:59 +02:00
LibYAML.Parser.Block.swift feat(parsing): parse block mappings with empty keys 2026-06-24 18:27:45 +02:00
LibYAML.Parser.Directives.swift feat(parsing): run the whole library on the ported engine 2026-06-24 18:02:22 +02:00
LibYAML.Parser.Document.swift fix(parsing): reject misplaced directives, refresh suite manifest 2026-06-24 19:51:39 +02:00
LibYAML.Parser.Flow.swift fix(parsing): parse a leading ':' flow-sequence entry as an empty-key pair 2026-06-24 19:07:04 +02:00
LibYAML.Parser.Helpers.swift feat(parsing): port libyaml parser state machine to Swift 2026-06-24 17:05:59 +02:00
LibYAML.Parser.Node.swift feat(parsing): exact scalar end positions in the located parse 2026-06-26 02:25:01 +02:00
LibYAML.Parser.swift feat(parsing): exact scalar end positions in the located parse 2026-06-26 02:25:01 +02:00
LibYAML.ParserError.swift feat(parsing): port libyaml parser state machine to Swift 2026-06-24 17:05:59 +02:00
LibYAML.ParserState.swift feat(parsing): port libyaml parser state machine to Swift 2026-06-24 17:05:59 +02:00
LibYAML.Reader.swift fix(parsing): reject raw control characters in parse(), matching libyaml 2026-07-10 11:03:27 +02:00
LibYAML.Scanner.Anchor.swift feat(parsing): accept full YAML 1.2 anchor and alias names 2026-06-24 18:11:58 +02:00
LibYAML.Scanner.BlockScalar.swift feat(parsing): add a resumable scanner increment and broaden the mutation suite 2026-07-09 23:38:39 +02:00
LibYAML.Scanner.Directive.swift fix(parsing): reject misplaced directives, refresh suite manifest 2026-06-24 19:51:39 +02:00
LibYAML.Scanner.Fetch.swift fix(parsing): reject raw control characters in parse(), matching libyaml 2026-07-10 11:03:27 +02:00
LibYAML.Scanner.FlowScalar.swift feat(parsing): add a resumable scanner increment and broaden the mutation suite 2026-07-09 23:38:39 +02:00
LibYAML.Scanner.Guards.swift feat(parsing): add a resumable scanner increment and broaden the mutation suite 2026-07-09 23:38:39 +02:00
LibYAML.Scanner.PlainScalar.swift feat(parsing): persist mid-token suspension and expose it as a public streaming API 2026-07-10 09:10:56 +02:00
LibYAML.Scanner.SkipToToken.swift feat(parsing): add a resumable scanner increment and broaden the mutation suite 2026-07-09 23:38:39 +02:00
LibYAML.Scanner.Streaming.swift feat(parsing): persist mid-token suspension and expose it as a public streaming API 2026-07-10 09:10:56 +02:00
LibYAML.Scanner.swift feat(parsing): persist mid-token suspension and expose it as a public streaming API 2026-07-10 09:10:56 +02:00
LibYAML.Scanner.Tag.swift feat(parsing): port libyaml tag scanner to Swift 2026-06-24 16:48:22 +02:00
LibYAML.ScannerError.swift feat(parsing): port libyaml simple-key mechanism to Swift 2026-06-24 02:55:07 +02:00
LibYAML.SimpleKey.swift fix(parsing): accept tabs as separation, reject them as indentation 2026-06-24 19:14:12 +02:00
LibYAML.swift feat(parsing): begin faithful libyaml scanner port (indent engine) 2026-06-24 02:46:29 +02:00
LibYAML.Token.swift feat(parsing): begin faithful libyaml scanner port (indent engine) 2026-06-24 02:46:29 +02:00
LibYAML.TokenType.swift feat(parsing): run the whole library on the ported engine 2026-06-24 18:02:22 +02:00
Mark.swift feat(parsing): add parse event model 2026-06-05 07:16:23 +02:00
MergeResolution.swift refactor(parsing): share merge-key resolution between composers 2026-06-26 05:50:28 +02:00
NodeKind.swift feat(parsing): parse token stream into events 2026-06-05 09:56:18 +02:00
ParseError.LibYAML.swift fix(parsing): reject raw control characters in parse(), matching libyaml 2026-07-10 11:03:27 +02:00
ParseError.swift fix(parsing): reject raw control characters in parse(), matching libyaml 2026-07-10 11:03:27 +02:00
Parser.Events.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
Parser.ScalarComposition.swift Merge conformance/yaml-test-suite-gaps: the libyaml port becomes the engine on main 2026-07-05 00:23:48 +02:00
Parser.swift feat(parsing): opt-in located parse on the hand-rolled engine 2026-06-29 07:14:42 +02:00
Reader.swift feat(parser): harden diagnostics and streaming 2026-06-06 07:57:48 +02:00
Scalar.swift fix(parsing): enforce the full YAML 1.2 double-quoted escape table 2026-06-27 16:19:25 +02:00
ScalarStyle.swift feat(parsing): compose events into values 2026-06-05 10:07:28 +02:00
TagNormalizer.swift feat(tagged): add tag-preserving validation 2026-06-05 15:35:52 +02:00
Text.swift feat(parsing): compose events into values 2026-06-05 10:07:28 +02:00