Merge pull request #66 from hashicorp/b-heredoc-lists
Support HEREDOCs in lists
This commit is contained in:
commit
8a65681ce2
@ -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