Closed reegnz closed 2 years ago
I think the issue might be with https://github.com/MichaHoffmann/tree-sitter-hcl/blob/main/grammar.js#L296, but I don't know how to fix that in the https://github.com/MichaHoffmann/tree-sitter-hcl/blob/main/src/scanner.cc code.
Or maybe just wrapping the template_literal with an optional
would also be fine.
Hey @reegnz,
Thanks for reporting, ill have a look!
The problem is the empty identifier, template literals can be empty ( wrote a test just now )
mhh, according to the spec it would seem that this is invalid hcl if im not reading it wrong https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#identifiers
ahh, my bad, you were right, string literals demand some content right now, ill prepare a fix
empty templates were ok all along, but not empty string literals and block annotations do not allow templates, thats why it failed i think
I merged, nvim-treesitter should be updated automatically by a github action, if the issue persists please feel free to reopen!
Thanks for reporting, good find!
Thanks!
Describe the bug The parser fails to parse consul
global-management
policy that is used by consul when bootstrapping.To Reproduce Steps to reproduce the behavior:
Put this into admin.hcl:
And run
Expected behavior The parser parses the provided hcl file without ERROR.
Additional context The hcl above is the
global-management
policy for consul, which is the default policy to bootstrap consul. One might want to write a similar policy that references empty prefixes, but the tree-sitter parser fails to parse it correctly.I'm using the parser together with nvim-treesitter and nvim-tree-sitter-textobjects to get syntax highlighting and improved hcl editing in nvim.