Skip to content

Commit

Permalink
Merge pull request #66 from hashicorp/b-heredoc-lists
Browse files Browse the repository at this point in the history
Support HEREDOCs in lists
  • Loading branch information
jen20 committed Nov 29, 2015
2 parents 5bd8787 + eb77c8f commit 8a65681
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hcl/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (p *Parser) listType() (*ast.ListType, error) {
for {
tok := p.scan()
switch tok.Type {
case token.NUMBER, token.FLOAT, token.STRING:
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
if needComma {
return nil, &PosError{
Pos: tok.Pos,
Expand Down
9 changes: 9 additions & 0 deletions hcl/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ func TestListType(t *testing.T) {
`foo = ["123", 123]`,
[]token.Type{token.STRING, token.NUMBER},
},
{
`foo = [1,
"string",
<<EOF
heredoc contents
EOF
]`,
[]token.Type{token.NUMBER, token.STRING, token.HEREDOC},
},
}

for _, l := range literals {
Expand Down

0 comments on commit 8a65681

Please sign in to comment.