Skip to content

Respect relaxed indentation for quoted scalar continuations in block context - #53

Merged
bourumir-wyngs merged 1 commit into
bourumir-wyngs:masterfrom
fridokus:fix/non-strict-quoted-continuations
Nov 6, 2026
Merged

bourumir-wyngs merged 1 commit into
bourumir-wyngs:masterfrom
fridokus:fix/non-strict-quoted-continuations

Conversation

@fridokus

@fridokus fridokus commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

The default strict_indentation: false is meant to match PyYAML and ruamel.yaml, but under-indented quoted scalar continuations in block context were still rejected:

foo: "a
b"

PyYAML loads this as {'foo': 'a b'}; granit-parser reported InvalidQuotedScalarIndent.

Fix

Gate that check on strict_indentation, as the flow-context and escaped-line-break checks already are. All three now share one condition and differ only in error kind. Strict mode is unchanged.

Tests

  • Relaxed acceptance plus strict errors and positions for both quote styles, block mappings and sequences, nested and explicit keys, blank lines, CRLF, and all input backends. Every variant also matches PyYAML 6.0.3.
  • YAML-suite QB6E stays rejected in strict mode; relaxed mode now checks its events.
  • Both fail without the fix. cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic, and cargo test --all-features pass.

Prepared with GitHub Copilot.

fridokus added a commit to fridokus/granit-parser that referenced this pull request Nov 5, 2026
Apply the existing strict_indentation option consistently to quoted scalar continuations in block context. Default mode accepts under-indented content like PyYAML, while strict mode preserves its indentation errors, including at closing quotes.

Cover single and double quotes, nested mappings and sequences, blank lines, LF/CRLF, and every parser input backend. Keep the YAML suite strict expectation for QB6E and verify the relaxed event stream.

Upstream: bourumir-wyngs#53

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fridokus
fridokus force-pushed the fix/non-strict-quoted-continuations branch from d0cb3cc to 73783de Compare November 5, 2026 16:28
@codspeed

codspeed Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing fridokus:fix/non-strict-quoted-continuations (4bbeb82) with master (f8d30ef)

Open in CodSpeed

@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Default mode now accepts under-indented quoted scalar continuations in
block context, matching PyYAML and ruamel.yaml. Strict mode still rejects
them. The three strict quoted-scalar indentation checks now share one
condition and differ only in error kind.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fridokus
fridokus force-pushed the fix/non-strict-quoted-continuations branch from 73783de to 4bbeb82 Compare November 6, 2026 08:16
@bourumir-wyngs bourumir-wyngs added this to the 2.1.1 milestone Nov 6, 2026
@bourumir-wyngs

Copy link
Copy Markdown
Owner

Looks good. Thanks for contribution

@bourumir-wyngs
bourumir-wyngs merged commit 5eacd65 into bourumir-wyngs:master Nov 6, 2026
25 checks passed
@bourumir-wyngs bourumir-wyngs mentioned this pull request Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants