@@ -0,0 +1,100 @@
1+(ERROR) @error
2+
3+; { key: val }
4+
5+(object_elem val: (expression
6+ (variable_expr
7+ (identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))))
8+
9+(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$"))
10+(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$"))
11+((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))
12+((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$"))
13+
14+; highlight identifier keys as though they were block attributes
15+(object_elem key: (expression (variable_expr (identifier) @variable.other.member)))
16+
17+(attribute (identifier) @variable.other.member)
18+(function_call (identifier) @function.method)
19+(block (identifier) @type.builtin)
20+
21+(identifier) @variable
22+(comment) @comment
23+(null_lit) @constant.builtin
24+(numeric_lit) @constant.number
25+(bool_lit) @constant.builtin.boolean
26+
27+[
28+ (template_interpolation_start) ; ${
29+ (template_interpolation_end) ; }
30+ (template_directive_start) ; %{
31+ (template_directive_end) ; }
32+ (strip_marker) ; ~
33+] @punctuation.special
34+
35+[
36+ (heredoc_identifier) ; <<END
37+ (heredoc_start) ; END
38+] @punctuation.delimiter
39+
40+[
41+ (quoted_template_start) ; "
42+ (quoted_template_end); "
43+ (template_literal) ; non-interpolation/directive content
44+] @string
45+
46+[
47+ "if"
48+ "else"
49+ "endif"
50+] @keyword.control.conditional
51+
52+[
53+ "for"
54+ "endfor"
55+ "in"
56+] @keyword.control.repeat
57+
58+[
59+ ":"
60+ "="
61+] @none
62+
63+[
64+ (ellipsis)
65+ "\?"
66+ "=>"
67+] @punctuation.special
68+
69+[
70+ "."
71+ ".*"
72+ ","
73+ "[*]"
74+] @punctuation.delimiter
75+
76+[
77+ "{"
78+ "}"
79+ "["
80+ "]"
81+ "("
82+ ")"
83+] @punctuation.bracket
84+
85+[
86+ "!"
87+ "\*"
88+ "/"
89+ "%"
90+ "\+"
91+ "-"
92+ ">"
93+ ">="
94+ "<"
95+ "<="
96+ "=="
97+ "!="
98+ "&&"
99+ "||"
100+] @operator