fix(solidity): variable should not match last, tidy up highlights

This commit is contained in:
Amaan Qureshi 2023-04-25 13:09:18 -04:00
parent 75f911d01f
commit 82bcd8483e

View file

@ -12,6 +12,8 @@
(solidity_version_comparison_operator) @operator
(solidity_version) @text.underline @string.special
; Literals
[
@ -35,8 +37,17 @@
(yul_boolean) @boolean
; Type
; Variables
[
(identifier)
(yul_identifier)
] @variable
; Types
(type_name (identifier) @type)
(type_name (user_defined_type (identifier) @type))
(type_name "mapping" @function.builtin)
[
@ -55,9 +66,9 @@
; Functions and parameters
(function_definition
name: (identifier) @function)
name: (identifier) @function)
(modifier_definition
name: (identifier) @function)
name: (identifier) @function)
(yul_evm_builtin) @function.builtin
; Use constructor coloring for special functions
@ -88,8 +99,8 @@
(struct_field_assignment name: (identifier) @field)
(enum_value) @constant
; Keywords
[
"contract"
"interface"
@ -173,7 +184,8 @@
] @include
(import_directive "as" @include)
(import_directive "from" @include)
(import_directive "*" @character.special)
((import_directive source: (string) @text.underline)
(#offset! @text.underline 0 1 0 -1))
; Punctuation
@ -186,21 +198,13 @@
[
"."
","
":"
; FIXME: update grammar
; (semicolon)
"->"
"=>"
] @punctuation.delimiter
(call_struct_argument
":" @punctuation.delimiter)
(slice_access
":" @punctuation.delimiter)
(struct_field_assignment
":" @punctuation.delimiter)
(yul_label
":" @punctuation.delimiter)
; Operators
[
@ -218,6 +222,7 @@
"/"
"%"
"**"
"="
"<"
"<="
"=="
@ -234,19 +239,12 @@
":="
] @operator
(yul_assignment
":" @operator
"=" @operator)
[
"delete"
"new"
] @keyword.operator
[
(identifier)
(yul_identifier)
] @variable
(import_directive "*" @character.special)
; Comments