Skip to content

fix(parser-js): don't track bracket depth inside template content lines#10

Merged
awli merged 2 commits into
mainfrom
fix/template-parens
Apr 23, 2026
Merged

fix(parser-js): don't track bracket depth inside template content lines#10
awli merged 2 commits into
mainfrom
fix/template-parens

Conversation

@awli
Copy link
Copy Markdown
Contributor

@awli awli commented Apr 22, 2026

Unmatched parentheses in template text (e.g. "(for example, questions such as 'Is it down?'") were incrementing bracketDepth, which suppressed INDENT/DEDENT emission and caused the template to absorb all subsequent sibling blocks.

Guard bracketDepth changes with !onTemplateLine — parens in template content are literal text, not structural delimiters.

Unmatched parentheses in template text (e.g. "(for example, questions
such as 'Is it down?'") were incrementing bracketDepth, which suppressed
INDENT/DEDENT emission and caused the template to absorb all subsequent
sibling blocks.

Guard bracketDepth changes with !onTemplateLine — parens in template
content are literal text, not structural delimiters.
@awli awli requested a review from Kamehameya April 22, 2026 19:53
break;
case TokenKind.RPAREN:
this.bracketDepth--;
if (!this.onTemplateLine) this.bracketDepth--;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Haa, I had to do something similar for LLMs producing incorrect JSON.

================
reasoning:
instructions: ->
| Use this topic if the user is asking (for example, questions such as 'Is it down?'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we add a test with full JSON?

Copy link
Copy Markdown
Member

@setu4993 setu4993 left a comment

Choose a reason for hiding this comment

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

Nice!

@awli awli merged commit b98c087 into main Apr 23, 2026
5 checks passed
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.

4 participants