@@ -0,0 +1,189 @@
1+(comment) @comment
2+
3+; Pragma
4+(pragma_directive) @tag
5+(solidity_version_comparison_operator ">=" @tag)
6+(solidity_version_comparison_operator "<=" @tag)
7+(solidity_version_comparison_operator "=" @tag)
8+(solidity_version_comparison_operator "~" @tag)
9+(solidity_version_comparison_operator "^" @tag)
10+
11+
12+; Literals
13+[
14+ (string)
15+ (hex_string_literal)
16+ (unicode_string_literal)
17+ (yul_string_literal)
18+] @string
19+[
20+ (number_literal)
21+ (yul_decimal_number)
22+ (yul_hex_number)
23+] @constant.numeric
24+[
25+ (true)
26+ (false)
27+] @constant.builtin
28+
29+
30+; Type
31+(type_name) @type
32+(primitive_type) @type
33+(struct_declaration struct_name: (identifier) @type)
34+(enum_declaration enum_type_name: (identifier) @type)
35+; Color payable in payable address conversion as type and not as keyword
36+(payable_conversion_expression "payable" @type)
37+(emit_statement . (identifier) @type)
38+; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {}
39+(override_specifier (identifier) @type)
40+; Ensures that delimiters in mapping( ... => .. ) are not colored like types
41+(type_name "(" @punctuation.bracket "=>" @punctuation.delimiter ")" @punctuation.bracket)
42+
43+
44+
45+; Functions and parameters
46+
47+(function_definition
48+ function_name: (identifier) @function)
49+(modifier_definition
50+ name: (identifier) @function)
51+(yul_evm_builtin) @function.builtin
52+
53+; Use contructor coloring for special functions
54+(constructor_definition "constructor" @constructor)
55+(fallback_receive_definition "receive" @constructor)
56+(fallback_receive_definition "fallback" @constructor)
57+
58+(modifier_invocation (identifier) @function)
59+
60+; Handles expressions like structVariable.g();
61+(call_expression . (member_expression (property_identifier) @function.method))
62+
63+; Handles expressions like g();
64+(call_expression . (identifier) @function)
65+
66+; Function parameters
67+(event_paramater name: (identifier) @variable.parameter)
68+(function_definition
69+ function_name: (identifier) @variable.parameter)
70+
71+; Yul functions
72+(yul_function_call function: (yul_identifier) @function)
73+
74+; Yul function parameters
75+(yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter)
76+
77+(meta_type_expression "type" @keyword)
78+
79+(member_expression (property_identifier) @variable.other.member)
80+(property_identifier) @variable.other.member
81+(struct_expression ((identifier) @variable.other.member . ":"))
82+(enum_value) @variable.other.member
83+
84+
85+; Keywords
86+[
87+ "pragma"
88+ "import"
89+ "contract"
90+ "interface"
91+ "library"
92+ "is"
93+ "struct"
94+ "enum"
95+ "event"
96+ "using"
97+ "assembly"
98+ "switch"
99+ "case"
100+ "default"
101+ "break"
102+ "continue"
103+ "if"
104+ "else"
105+ "for"
106+ "while"
107+ "do"
108+ "try"
109+ "catch"
110+ "return"
111+ "emit"
112+ "public"
113+ "internal"
114+ "private"
115+ "external"
116+ "pure"
117+ "view"
118+ "payable"
119+ "modifier"
120+ "returns"
121+ "memory"
122+ "storage"
123+ "calldata"
124+ "function"
125+ "var"
126+ (constant)
127+ (virtual)
128+ (override_specifier)
129+ (yul_leave)
130+] @keyword
131+
132+(import_directive "as" @keyword)
133+(import_directive "from" @keyword)
134+(event_paramater "indexed" @keyword)
135+
136+; Punctuation
137+
138+[
139+ "("
140+ ")"
141+ "["
142+ "]"
143+ "{"
144+ "}"
145+] @punctuation.bracket
146+
147+
148+[
149+ "."
150+ ","
151+] @punctuation.delimiter
152+
153+
154+; Operators
155+
156+[
157+ "&&"
158+ "||"
159+ ">>"
160+ ">>>"
161+ "<<"
162+ "&"
163+ "^"
164+ "|"
165+ "+"
166+ "-"
167+ "*"
168+ "/"
169+ "%"
170+ "**"
171+ "<"
172+ "<="
173+ "=="
174+ "!="
175+ "!=="
176+ ">="
177+ ">"
178+ "!"
179+ "~"
180+ "-"
181+ "+"
182+ "delete"
183+ "new"
184+ "++"
185+ "--"
186+] @operator
187+
188+(identifier) @variable
189+(yul_identifier) @variable