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
2 changes: 2 additions & 0 deletions hcl/printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func TestFormatValidOutput(t *testing.T) {
cases := []string{
"#\x00",
"#\ue123t",
"Y=<<4\n4/\n\n\n/4/@=4/\n\n\n/4000000004\r\r\n00004\n",
"x=<<_\n_\r\r\n_\n",
}

for _, c := range cases {
Expand Down
1 change: 1 addition & 0 deletions hcl/printer/testdata/object_with_heredoc.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
obj {
foo = [<<EOF
TEXT!
!!EOF
EOF
]
}
1 change: 1 addition & 0 deletions hcl/printer/testdata/object_with_heredoc.input
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
obj {
foo = [<<EOF
TEXT!
!!EOF
EOF
]
}
4 changes: 2 additions & 2 deletions hcl/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ func (s *Scanner) scanHeredoc() {

var identRegexp *regexp.Regexp
if identBytes[0] == '-' {
identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes[1:]))
identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes[1:]))
} else {
identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes))
identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes))
}

// Read the actual string value
Expand Down