Skip to content

Commit

Permalink
fix: handle escaped newlines in heredocs (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinohmann committed Jul 13, 2022
1 parent 1ba1301 commit 82849f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parser/tests.rs
Expand Up @@ -423,6 +423,11 @@ fn unescape_strings() {
object_attr = {
"key\nwith\nnewlines" = true
}
heredoc = <<-EOS
some string with \
escaped newline
EOS
}
"#;

Expand All @@ -437,6 +442,7 @@ fn unescape_strings() {
"object_attr",
Expression::from_iter([("key\nwith\nnewlines", true)]),
))
.add_attribute(("heredoc", "some string with escaped newline\n"))
.build(),
)
.build();
Expand Down
1 change: 1 addition & 0 deletions src/parser/unescape.rs
Expand Up @@ -20,6 +20,7 @@ pub fn unescape(s: &str) -> Result<String> {
}

let c = match chars.next() {
Some('\n') => continue,
Some('b') => '\u{0008}',
Some('f') => '\u{000C}',
Some('n') => '\n',
Expand Down

0 comments on commit 82849f1

Please sign in to comment.