Support HEREDOCs in lists
This fixes a regression in Terraform where HEREDOCS were previously supported in lists, reported in hashicorp/terraform#4065.
This commit is contained in:
parent
692d016087
commit
eb77c8f861
@ -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,
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user