rokucommunity / rokucommunity/brighterscript
Missing many escape sequences in template strings
Nobody has claimed this yet.
- 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.
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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