spacevim/bundle/nvim-treesitter/queries/solidity/highlights.scm
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

264 lines
3.9 KiB
Scheme

; Pragma
[
"pragma"
"solidity"
] @preproc
(solidity_pragma_token
"||" @symbol)
(solidity_pragma_token
"-" @symbol)
(solidity_version_comparison_operator) @operator
(solidity_version) @text.underline @string.special
; Literals
[
(string)
(yul_string_literal)
] @string
(hex_string_literal
"hex" @symbol
(_) @string)
(unicode_string_literal
"unicode" @symbol
(_) @string)
[
(number_literal)
(yul_decimal_number)
(yul_hex_number)
] @number
(yul_boolean) @boolean
; Variables
[
(identifier)
(yul_identifier)
] @variable
; Types
(type_name (identifier) @type)
(type_name (user_defined_type (identifier) @type))
(type_name "mapping" @function.builtin)
[
(primitive_type)
(number_unit)
] @type.builtin
(contract_declaration name: (identifier) @type)
(struct_declaration name: (identifier) @type)
(struct_member name: (identifier) @field)
(enum_declaration name: (identifier) @type)
(emit_statement . (identifier) @type)
; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {}
(override_specifier (user_defined_type) @type)
; Functions and parameters
(function_definition
name: (identifier) @function)
(modifier_definition
name: (identifier) @function)
(yul_evm_builtin) @function.builtin
; Use constructor coloring for special functions
(constructor_definition "constructor" @constructor)
(modifier_invocation (identifier) @function)
; Handles expressions like structVariable.g();
(call_expression . (member_expression (identifier) @method.call))
; Handles expressions like g();
(call_expression . (identifier) @function.call)
; Function parameters
(event_paramater name: (identifier) @parameter)
(parameter name: (identifier) @parameter)
; Yul functions
(yul_function_call function: (yul_identifier) @function.call)
; Yul function parameters
(yul_function_definition . (yul_identifier) @function (yul_identifier) @parameter)
(meta_type_expression "type" @keyword)
(member_expression property: (identifier) @field)
(call_struct_argument name: (identifier) @field)
(struct_field_assignment name: (identifier) @field)
(enum_value) @constant
; Keywords
[
"contract"
"interface"
"library"
"is"
"struct"
"enum"
"event"
"assembly"
"emit"
"override"
"modifier"
"var"
"let"
"emit"
"fallback"
"receive"
(virtual)
] @keyword
; FIXME: update grammar
; (block_statement "unchecked" @keyword)
(event_paramater "indexed" @keyword)
[
"public"
"internal"
"private"
"external"
"pure"
"view"
"payable"
(immutable)
] @type.qualifier
[
"memory"
"storage"
"calldata"
"constant"
] @storageclass
[
"for"
"while"
"do"
"break"
"continue"
] @repeat
[
"if"
"else"
"switch"
"case"
"default"
] @conditional
(ternary_expression
"?" @conditional.ternary
":" @conditional.ternary)
[
"try"
"catch"
"revert"
] @exception
[
"return"
"returns"
(yul_leave)
] @keyword.return
"function" @keyword.function
[
"import"
"using"
] @include
(import_directive "as" @include)
(import_directive "from" @include)
((import_directive source: (string) @text.underline)
(#offset! @text.underline 0 1 0 -1))
; Punctuation
[ "{" "}" ] @punctuation.bracket
[ "[" "]" ] @punctuation.bracket
[ "(" ")" ] @punctuation.bracket
[
"."
","
":"
; FIXME: update grammar
; (semicolon)
"->"
"=>"
] @punctuation.delimiter
; Operators
[
"&&"
"||"
">>"
">>>"
"<<"
"&"
"^"
"|"
"+"
"-"
"*"
"/"
"%"
"**"
"="
"<"
"<="
"=="
"!="
"!=="
">="
">"
"!"
"~"
"-"
"+"
"++"
"--"
":="
] @operator
[
"delete"
"new"
] @keyword.operator
(import_directive "*" @character.special)
; Comments
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///[^/]"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///$"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
; Errors
(ERROR) @error