Skip to content

feat: support $$ escape in string interpolation#1088

Closed
yinho999 wants to merge 2 commits into
rhaiscript:mainfrom
yinho999:enhancement/escape_str_interpolation
Closed

feat: support $$ escape in string interpolation#1088
yinho999 wants to merge 2 commits into
rhaiscript:mainfrom
yinho999:enhancement/escape_str_interpolation

Conversation

@yinho999

@yinho999 yinho999 commented May 8, 2026

Copy link
Copy Markdown
Contributor

This PR added $$ as an escape sequence inside backtick-string interpolation that emits a literal $.
For example, $${...} produces a literal ${...} instead of triggering interpolation.

Fixes #694

yinho999 added 2 commits May 8, 2026 17:40
`$$` is now an escape sequence inside backtick-string interpolation
that emits a literal `$`. As a result, `$${...}` produces a literal `${...}` instead of triggering interpolation.
@schungx

schungx commented May 9, 2026

Copy link
Copy Markdown
Collaborator

I would rather not make $$ special... instead, I've put together another version #1089 that uses \${...} to escape the ${...}.

This is consistent with JavaScript.

Standalone \$ does not do anything and still yields \$. Therefore it requires three characters in a row \${ to trigger, and unget one if the third one is not {.

I have moved your tests to the new version as well.

@yinho999 yinho999 closed this May 9, 2026
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.

Escape string interpolation

2 participants