hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

Heredoc space prefix stripping either not implemented or not functional #36

Closed sigil66 closed 5 years ago

sigil66 commented 6 years ago

It would appear that leading spaces are not stripped from heredocs utilizing the syntax defined in the spec:

<<-

apparentlymart commented 6 years ago

Hi @sigil66! Thanks for reporting this.

Indeed it does look like some reorganization of the code has broken this along the way... there's still some shallow support for it in the scanner but the trimming flag is not making its way into the handling of the body and so all heredocs are treated as not having the -.

We'll fix that up! Thanks.

apparentlymart commented 5 years ago

Hi again @sigil66!

I looked into this today and indeed it seems that this functionality was inadvertently broken as part of a rewrite of the template language parsing code back in the early stages of this project while things were still quite in flux.

In e8dbb16dbc7f9774afd808c19a0fd40d2347191f I've re-implemented the logic to strip the leading spaces tokens in flush heredocs and also added various tests that were missing for this before.

Thanks again for reporting this, and sorry for the delay in getting it fixed.