rokucommunity / rokucommunity/brighterscript

Missing many escape sequences in template strings

Open
#1,393 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Breaking Change bug parser transpiler
Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

BrighterScript is not properly handling all common escape sequences correctly. For example, the tab sequence \t is escaping to literal char code 116 which is the t character.

Image

We should support the same escape sequences as in javascript. Some of the sequences from that link are unnecessary due to how brightscript strings, so here's the revised list of what needs to be supported in brighterscript template strings:

Escape sequence Unicode code point
\0 null character (U+0000 NULL)
\\ backslash (U+005C REVERSE SOLIDUS)
\n newline (U+000A LINE FEED; LF)
\r carriage return (U+000D CARRIAGE RETURN; CR)
\v vertical tab (U+000B LINE TABULATION)
\t tab (U+0009 CHARACTER TABULATION)
\b backspace (U+0008 BACKSPACE)
\f form feed (U+000C FORM FEED)
\` backtick char (U+0060 UNICODE CHAR “`”)

Am I missing anything?

This is probably a breaking change, but I full expect that developers who typed \t intended to insert a tab, so we could probably just fix this in the v0 line with minimal risk.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the template-string escape handling in the TypeScript compiler and compare its behavior with the escape sequences listed in the issue. Done means each listed sequence produces its specified Unicode character, including the currently incorrect tab sequence, with coverage for the supported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.