PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.13.0
Code Block Pro – Beautiful Syntax Highlighting v1.13.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.13.0, at build/shiki/languages/hcl.tmLanguage.json

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