From c16c8958e574ca8130a13015a8ddfa061c21a9ba Mon Sep 17 00:00:00 2001 From: Hugo Fonseca <1098293+fonsecas72@users.noreply.github.com> Date: Fri, 9 Oct 2020 17:51:23 +0100 Subject: [PATCH] terraform Fix heredoc --- src/hcl/hcl.test.ts | 29 +++++++++++++++++++++++++++++ src/hcl/hcl.ts | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/hcl/hcl.test.ts b/src/hcl/hcl.test.ts index 9a776e42..3f2f7632 100644 --- a/src/hcl/hcl.test.ts +++ b/src/hcl/hcl.test.ts @@ -992,6 +992,35 @@ testTokenization('hcl', [ } ], /* + foo = <<-EOF + bar + EOF + */ + [ + { + line: ' foo = <<-EOF', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 2, type: 'variable.hcl' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'operator.hcl' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'string.heredoc.delimiter.hcl' } + ] + }, + { + line: ' bar', + tokens: [{ startIndex: 0, type: 'string.heredoc.hcl' }] + }, + { + line: ' EOF', + tokens: [ + { startIndex: 0, type: 'string.heredoc.hcl' }, + { startIndex: 2, type: 'string.heredoc.delimiter.hcl' } + ] + } + ], + /* foo = <{ ], heredocBody: [ [ - /^([\w\-]+)$/, + /([\w\-]+)$/, { cases: { '$1==$S2': [