@@ -29,7 +29,7 @@ variables:
29
29
# Identifiers: (UTF-8) (ID_Continue | '-')*;
30
30
#
31
31
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#identifiers
32
- identifer : (?:\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\b)
32
+ identifier : (?:\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\b)
33
33
34
34
# Exponent: "e" or "E" followed by an optional sign
35
35
#
@@ -123,13 +123,14 @@ contexts:
123
123
#
124
124
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#expression-terms
125
125
expressions :
126
- - include : literal_values
126
+ - include : literals
127
127
- include : operators
128
128
- include : brackets
129
129
- include : objects
130
130
- include : attribute_access
131
131
- include : functions
132
132
- include : parens
133
+ - include : identifiers
133
134
134
135
comma :
135
136
- match : \,
@@ -145,17 +146,14 @@ contexts:
145
146
scope : punctuation.section.parens.end.terraform
146
147
pop : true
147
148
- include : expressions
148
- - match : " {{identifer}}"
149
- comment : Local Identifiers
150
- scope : variable.other.readwrite.terraform
151
149
152
150
# Literal Values: Numbers, Language Constants, and Strings
153
151
#
154
152
# Strings are _technically_ part of the "expression sub-language",
155
153
# but make the most sense to be part of this stack.
156
154
#
157
155
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#literal-values
158
- literal_values :
156
+ literals :
159
157
- include : numeric_literals
160
158
- include : language_constants
161
159
- include : string_literals
@@ -181,11 +179,13 @@ contexts:
181
179
- match : ' #|//'
182
180
comment : Inline Comments
183
181
scope : punctuation.definition.comment.terraform
184
- push :
185
- - meta_scope : comment.line.terraform
186
- - match : $\n?
187
- scope : punctuation.definition.comment.terraform
188
- pop : true
182
+ push : inline_comment_body
183
+
184
+ inline_comment_body :
185
+ - meta_scope : comment.line.terraform
186
+ - match : $\n?
187
+ scope : punctuation.definition.comment.terraform
188
+ pop : true
189
189
190
190
# Block comments: start and end delimiters for multi-line comments.
191
191
#
@@ -195,11 +195,13 @@ contexts:
195
195
- match : /\*
196
196
comment : Block comments
197
197
scope : punctuation.definition.comment.terraform
198
- push :
199
- - meta_scope : comment.block.terraform
200
- - match : \*/
201
- scope : punctuation.definition.comment.terraform
202
- pop : true
198
+ push : block_comments_body
199
+
200
+ block_comments_body :
201
+ - meta_scope : comment.block.terraform
202
+ - match : \*/
203
+ scope : punctuation.definition.comment.terraform
204
+ pop : true
203
205
204
206
# Language Constants: booleans and `null`.
205
207
#
@@ -278,7 +280,7 @@ contexts:
278
280
#
279
281
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#template-expressions
280
282
heredoc :
281
- - match : (\<\<\-?)\s*({{identifer }})\s*$
283
+ - match : (\<\<\-?)\s*({{identifier }})\s*$
282
284
comment : String Heredoc's
283
285
captures :
284
286
1 : keyword.operator.heredoc.terraform
@@ -349,8 +351,8 @@ contexts:
349
351
- match : \"
350
352
scope : punctuation.definition.string.end.terraform
351
353
pop : true
352
- - match : " {{identifer }}"
353
- comment : Identifer label
354
+ - match : " {{identifier }}"
355
+ comment : Identifier label
354
356
scope : entity.name.label.terraform
355
357
- include : numeric_literals
356
358
- include : attribute_access
@@ -376,8 +378,8 @@ contexts:
376
378
pop : true
377
379
- include : comma
378
380
- include : comments
379
- - include : expressions
380
381
- include : tuple_for_expression
382
+ - include : expressions
381
383
382
384
# Objects: collection values
383
385
#
@@ -396,7 +398,7 @@ contexts:
396
398
pop : true
397
399
- include : object_for_expression
398
400
- include : comments
399
- - match : (?=({{identifer }}|\".*?\")\s*=)
401
+ - match : (?=({{identifier }}|\".*?\")\s*=)
400
402
push :
401
403
- object_value
402
404
- assignment_operator
@@ -414,7 +416,7 @@ contexts:
414
416
- include : expressions
415
417
416
418
object_key :
417
- - match : ' {{identifer }}'
419
+ - match : ' {{identifier }}'
418
420
scope : meta.mapping.key.terraform string.unquoted.terraform
419
421
pop : true
420
422
- match : (\").*?(\")
@@ -455,19 +457,23 @@ contexts:
455
457
attribute_access :
456
458
- match : \.
457
459
scope : punctuation.accessor.dot.terraform
458
- push :
459
- - match : " {{identifer}}"
460
- comment : Attribute access
461
- scope : variable.other.member.terraform
462
- pop : true
463
- - match : \d+
464
- comment : Subscript
465
- scope : constant.numeric.integer.terraform
466
- pop : true
467
- - match : \*
468
- comment : Attribute-only splat
469
- scope : keyword.operator.splat.terraform
470
- pop : true
460
+ push : member
461
+
462
+ member :
463
+ - include : comments
464
+ - match : " {{identifier}}"
465
+ comment : Attribute access
466
+ scope : variable.other.member.terraform
467
+ pop : true
468
+ - match : \d+
469
+ comment : Subscript
470
+ scope : constant.numeric.integer.terraform
471
+ pop : true
472
+ - match : \*
473
+ comment : Attribute-only splat
474
+ scope : keyword.operator.splat.terraform
475
+ pop : true
476
+ - include : else_pop
471
477
472
478
# Attribute Definition: Identifier "=" Expression Newline
473
479
#
@@ -476,13 +482,13 @@ contexts:
476
482
#
477
483
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#attribute-definitions
478
484
attribute_definition :
479
- - match : (?=(\()?({{identifer }})(\))?\s*(\=(?![\=\>])))
485
+ - match : (?=(\()?({{identifier }})(\))?\s*(\=(?![\=\>])))
480
486
push :
481
487
- assignment_operator
482
488
- attribute_key
483
489
484
490
attribute_key :
485
- - match : \((?={{identifer }}\))
491
+ - match : \((?={{identifier }}\))
486
492
scope : punctuation.section.parens.begin.terraform
487
493
set :
488
494
- attribute_key_end
@@ -495,7 +501,7 @@ contexts:
495
501
- match : count\b
496
502
scope : variable.declaration.terraform keyword.control.conditional.terraform
497
503
pop : true
498
- - match : ' {{identifer }}'
504
+ - match : ' {{identifier }}'
499
505
scope : variable.declaration.terraform variable.other.readwrite.terraform
500
506
pop : true
501
507
@@ -509,7 +515,7 @@ contexts:
509
515
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#functions-and-function-calls
510
516
# https://www.terraform.io/docs/language/expressions/function-calls.html
511
517
functions :
512
- - match : (?:({{predeclared_funcs}})|\b({{identifer }})\b)(\()
518
+ - match : (?:({{predeclared_funcs}})|\b({{identifier }})\b)(\()
513
519
comment : Built-in function calls
514
520
captures :
515
521
1 : support.function.builtin.terraform
@@ -573,15 +579,16 @@ contexts:
573
579
- include : expressions
574
580
- include : comments
575
581
- include : comma
576
- - match : " {{identifer}}"
577
- comment : Local Identifiers
582
+
583
+ identifiers :
584
+ - match : " {{identifier}}"
578
585
scope : variable.other.readwrite.terraform
579
586
580
587
# Blocks: Identifier (StringLit|Identifier)* "{" Newline Body "}" Newline;
581
588
#
582
589
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#structural-elements
583
590
block :
584
- - match : (?:\b({{terraform_known_blocks}})\b|({{identifer }}))(?=[\s\"\-[:word:]]*(\{))
591
+ - match : (?:\b({{terraform_known_blocks}})\b|({{identifier }}))(?=[\s\"\-[:word:]]*(\{))
585
592
captures :
586
593
1 : keyword.declaration.terraform
587
594
2 : entity.name.type.terraform
@@ -592,7 +599,7 @@ contexts:
592
599
- match : \"
593
600
scope : punctuation.definition.string.begin.terraform
594
601
push : block_name_body
595
- - match : " {{identifer }}"
602
+ - match : " {{identifier }}"
596
603
scope : entity.name.label.terraform
597
604
- match : \{
598
605
scope : punctuation.section.block.begin.terraform
0 commit comments