Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/TSHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ export class TSHelper {
const escapeSequences: Array<[RegExp, string]> = [
[/[\\]/g, "\\\\"],
[/[\']/g, "\\\'"],
[/[\`]/g, "\\\`"],
[/[\"]/g, "\\\""],
[/[\n]/g, "\\n"],
[/[\r]/g, "\\r"],
Expand Down
9 changes: 6 additions & 3 deletions test/translation/lua/characterEscapeSequence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ local quoteInTemplateString = "\' \' \'";
local doubleQuoteInQuotes = "\" \" \"";
local doubleQuoteInDoubleQuotes = "\" \" \"";
local doubleQuoteInTemplateString = "\" \" \"";
local escapedCharsInQuotes = "\\ \0 \b \t \n \v \f \" \' \`";
local escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \' \`";
local escapedCharsInTemplateString = "\\ \0 \b \t \n \v \f \" \' \`";
local backQuoteInQuotes = "` ` `";
local backQuoteInDoubleQuotes = "` ` `";
local backQuoteInTemplateString = "` ` `";
local escapedCharsInQuotes = "\\ \0 \b \t \n \v \f \" \' `";
local escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \'";
local escapedCharsInTemplateString = "\\ \0 \b \t \n \v \f \" \' `";
local nonEmptyTemplateString = "Level 0: \n\t " .. (tostring("Level 1: \n\t\t " .. (tostring("Level 3: \n\t\t\t " .. (tostring("Last level \n --") .. " \n --")) .. " \n --")) .. " \n --");
6 changes: 5 additions & 1 deletion test/translation/ts/characterEscapeSequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ let doubleQuoteInQuotes = '" " "';
let doubleQuoteInDoubleQuotes = "\" \" \"";
let doubleQuoteInTemplateString = `" " "`;

let backQuoteInQuotes = '` ` `';
let backQuoteInDoubleQuotes = "` ` `";
let backQuoteInTemplateString = `\` \` \``;

let escapedCharsInQuotes = '\\ \0 \b \t \n \v \f \" \' \`';
let escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \' \`";
let escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \'";
let escapedCharsInTemplateString = `\\ \0 \b \t \n \v \f \" \' \``;

let nonEmptyTemplateString = `Level 0: \n\t ${`Level 1: \n\t\t ${`Level 3: \n\t\t\t ${'Last level \n --'} \n --`} \n --`} \n --`;