Skip to content

Commit 8eeb5f3

Browse files
committed
Nested heredoc with newline terminator
When you have a heredoc interpolated into another heredoc where the inner heredoc is terminated by a newline, you need to avoid adding the newline character a second time.
1 parent 8c12a6b commit 8eeb5f3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/prism.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12024,7 +12024,10 @@ parser_lex(pm_parser_t *parser) {
1202412024
// string content.
1202512025
if (heredoc_lex_mode->indent == PM_HEREDOC_INDENT_TILDE) {
1202612026
const uint8_t *end = parser->current.end;
12027-
pm_newline_list_append(&parser->newline_list, end);
12027+
12028+
if (parser->heredoc_end == NULL) {
12029+
pm_newline_list_append(&parser->newline_list, end);
12030+
}
1202812031

1202912032
// Here we want the buffer to only
1203012033
// include up to the backslash.

0 commit comments

Comments
 (0)