demo: sync parser stepper with the dual-path parser#21
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 unlesskeepComments, 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, withparseChildrenas the general path. Every cross-reference pointed at line numbers in the old 744-line file layout.Changes
name="value"shortcut)parser.ts line ~NNNreferences replaced with function + branch names that survive refactorspnpm lintfailures on main inapp-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.