SIGN IN SIGN UP
oven-sh / bun UNCLAIMED

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

0 0 150 Rust

yaml: `---`/`...` only recognized at column 0 (closes #25660) (#31547)

## What

Per [203]/[204], `c-directives-end` (`---`) and `c-document-end` (`...`)
are line-starting tokens at column 0 followed by
`s-white`/`b-break`/EOF. Everywhere else `-` and `.` are `ns-plain-char`
per [126]/[130].

Bun was checking `line_indent == 0` — which is the *line's* indent, true
everywhere on a line that starts at column 0, not just at its start. So:

```yaml
name: some-text---
description: x
```

…was splitting into two documents (`---` at column 16 on a column-0 line
matched). Same for `a: ...`, `line: --- a/file`, `msg: wait...`, etc.

## How

New `Parser::is_at_line_start()` helper: prev byte is `\n`/`\r` or `pos
== 0`. Added to all 6 doc-marker checks (`scan()`, `scan_plain_scalar`,
block-scalar phase-2 — `0x2D` and `0x2E` arms each).

Also:
- `is_any_or_eof_at` returned `false` at EOF despite its name (Zig port
artifact). Only the 4 doc-marker checks call it; fixed to match its name
so `a\n---<EOF>` is a marker.
- `parse_block_sequence` now mirrors `parse_block_mapping`'s
`explicit_document_start_line` check, so `--- - x` is rejected (per
[200], a block collection after `---` requires `s-l-comments` first;
same-line content can only be a flow node).

## Tests

60-case `test.each` matrix covering position × column × follower × count
× scanner context (plain, `|`, `>`, quoted, flow) × real-world text
patterns (ellipsis, ranges, git-diff lines, frontmatter). Each row
verified against ≥2/3 of eemeli/yaml, js-yaml, PyYAML. 20/62 fail on
system Bun.

- 1978 pass / 0 fail / 10 todo
- 402/402 yaml-test-suite
- 1015/1015 4-parser consensus

Closes #25660.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
D
Dylan Conway committed
57d8e38a1c183f60bca08bb35026d3759b3a09c3
Parent: f3ccf76
Committed by GitHub <noreply@github.com> on 5/29/2026, 4:37:11 AM