hcl/specsuite/tests/expressions/heredoc.hcl
Martin Atkins e8dbb16dbc hcl/hclsyntax: Fix up parsing of flush heredocs
This was implemented a long time ago in the original template parser, but
it was missed in the rewrite of the template parser to make it use a
two-stage parsing strategy.

It's implemented as a post-processing step on the result of the first
stage of parsing, which produces a flat sequence of literal strings,
interpolation markers, and control markers, and prior to the second stage
which matches opening and closing control markers to produce an expression
AST.

It's important to do this at parse time rather than eval time since it is
the static layout of the source code that decides the indentation level,
and so an interpolation marker at the start of a line that itself produces
spaces does not affect the result.
2018-12-13 17:22:41 -08:00

74 lines
781 B
HCL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

normal = {
basic = <<EOT
Foo
Bar
Baz
EOT
indented = <<EOT
Foo
Bar
Baz
EOT
indented_more = <<EOT
Foo
Bar
Baz
EOT
interp = <<EOT
Foo
${bar}
Baz
EOT
marker_at_suffix = <<EOT
NOT EOT
EOT
}
flush = {
basic = <<-EOT
Foo
Bar
Baz
EOT
indented = <<-EOT
Foo
Bar
Baz
EOT
indented_more = <<-EOT
Foo
Bar
Baz
EOT
indented_less = <<-EOT
Foo
Bar
Baz
EOT
interp = <<-EOT
Foo
${bar}
Baz
EOT
interp_indented_more = <<-EOT
Foo
${bar}
Baz
EOT
interp_indented_less = <<-EOT
Foo
${space_bar}
Baz
EOT
tabs = <<-EOT
Foo
Bar
Baz
EOT
unicode_spaces = <<-EOT
Foo (there's two "em spaces" before Foo there)
Bar
Baz
EOT
}