Skip to content

demo: sync parser stepper with the dual-path parser#21

Merged
evoactivity merged 2 commits into
mainfrom
demo/sync-parser-stepper
Jul 19, 2026
Merged

demo: sync parser stepper with the dual-path parser#21
evoactivity merged 2 commits into
mainfrom
demo/sync-parser-stepper

Conversation

@evoactivity

Copy link
Copy Markdown
Owner

Audit of the visualiser's parser re-implementation after the recent parser work.

Findings

Behavior: still accurate. Ten probes against the current parse() confirmed every semantic the stepper depicts still holds: mismatched close tags throw even in non-strict mode, unclosed constructs recover by unwinding, CDATA matching is case-insensitive, comments drop unless keepComments, DOCTYPE internal subsets are skipped, PIs self-close, and whitespace-only text is dropped in element-only containers. (#15 was parity-gated and fuzzed against the old parser, so this was expected.)

Documentation: drifted. The stepper claimed to be "a direct copy of the real parser's parseChildren loop" — the default algorithm now lives in parseRootFast, with parseChildren as the general path. Every cross-reference pointed at line numbers in the old 744-line file layout.

Changes

  • Header rewritten: explains the two implementations of the one algorithm and the fast path's mechanical differences (deferred whitespace ranges, offset range-compare close-tag verification, inline name="value" shortcut)
  • All ~25 stale parser.ts line ~NNN references replaced with function + branch names that survive refactors
  • Whitespace step description now states the drop rule
  • Separate commit: fixes pre-existing pnpm lint failures on main in app-ssr.ts/entry.ts (import order, unrelated to the stepper)

Verified: stepper generates coherent steps across all 13 phases on a doc exercising PI/DOCTYPE/attrs/text/comment/CDATA/self-close, demo lint fully green, production build clean.

The stepper described itself as a direct copy of parseChildren, but the
default algorithm now lives in parseRootFast with parseChildren as the
general path. Behavior was verified unchanged against ten probes
(mismatch throws, unwind recoveries, CDATA case-insensitivity, DOCTYPE
subsets, PI handling, whitespace semantics), so the steps themselves
stay accurate. The header now explains the two implementations and the
fast path's mechanical differences, stale line-number cross-references
are replaced with function and branch names that survive refactors, and
the whitespace step description documents the drop rule.
pnpm lint failed on main for app-ssr.ts and entry.ts, unrelated to the
stepper change.
@evoactivity
evoactivity merged commit ee97c7a into main Jul 19, 2026
4 of 5 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant