Skip to content

fix: unpaired apostrophe in JavaScript comments#370

Open
rtritto wants to merge 5 commits into
bgub:mainfrom
rtritto:fix-unpaired-apostrophe
Open

fix: unpaired apostrophe in JavaScript comments#370
rtritto wants to merge 5 commits into
bgub:mainfrom
rtritto:fix-unpaired-apostrophe

Conversation

@rtritto

@rtritto rtritto commented Jun 4, 2026

Copy link
Copy Markdown

Fix #337

Copilot AI review requested due to automatic review settings June 4, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the Eta template parser to recognize and skip JavaScript-style single-line (// ...) comments while scanning template code blocks, preventing premature tag-closing detection inside line comments.

Changes:

  • Extend the close-token regex to detect // comment starts.
  • Add logic to advance the parser index to the next line terminator when // is encountered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/parse.ts
@rtritto rtritto requested a review from Copilot June 4, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread src/parse.ts Outdated
Comment thread src/parse.ts Outdated
Comment thread src/parse.ts Outdated
@rtritto rtritto requested a review from Copilot June 4, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jayaddison

Copy link
Copy Markdown

@rtritto I think we'll want test coverage in parse.spec.ts to demonstrate the problem and confirm the fix.

Also: I am worried about edge cases such as open-close syntax elements (such as the apostrophe, double-quote, and so on) that themselves contain comments -- e.g. a string such as 'this is the start of the string and there is a comment /* here */ within it' -- or variants of that.

I'll try to find some time to explore other examples that might cause the parser to misinterpret the input; trying to find those should allow us to make the parser more robust.

@rtritto

rtritto commented Jun 5, 2026

Copy link
Copy Markdown
Author

@jayaddison add some test on parse.spec.ts

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.

Unpaired apostrophe in JavaScript comments causes "Unexpected token '%'" error in template parsing

3 participants