Terraform lexer has problems when heredoc templates start with "<<" instead of "<<-", to prove i applied the following patch:
index 1d73734d..ab0ba809 100644
--- a/tests/snippets/terraform/test_heredoc.txt
+++ b/tests/snippets/terraform/test_heredoc.txt
@@ -1,6 +1,6 @@
---input---
resource "local_file" "heredoc" {
- content = <<-DOC
+ content = <<DOC
heredoc content
DOC
}
And the parser showed alot of errors in the tests:
========================================== FAILURES ===========================================
__________________________ tests/snippets/terraform/test_heredoc.txt __________________________
The tokens produced by the "terraform" lexer differ from the expected ones in the file "tests/snippets/terraform/test_heredoc.txt".
Run `pytest tests/snippets --update-goldens` to update it.
'resource' Keyword.Reserved
' ' Text.Whitespace
'"local_file"' Name.Class
' ' Text.Whitespace
'"heredoc"' Name.Variable
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'content' Name.Attribute
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
- '<<-' Operator
? -
+ '<<' Operator
? +
'DOC' Literal.String.Delimiter
'\n' Literal.String.Heredoc
- ' heredoc content\n' Literal.String.Heredoc
+ ' heredoc content\n' Error
- ' DOC\n' Literal.String.Delimiter
+ ' DOC\n' Error
+
+ '}\n' Error
+
+ ' ' Text.Whitespace
+ 'h' Error
+ 'e' Error
+ 'r' Error
+ 'e' Error
+ 'd' Error
+ 'o' Error
+ 'c' Error
+ ' ' Text.Whitespace
+ 'c' Error
+ 'o' Error
+ 'n' Error
+ 't' Error
+ 'e' Error
+ 'n' Error
+ 't' Error
+ '\n' Text.Whitespace
+
+ ' ' Text.Whitespace
+ 'D' Error
+ 'O' Error
+ 'C' Error
+ '\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
=================================== short test summary info ===================================
FAILED tests/snippets/terraform/test_heredoc.txt::
According to the spec both are valid introductions to heredoc templates.
Terraform lexer has problems when heredoc templates start with "<<" instead of "<<-", to prove i applied the following patch:
And the parser showed alot of errors in the tests:
According to the spec both are valid introductions to heredoc templates.