fix(lang-core): use last complete definition for duplicate IDs in streaming parser - #1140
Open
AbhinRustagi wants to merge 3 commits into
Open
AbhinRustagi wants to merge 3 commits into
AbhinRustagi wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rser-redefined-ids
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.
What
Fix streaming parsing of redefined statement IDs so the last complete definition replaces the previous one, matching the existing non-streaming behavior.
Closes #1127.
Previously,
parse()rendered"y"while the streaming parser rendered"x". Both now render"y", with or without a trailing newline.Changes and rationale
autoClose()can now overwrite an existing ID. This is what lets a complete final replacement take effect without a newline.autoClose()must supply missing quotes or brackets, the pending statement cannot overwrite a completed ID. For example, streaminga = Title("ykeeps the existingauntil the replacement is complete.preprocess()defaults to the original full trimming; only the streaming parser enables newline preservation. For example, non-streaming input ending with the unfinished stringroot = Title("hellofollowed by a newline still produces text"hello"withincomplete: true.@openuidev/lang-core.The rendered output now agrees for the duplicate-ID examples. The existing metadata difference remains:
statementCountcounts unique IDs in batch parsing but all definitions in streaming parsing (2 versus 3 in the example above).Test Plan
set(), trailing-newline, and incomplete-replacement cases.Checklist