Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Add a second level of escape on strings
Browse files Browse the repository at this point in the history
  • Loading branch information
hdamron17 authored and Joshua Nelson committed Aug 3, 2020
1 parent 94a341e commit 34e5ad2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lex/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ fn stringify(args: Vec<Token>) -> Token {
let new_s = std::str::from_utf8(&s)
.unwrap()
.trim_end_matches('\u{0}') // remove null terminator
.escape_default();
.escape_default() // Escape whitespace, etc
.flat_map(char::escape_default); // Escape a second time
"\\\"" // Wrap with escaped quotation marks
.chars()
.chain(new_s)
Expand Down

0 comments on commit 34e5ad2

Please sign in to comment.