Skip to content

lang-core: accept triple-quoted strings - #1399

Closed
AbhinRustagi wants to merge 1 commit into
mainfrom
abhin/lang-core-triple-quotes
Closed

AbhinRustagi wants to merge 1 commit into
mainfrom
abhin/lang-core-triple-quotes

Conversation

@AbhinRustagi

Copy link
Copy Markdown
Contributor

Split out of #1385 so that PR can stay focused on the component library.

  • Models sometimes write multi-line code as Python-style """…""". Our lexer reads that as an empty string plus an open quote, so the snippet comes out garbled.
  • normalizeTripleQuotes rewrites those into normal JSON strings before lexing, in both parse and statement merging, and handles a half-streamed body.
  • Fixed a bug from the original version: an apostrophe in a comment (// here's the code) opened a fake string and silently emptied the next """ block. Comments are now passed through untouched.
  • Patch changeset for lang-core. Tests come over from react-ui: rework the genui component library and system prompt #1385; lang-core ci passes locally.

LLMs reach for Python-style """…""" for multi-line code. Rewrite them as
JSON string literals before lexing, in both parse and merge. Comments are
copied through untouched so an apostrophe in one can't open a fake string
and swallow the block that follows.

Split out of #1385.
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Oct 13, 2026 9:11am UTC

Request Review

AbhinRustagi added a commit that referenced this pull request Oct 13, 2026
Moved to #1399 so this PR stays on the component library.

This branch was successfully deployed

1 active deployment
Preview — eeec3171 Deployed Oct 13, 2026 by vercel[bot]
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.

1 participant