PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.28.0
Code Block Pro – Beautiful Syntax Highlighting v1.28.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / hcl.tmLanguage.json

hcl.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.28.0, at build/shiki/languages/hcl.tmLanguage.json

786 lines 18.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "scopeName": "source.hcl",
3 "name": "hcl",
4 "uuid": "a14187be-98d8-42c1-ac89-bb5eaccf911e",
5 "fileTypes": ["hcl"],
6 "patterns": [
7 {
8 "include": "#comments"
9 },
10 {
11 "include": "#attribute_definition"
12 },
13 {
14 "include": "#block"
15 },
16 {
17 "include": "#expressions"
18 }
19 ],
20 "repository": {
21 "attribute_access": {
22 "begin": "\\.(?!\\*)",
23 "end": "[[:alpha:]][\\w-]*|\\d*",
24 "comment": "Matches traversal attribute access such as .attr",
25 "beginCaptures": {
26 "0": {
27 "name": "keyword.operator.accessor.hcl"
28 }
29 },
30 "endCaptures": {
31 "0": {
32 "patterns": [
33 {
34 "match": "(?!null|false|true)[[:alpha:]][\\w-]*",
35 "comment": "Attribute name",
36 "name": "variable.other.member.hcl"
37 },
38 {
39 "match": "\\d+",
40 "comment": "Optional attribute index",
41 "name": "constant.numeric.integer.hcl"
42 }
43 ]
44 }
45 }
46 },
47 "attribute_definition": {
48 "name": "variable.declaration.hcl",
49 "match": "(\\()?(\\b(?!null\\b|false\\b|true\\b)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*",
50 "comment": "Identifier \"=\" with optional parens",
51 "captures": {
52 "1": {
53 "name": "punctuation.section.parens.begin.hcl"
54 },
55 "2": {
56 "name": "variable.other.readwrite.hcl"
57 },
58 "3": {
59 "name": "punctuation.section.parens.end.hcl"
60 },
61 "4": {
62 "name": "keyword.operator.assignment.hcl"
63 }
64 }
65 },
66 "attribute_splat": {
67 "begin": "\\.",
68 "end": "\\*",
69 "comment": "Legacy attribute-only splat",
70 "beginCaptures": {
71 "0": {
72 "name": "keyword.operator.accessor.hcl"
73 }
74 },
75 "endCaptures": {
76 "0": {
77 "name": "keyword.operator.splat.hcl"
78 }
79 }
80 },
81 "block": {
82 "name": "meta.block.hcl",
83 "begin": "([\\w][\\-\\w]*)([^{\\r\\n]*)(\\{)",
84 "end": "\\}",
85 "comment": "This will match HCL blocks like `thing1 \"one\" \"two\" {` or `thing2 {`",
86 "beginCaptures": {
87 "1": {
88 "patterns": [
89 {
90 "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b",
91 "comment": "Block type",
92 "name": "entity.name.type.hcl"
93 }
94 ]
95 },
96 "2": {
97 "patterns": [
98 {
99 "match": "\\\"[^\\\"\\r\\n]*\\\"",
100 "comment": "Block label (String Literal)",
101 "name": "variable.other.enummember.hcl"
102 },
103 {
104 "match": "[[:alpha:]][[:alnum:]_-]*",
105 "comment": "Block label (Indentifier)",
106 "name": "variable.other.enummember.hcl"
107 }
108 ]
109 },
110 "3": {
111 "name": "punctuation.section.block.begin.hcl"
112 }
113 },
114 "endCaptures": {
115 "0": {
116 "name": "punctuation.section.block.end.hcl"
117 }
118 },
119 "patterns": [
120 {
121 "include": "#comments"
122 },
123 {
124 "include": "#attribute_definition"
125 },
126 {
127 "include": "#expressions"
128 },
129 {
130 "include": "#block"
131 }
132 ]
133 },
134 "block_inline_comments": {
135 "name": "comment.block.hcl",
136 "begin": "/\\*",
137 "end": "\\*/",
138 "comment": "Inline comments start with the /* sequence and end with the */ sequence, and may have any characters within except the ending sequence. An inline comment is considered equivalent to a whitespace sequence",
139 "captures": {
140 "0": {
141 "name": "punctuation.definition.comment.hcl"
142 }
143 }
144 },
145 "brackets": {
146 "begin": "\\[",
147 "end": "\\]",
148 "beginCaptures": {
149 "0": {
150 "name": "punctuation.section.brackets.begin.hcl"
151 }
152 },
153 "endCaptures": {
154 "0": {
155 "name": "punctuation.section.brackets.end.hcl"
156 }
157 },
158 "patterns": [
159 {
160 "name": "keyword.operator.splat.hcl",
161 "match": "\\*",
162 "comment": "Splat operator"
163 },
164 {
165 "include": "#comma"
166 },
167 {
168 "include": "#comments"
169 },
170 {
171 "include": "#inline_for_expression"
172 },
173 {
174 "include": "#inline_if_expression"
175 },
176 {
177 "include": "#expressions"
178 },
179 {
180 "include": "#local_identifiers"
181 }
182 ]
183 },
184 "char_escapes": {
185 "name": "constant.character.escape.hcl",
186 "match": "\\\\[nrt\"\\\\]|\\\\u(\\h{8}|\\h{4})",
187 "comment": "Character Escapes"
188 },
189 "comma": {
190 "name": "punctuation.separator.hcl",
191 "match": "\\,",
192 "comment": "Commas - used in certain expressions"
193 },
194 "comments": {
195 "patterns": [
196 {
197 "include": "#hash_line_comments"
198 },
199 {
200 "include": "#double_slash_line_comments"
201 },
202 {
203 "include": "#block_inline_comments"
204 }
205 ]
206 },
207 "double_slash_line_comments": {
208 "name": "comment.line.double-slash.hcl",
209 "begin": "//",
210 "end": "$\\n?",
211 "comment": "Line comments start with // sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence",
212 "captures": {
213 "0": {
214 "name": "punctuation.definition.comment.hcl"
215 }
216 }
217 },
218 "expressions": {
219 "patterns": [
220 {
221 "include": "#literal_values"
222 },
223 {
224 "include": "#operators"
225 },
226 {
227 "include": "#tuple_for_expression"
228 },
229 {
230 "include": "#object_for_expression"
231 },
232 {
233 "include": "#brackets"
234 },
235 {
236 "include": "#objects"
237 },
238 {
239 "include": "#attribute_access"
240 },
241 {
242 "include": "#attribute_splat"
243 },
244 {
245 "include": "#functions"
246 },
247 {
248 "include": "#parens"
249 }
250 ]
251 },
252 "for_expression_body": {
253 "patterns": [
254 {
255 "name": "keyword.operator.word.hcl",
256 "match": "\\bin\\b",
257 "comment": "in keyword"
258 },
259 {
260 "name": "keyword.control.conditional.hcl",
261 "match": "\\bif\\b",
262 "comment": "if keyword"
263 },
264 {
265 "name": "keyword.operator.hcl",
266 "match": "\\:"
267 },
268 {
269 "include": "#expressions"
270 },
271 {
272 "include": "#comments"
273 },
274 {
275 "include": "#comma"
276 },
277 {
278 "include": "#local_identifiers"
279 }
280 ]
281 },
282 "functions": {
283 "name": "meta.function-call.hcl",
284 "begin": "(\\w+)(\\()",
285 "end": "\\)",
286 "comment": "Built-in function calls",
287 "beginCaptures": {
288 "1": {
289 "patterns": [
290 {
291 "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b",
292 "name": "support.function.builtin.hcl"
293 }
294 ]
295 },
296 "2": {
297 "name": "punctuation.section.parens.begin.hcl"
298 }
299 },
300 "endCaptures": {
301 "0": {
302 "name": "punctuation.section.parens.end.hcl"
303 }
304 },
305 "patterns": [
306 {
307 "include": "#comments"
308 },
309 {
310 "include": "#expressions"
311 },
312 {
313 "include": "#comma"
314 }
315 ]
316 },
317 "hash_line_comments": {
318 "name": "comment.line.number-sign.hcl",
319 "begin": "#",
320 "end": "$\\n?",
321 "comment": "Line comments start with # sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence",
322 "captures": {
323 "0": {
324 "name": "punctuation.definition.comment.hcl"
325 }
326 }
327 },
328 "hcl_type_keywords": {
329 "name": "storage.type.hcl",
330 "match": "\\b(any|string|number|bool|list|set|map|tuple|object)\\b",
331 "comment": "Type keywords known to HCL."
332 },
333 "heredoc": {
334 "name": "string.unquoted.heredoc.hcl",
335 "begin": "(\\<\\<\\-?)\\s*(\\w+)\\s*$",
336 "end": "^\\s*\\2\\s*$",
337 "comment": "String Heredoc",
338 "beginCaptures": {
339 "1": {
340 "name": "keyword.operator.heredoc.hcl"
341 },
342 "2": {
343 "name": "keyword.control.heredoc.hcl"
344 }
345 },
346 "endCaptures": {
347 "0": {
348 "name": "keyword.control.heredoc.hcl"
349 }
350 },
351 "patterns": [
352 {
353 "include": "#string_interpolation"
354 }
355 ]
356 },
357 "inline_for_expression": {
358 "begin": "(for)\\b",
359 "end": "\\n",
360 "beginCaptures": {
361 "1": {
362 "name": "keyword.control.hcl"
363 }
364 },
365 "patterns": [
366 {
367 "name": "storage.type.function.hcl",
368 "match": "\\=\\>"
369 },
370 {
371 "include": "#for_expression_body"
372 }
373 ]
374 },
375 "inline_if_expression": {
376 "begin": "(if)\\b",
377 "end": "\\n",
378 "beginCaptures": {
379 "1": {
380 "name": "keyword.control.conditional.hcl"
381 }
382 },
383 "patterns": [
384 {
385 "include": "#expressions"
386 },
387 {
388 "include": "#comments"
389 },
390 {
391 "include": "#comma"
392 },
393 {
394 "include": "#local_identifiers"
395 }
396 ]
397 },
398 "language_constants": {
399 "name": "constant.language.hcl",
400 "match": "\\b(true|false|null)\\b",
401 "comment": "Language Constants"
402 },
403 "literal_values": {
404 "patterns": [
405 {
406 "include": "#numeric_literals"
407 },
408 {
409 "include": "#language_constants"
410 },
411 {
412 "include": "#string_literals"
413 },
414 {
415 "include": "#heredoc"
416 },
417 {
418 "include": "#hcl_type_keywords"
419 }
420 ]
421 },
422 "local_identifiers": {
423 "name": "variable.other.readwrite.hcl",
424 "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b",
425 "comment": "Local Identifiers"
426 },
427 "numeric_literals": {
428 "patterns": [
429 {
430 "name": "constant.numeric.float.hcl",
431 "match": "\\b\\d+([Ee][+-]?)\\d+\\b",
432 "comment": "Integer, no fraction, optional exponent",
433 "captures": {
434 "1": {
435 "name": "punctuation.separator.exponent.hcl"
436 }
437 }
438 },
439 {
440 "name": "constant.numeric.float.hcl",
441 "match": "\\b\\d+(\\.)\\d+(?:([Ee][+-]?)\\d+)?\\b",
442 "comment": "Integer, fraction, optional exponent",
443 "captures": {
444 "1": {
445 "name": "punctuation.separator.decimal.hcl"
446 },
447 "2": {
448 "name": "punctuation.separator.exponent.hcl"
449 }
450 }
451 },
452 {
453 "name": "constant.numeric.integer.hcl",
454 "match": "\\b\\d+\\b",
455 "comment": "Integers"
456 }
457 ]
458 },
459 "object_for_expression": {
460 "begin": "(\\{)\\s?(for)\\b",
461 "end": "\\}",
462 "beginCaptures": {
463 "1": {
464 "name": "punctuation.section.braces.begin.hcl"
465 },
466 "2": {
467 "name": "keyword.control.hcl"
468 }
469 },
470 "endCaptures": {
471 "0": {
472 "name": "punctuation.section.braces.end.hcl"
473 }
474 },
475 "patterns": [
476 {
477 "name": "storage.type.function.hcl",
478 "match": "\\=\\>"
479 },
480 {
481 "include": "#for_expression_body"
482 }
483 ]
484 },
485 "object_key_values": {
486 "patterns": [
487 {
488 "include": "#comments"
489 },
490 {
491 "include": "#literal_values"
492 },
493 {
494 "include": "#operators"
495 },
496 {
497 "include": "#tuple_for_expression"
498 },
499 {
500 "include": "#object_for_expression"
501 },
502 {
503 "include": "#heredoc"
504 },
505 {
506 "include": "#functions"
507 }
508 ]
509 },
510 "objects": {
511 "name": "meta.braces.hcl",
512 "begin": "\\{",
513 "end": "\\}",
514 "beginCaptures": {
515 "0": {
516 "name": "punctuation.section.braces.begin.hcl"
517 }
518 },
519 "endCaptures": {
520 "0": {
521 "name": "punctuation.section.braces.end.hcl"
522 }
523 },
524 "patterns": [
525 {
526 "include": "#comments"
527 },
528 {
529 "include": "#objects"
530 },
531 {
532 "include": "#inline_for_expression"
533 },
534 {
535 "include": "#inline_if_expression"
536 },
537 {
538 "match": "\\b((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)\\s*(\\=\\>?)\\s*",
539 "comment": "Literal, named object key",
540 "captures": {
541 "1": {
542 "name": "meta.mapping.key.hcl variable.other.readwrite.hcl"
543 },
544 "2": {
545 "name": "keyword.operator.assignment.hcl",
546 "patterns": [
547 {
548 "match": "\\=\\>",
549 "name": "storage.type.function.hcl"
550 }
551 ]
552 }
553 }
554 },
555 {
556 "match": "\\b((\").*(\"))\\s*(\\=)\\s*",
557 "comment": "String object key",
558 "captures": {
559 "1": {
560 "name": "meta.mapping.key.hcl string.quoted.double.hcl"
561 },
562 "2": {
563 "name": "punctuation.definition.string.begin.hcl"
564 },
565 "3": {
566 "name": "punctuation.definition.string.end.hcl"
567 },
568 "4": {
569 "name": "keyword.operator.hcl"
570 }
571 }
572 },
573 {
574 "name": "meta.mapping.key.hcl",
575 "begin": "^\\s*\\(",
576 "end": "(\\))\\s*(=|:)\\s*",
577 "comment": "Computed object key (any expression between parens)",
578 "beginCaptures": {
579 "0": {
580 "name": "punctuation.section.parens.begin.hcl"
581 }
582 },
583 "endCaptures": {
584 "1": {
585 "name": "punctuation.section.parens.end.hcl"
586 },
587 "2": {
588 "name": "keyword.operator.hcl"
589 }
590 },
591 "patterns": [
592 {
593 "include": "#attribute_access"
594 },
595 {
596 "include": "#attribute_splat"
597 }
598 ]
599 },
600 {
601 "include": "#object_key_values"
602 }
603 ]
604 },
605 "operators": {
606 "patterns": [
607 {
608 "name": "keyword.operator.hcl",
609 "match": "\\>\\="
610 },
611 {
612 "name": "keyword.operator.hcl",
613 "match": "\\<\\="
614 },
615 {
616 "name": "keyword.operator.hcl",
617 "match": "\\=\\="
618 },
619 {
620 "name": "keyword.operator.hcl",
621 "match": "\\!\\="
622 },
623 {
624 "name": "keyword.operator.arithmetic.hcl",
625 "match": "\\+"
626 },
627 {
628 "name": "keyword.operator.arithmetic.hcl",
629 "match": "\\-"
630 },
631 {
632 "name": "keyword.operator.arithmetic.hcl",
633 "match": "\\*"
634 },
635 {
636 "name": "keyword.operator.arithmetic.hcl",
637 "match": "\\/"
638 },
639 {
640 "name": "keyword.operator.arithmetic.hcl",
641 "match": "\\%"
642 },
643 {
644 "name": "keyword.operator.logical.hcl",
645 "match": "\\&\\&"
646 },
647 {
648 "name": "keyword.operator.logical.hcl",
649 "match": "\\|\\|"
650 },
651 {
652 "name": "keyword.operator.logical.hcl",
653 "match": "\\!"
654 },
655 {
656 "name": "keyword.operator.hcl",
657 "match": "\\>"
658 },
659 {
660 "name": "keyword.operator.hcl",
661 "match": "\\<"
662 },
663 {
664 "name": "keyword.operator.hcl",
665 "match": "\\?"
666 },
667 {
668 "name": "keyword.operator.hcl",
669 "match": "\\.\\.\\."
670 },
671 {
672 "match": "\\:"
673 }
674 ]
675 },
676 "parens": {
677 "begin": "\\(",
678 "end": "\\)",
679 "comment": "Parens - matched *after* function syntax",
680 "beginCaptures": {
681 "0": {
682 "name": "punctuation.section.parens.begin.hcl"
683 }
684 },
685 "endCaptures": {
686 "0": {
687 "name": "punctuation.section.parens.end.hcl"
688 }
689 },
690 "patterns": [
691 {
692 "include": "#comments"
693 },
694 {
695 "include": "#expressions"
696 }
697 ]
698 },
699 "string_interpolation": {
700 "name": "meta.interpolation.hcl",
701 "begin": "(?<![%$])([%$]{)",
702 "end": "\\}",
703 "comment": "String interpolation",
704 "beginCaptures": {
705 "1": {
706 "name": "keyword.other.interpolation.begin.hcl"
707 }
708 },
709 "endCaptures": {
710 "0": {
711 "name": "keyword.other.interpolation.end.hcl"
712 }
713 },
714 "patterns": [
715 {
716 "name": "keyword.operator.template.left.trim.hcl",
717 "match": "\\~\\s",
718 "comment": "Trim left whitespace"
719 },
720 {
721 "name": "keyword.operator.template.right.trim.hcl",
722 "match": "\\s\\~",
723 "comment": "Trim right whitespace"
724 },
725 {
726 "name": "keyword.control.hcl",
727 "match": "\\b(if|else|endif|for|in|endfor)\\b",
728 "comment": "if/else/endif and for/in/endfor directives"
729 },
730 {
731 "include": "#expressions"
732 },
733 {
734 "include": "#local_identifiers"
735 }
736 ]
737 },
738 "string_literals": {
739 "name": "string.quoted.double.hcl",
740 "begin": "\"",
741 "end": "\"",
742 "comment": "Strings",
743 "beginCaptures": {
744 "0": {
745 "name": "punctuation.definition.string.begin.hcl"
746 }
747 },
748 "endCaptures": {
749 "0": {
750 "name": "punctuation.definition.string.end.hcl"
751 }
752 },
753 "patterns": [
754 {
755 "include": "#string_interpolation"
756 },
757 {
758 "include": "#char_escapes"
759 }
760 ]
761 },
762 "tuple_for_expression": {
763 "begin": "(\\[)\\s?(for)\\b",
764 "end": "\\]",
765 "beginCaptures": {
766 "1": {
767 "name": "punctuation.section.brackets.begin.hcl"
768 },
769 "2": {
770 "name": "keyword.control.hcl"
771 }
772 },
773 "endCaptures": {
774 "0": {
775 "name": "punctuation.section.brackets.end.hcl"
776 }
777 },
778 "patterns": [
779 {
780 "include": "#for_expression_body"
781 }
782 ]
783 }
784 }
785 }
786