mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
feat(fennel)!: update parser and queries (#6460)
This commit is contained in:
parent
075b7594ca
commit
46f8778fbf
6 changed files with 213 additions and 180 deletions
|
|
@ -168,7 +168,7 @@
|
||||||
"revision": "f3b9274514b5f9bf6b0dd4a01c30f9cc15c58bc4"
|
"revision": "f3b9274514b5f9bf6b0dd4a01c30f9cc15c58bc4"
|
||||||
},
|
},
|
||||||
"fennel": {
|
"fennel": {
|
||||||
"revision": "215e3913524abc119daa9db7cf6ad2f2f5620189"
|
"revision": "ea4a536bca8997e30b22709f210f44f97e75bf7d"
|
||||||
},
|
},
|
||||||
"fidl": {
|
"fidl": {
|
||||||
"revision": "0a8910f293268e27ff554357c229ba172b0eaed2"
|
"revision": "0a8910f293268e27ff554357c229ba172b0eaed2"
|
||||||
|
|
|
||||||
|
|
@ -547,7 +547,8 @@ list.faust = {
|
||||||
list.fennel = {
|
list.fennel = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/alexmozaidze/tree-sitter-fennel",
|
url = "https://github.com/alexmozaidze/tree-sitter-fennel",
|
||||||
files = { "src/parser.c" },
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
generate_requires_npm = true,
|
||||||
},
|
},
|
||||||
maintainers = { "@alexmozaidze" },
|
maintainers = { "@alexmozaidze" },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,51 @@
|
||||||
|
; compounds
|
||||||
[
|
[
|
||||||
(list)
|
(list)
|
||||||
(table)
|
(table)
|
||||||
(sequence)
|
(sequence)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
||||||
(list
|
; sub-forms / special compounds
|
||||||
.
|
[
|
||||||
(symbol) @_let
|
(list_binding)
|
||||||
(#eq? @_let "let")
|
(table_binding)
|
||||||
.
|
(sequence_binding)
|
||||||
(sequence) @fold) @fold
|
(table_metadata)
|
||||||
|
(sequence_arguments)
|
||||||
|
(let_vars)
|
||||||
|
(case_guard_or_special)
|
||||||
|
(case_guard)
|
||||||
|
(case_catch)
|
||||||
|
] @fold
|
||||||
|
|
||||||
(list
|
; forms
|
||||||
.
|
[
|
||||||
(symbol) @_local
|
(quote_form)
|
||||||
(#eq? @_local "local")) @fold
|
(unquote_form)
|
||||||
|
(local_form)
|
||||||
|
(var_form)
|
||||||
|
(set_form)
|
||||||
|
(global_form)
|
||||||
|
(let_form)
|
||||||
|
(fn_form)
|
||||||
|
(lambda_form)
|
||||||
|
(hashfn_form)
|
||||||
|
(each_form)
|
||||||
|
(collect_form)
|
||||||
|
(icollect_form)
|
||||||
|
(accumulate_form)
|
||||||
|
(for_form)
|
||||||
|
(fcollect_form)
|
||||||
|
(faccumulate_form)
|
||||||
|
(case_form)
|
||||||
|
(match_form)
|
||||||
|
(case_try_form)
|
||||||
|
(match_try_form)
|
||||||
|
] @fold
|
||||||
|
|
||||||
(list
|
; reader macros
|
||||||
.
|
(quote_reader_macro
|
||||||
(symbol) @_global
|
expression: (_) @fold)
|
||||||
(#eq? @_global "global")) @fold
|
|
||||||
|
(quasi_quote_reader_macro
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @_fn
|
|
||||||
(#any-of? @_fn "fn" "lambda" "λ" "hashfn")) @fold
|
|
||||||
|
|
||||||
(reader_macro
|
|
||||||
macro: [
|
|
||||||
"'"
|
|
||||||
"`"
|
|
||||||
]
|
|
||||||
expression: (_) @fold)
|
expression: (_) @fold)
|
||||||
|
|
|
||||||
|
|
@ -12,44 +12,97 @@
|
||||||
"]"
|
"]"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
(nil) @constant.builtin
|
[
|
||||||
|
(nil)
|
||||||
|
(nil_binding)
|
||||||
|
] @constant.builtin
|
||||||
|
|
||||||
(boolean) @boolean
|
[
|
||||||
|
(boolean)
|
||||||
|
(boolean_binding)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
(number) @number
|
[
|
||||||
|
(number)
|
||||||
|
(number_binding)
|
||||||
|
] @number
|
||||||
|
|
||||||
(string) @string
|
[
|
||||||
|
(string)
|
||||||
|
(string_binding)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
[
|
||||||
|
(symbol)
|
||||||
|
(symbol_binding)
|
||||||
|
] @variable
|
||||||
|
|
||||||
|
(symbol_option) @keyword.directive
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(symbol) @variable
|
|
||||||
|
|
||||||
(multi_symbol
|
(multi_symbol
|
||||||
"." @punctuation.delimiter
|
"." @punctuation.delimiter
|
||||||
member: (symbol_fragment) @variable.member)
|
member: (symbol_fragment) @variable.member)
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (symbol) @function.call)
|
||||||
(symbol) @function.call)
|
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol
|
||||||
(multi_symbol
|
|
||||||
member: (symbol_fragment) @function.call .))
|
member: (symbol_fragment) @function.call .))
|
||||||
|
|
||||||
(multi_symbol_method
|
(multi_symbol_method
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
method: (symbol_fragment) @function.method.call .)
|
method: (symbol_fragment) @function.method.call)
|
||||||
|
|
||||||
; Just `&` is only used in destructuring
|
(quasi_quote_reader_macro
|
||||||
((symbol) @punctuation.special
|
macro: _ @punctuation.special)
|
||||||
(#eq? @punctuation.special "&"))
|
|
||||||
|
(quote_reader_macro
|
||||||
|
macro: _ @punctuation.special)
|
||||||
|
|
||||||
|
(unquote_reader_macro
|
||||||
|
macro: _ @punctuation.special)
|
||||||
|
|
||||||
|
(hashfn_reader_macro
|
||||||
|
macro: _ @keyword.function)
|
||||||
|
|
||||||
|
(sequence_arguments
|
||||||
|
(symbol_binding) @variable.parameter)
|
||||||
|
|
||||||
|
(sequence_arguments
|
||||||
|
(rest_binding
|
||||||
|
rhs: (symbol_binding) @variable.parameter))
|
||||||
|
|
||||||
|
(docstring) @string.documentation
|
||||||
|
|
||||||
|
(fn_form
|
||||||
|
name: [
|
||||||
|
(symbol) @function
|
||||||
|
(multi_symbol
|
||||||
|
member: (symbol_fragment) @function .)
|
||||||
|
])
|
||||||
|
|
||||||
|
(lambda_form
|
||||||
|
name: [
|
||||||
|
(symbol) @function
|
||||||
|
(multi_symbol
|
||||||
|
member: (symbol_fragment) @function .)
|
||||||
|
])
|
||||||
|
|
||||||
|
; NOTE: The macro name is highlighted as @variable because it
|
||||||
|
; gives a nicer contrast instead of everything being the same
|
||||||
|
; color. Rust queries use this workaround too for `macro_rules!`.
|
||||||
|
(macro_form
|
||||||
|
name: [
|
||||||
|
(symbol) @variable
|
||||||
|
(multi_symbol
|
||||||
|
member: (symbol_fragment) @variable .)
|
||||||
|
])
|
||||||
|
|
||||||
; BUG: $ arguments should only be valid inside hashfn of any depth, but
|
|
||||||
; it's impossible to express such query at the moment of writing.
|
|
||||||
; See tree-sitter/tree-sitter#880
|
|
||||||
((symbol) @variable.parameter
|
((symbol) @variable.parameter
|
||||||
(#eq? @variable.parameter "$..."))
|
(#any-of? @variable.parameter "$" "$..."))
|
||||||
|
|
||||||
((symbol) @variable.parameter
|
((symbol) @variable.parameter
|
||||||
(#lua-match? @variable.parameter "^%$[1-9]$"))
|
(#lua-match? @variable.parameter "^%$[1-9]$"))
|
||||||
|
|
@ -74,8 +127,11 @@
|
||||||
; other
|
; other
|
||||||
"length"))
|
"length"))
|
||||||
|
|
||||||
(reader_macro
|
(case_guard
|
||||||
macro: "#" @keyword.function)
|
call: (_) @keyword.conditional)
|
||||||
|
|
||||||
|
(case_guard_or_special
|
||||||
|
call: (_) @keyword.conditional)
|
||||||
|
|
||||||
((symbol) @keyword.function
|
((symbol) @keyword.function
|
||||||
(#any-of? @keyword.function "fn" "lambda" "λ" "hashfn"))
|
(#any-of? @keyword.function "fn" "lambda" "λ" "hashfn"))
|
||||||
|
|
@ -84,7 +140,7 @@
|
||||||
(#any-of? @keyword.repeat "for" "each" "while"))
|
(#any-of? @keyword.repeat "for" "each" "while"))
|
||||||
|
|
||||||
((symbol) @keyword.conditional
|
((symbol) @keyword.conditional
|
||||||
(#any-of? @keyword.conditional "if" "when" "match" "case"))
|
(#any-of? @keyword.conditional "if" "when" "match" "case" "match-try" "case-try"))
|
||||||
|
|
||||||
((symbol) @keyword
|
((symbol) @keyword
|
||||||
(#any-of? @keyword
|
(#any-of? @keyword
|
||||||
|
|
@ -92,13 +148,21 @@
|
||||||
"quote" "tset" "values" "tail!"))
|
"quote" "tset" "values" "tail!"))
|
||||||
|
|
||||||
((symbol) @keyword.import
|
((symbol) @keyword.import
|
||||||
(#any-of? @keyword.import "require" "require-macros" "import-macros" "include"))
|
(#any-of? @keyword.import "require-macros" "import-macros" "include"))
|
||||||
|
|
||||||
((symbol) @function.macro
|
((symbol) @function.macro
|
||||||
(#any-of? @function.macro
|
(#any-of? @function.macro
|
||||||
"collect" "icollect" "fcollect" "accumulate" "faccumulate" "->" "->>" "-?>" "-?>>" "?." "doto"
|
"collect" "icollect" "fcollect" "accumulate" "faccumulate" "->" "->>" "-?>" "-?>>" "?." "doto"
|
||||||
"macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open"))
|
"macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open"))
|
||||||
|
|
||||||
|
(case_catch
|
||||||
|
call: (symbol) @keyword)
|
||||||
|
|
||||||
|
(import_macros_form
|
||||||
|
imports: (table_binding
|
||||||
|
(table_binding_pair
|
||||||
|
value: (symbol_binding) @function.macro)))
|
||||||
|
|
||||||
; TODO: Highlight builtin methods (`table.unpack`, etc) as @function.builtin
|
; TODO: Highlight builtin methods (`table.unpack`, etc) as @function.builtin
|
||||||
([
|
([
|
||||||
(symbol) @module.builtin
|
(symbol) @module.builtin
|
||||||
|
|
@ -127,68 +191,3 @@
|
||||||
"assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next"
|
"assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next"
|
||||||
"pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable"
|
"pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable"
|
||||||
"tonumber" "tostring" "type" "warn" "xpcall" "module" "setfenv" "loadstring" "unpack"))
|
"tonumber" "tostring" "type" "warn" "xpcall" "module" "setfenv" "loadstring" "unpack"))
|
||||||
|
|
||||||
(table
|
|
||||||
(table_pair
|
|
||||||
key: (symbol) @keyword.directive
|
|
||||||
(#eq? @keyword.directive "&as")))
|
|
||||||
|
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @keyword.function
|
|
||||||
(#any-of? @keyword.function "fn" "lambda" "λ")
|
|
||||||
.
|
|
||||||
[
|
|
||||||
(symbol) @function
|
|
||||||
(multi_symbol
|
|
||||||
(symbol_fragment) @function .)
|
|
||||||
]
|
|
||||||
.
|
|
||||||
(sequence
|
|
||||||
((symbol) @variable.parameter
|
|
||||||
(#not-any-of? @variable.parameter "&" "..."))))
|
|
||||||
|
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @function.macro
|
|
||||||
(#any-of? @function.macro "collect" "icollect" "fcollect")
|
|
||||||
.
|
|
||||||
(sequence
|
|
||||||
[
|
|
||||||
(symbol)
|
|
||||||
(string)
|
|
||||||
] @keyword.directive
|
|
||||||
(#any-of? @keyword.directive "&into" ":into")))
|
|
||||||
|
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @function.macro
|
|
||||||
(#any-of? @function.macro "for" "each" "collect" "icollect" "fcollect" "accumulate" "faccumulate")
|
|
||||||
.
|
|
||||||
(sequence
|
|
||||||
[
|
|
||||||
(symbol)
|
|
||||||
(string)
|
|
||||||
] @keyword.directive
|
|
||||||
(#any-of? @keyword.directive "&until" ":until")))
|
|
||||||
|
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @keyword.conditional
|
|
||||||
(#any-of? @keyword.conditional "match" "case")
|
|
||||||
.
|
|
||||||
(_)
|
|
||||||
.
|
|
||||||
((list
|
|
||||||
.
|
|
||||||
(symbol) @keyword
|
|
||||||
(#eq? @keyword "where"))
|
|
||||||
.
|
|
||||||
(_))*
|
|
||||||
.
|
|
||||||
(list
|
|
||||||
.
|
|
||||||
(symbol) @keyword
|
|
||||||
(#eq? @keyword "where"))
|
|
||||||
.
|
|
||||||
(_)? .)
|
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,42 @@
|
||||||
((comment) @injection.content
|
((comment_body) @injection.content
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_vimcmd_identifier
|
||||||
(multi_symbol) @_vimcmd_identifier
|
|
||||||
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec2")
|
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec2")
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "vim")))
|
(#set! injection.language "vim")))
|
||||||
|
|
||||||
; NOTE: Matches *exactly* `ffi.cdef`
|
; NOTE: Matches *exactly* `ffi.cdef`
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_cdef_identifier
|
||||||
(multi_symbol) @_cdef_identifier
|
|
||||||
(#eq? @_cdef_identifier "ffi.cdef")
|
(#eq? @_cdef_identifier "ffi.cdef")
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "c")))
|
(#set! injection.language "c")))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_ts_query_identifier
|
||||||
(multi_symbol) @_ts_query_identifier
|
|
||||||
(#any-of? @_ts_query_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse")
|
(#any-of? @_ts_query_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "query")))
|
(#set! injection.language "query")))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_vimcmd_identifier
|
||||||
(multi_symbol) @_vimcmd_identifier
|
|
||||||
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
|
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(table
|
item: (table
|
||||||
(table_pair
|
(table_pair
|
||||||
key: (string
|
key: (string
|
||||||
(string_content) @_command
|
(string_content) @_command
|
||||||
|
|
@ -50,54 +46,50 @@
|
||||||
(#set! injection.language "vim")))))
|
(#set! injection.language "vim")))))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_user_cmd
|
||||||
(multi_symbol) @_user_cmd
|
|
||||||
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
|
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "vim")))
|
(#set! injection.language "vim")))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_user_cmd
|
||||||
(multi_symbol) @_user_cmd
|
|
||||||
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "vim")))
|
(#set! injection.language "vim")))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_map
|
||||||
(multi_symbol) @_map
|
|
||||||
(#any-of? @_map "vim.api.nvim_set_keymap" "vim.keymap.set")
|
(#any-of? @_map "vim.api.nvim_set_keymap" "vim.keymap.set")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "vim")))
|
(#set! injection.language "vim")))
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_map
|
||||||
(multi_symbol) @_map
|
|
||||||
(#eq? @_map "vim.api.nvim_buf_set_keymap")
|
(#eq? @_map "vim.api.nvim_buf_set_keymap")
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "vim")))
|
(#set! injection.language "vim")))
|
||||||
|
|
||||||
|
|
@ -107,40 +99,36 @@
|
||||||
(#lua-match? @injection.content "^%s*;+%s?query")
|
(#lua-match? @injection.content "^%s*;+%s?query")
|
||||||
(#set! injection.language "query"))
|
(#set! injection.language "query"))
|
||||||
|
|
||||||
; ──────────────────────────────────────────────────────────────────────
|
|
||||||
; (string.match "123" "%d+")
|
; (string.match "123" "%d+")
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol
|
||||||
(multi_symbol
|
|
||||||
member: (symbol_fragment) @_func
|
member: (symbol_fragment) @_func
|
||||||
.
|
.
|
||||||
(#any-of? @_func "find" "match" "gmatch" "gsub"))
|
(#any-of? @_func "find" "match" "gmatch" "gsub"))
|
||||||
.
|
.
|
||||||
(_)
|
item: (_)
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "luap")
|
(#set! injection.language "luap")
|
||||||
(#set! injection.include-children)))
|
(#set! injection.include-children)))
|
||||||
|
|
||||||
; (my-string:match "%d+")
|
; (my-string:match "%d+")
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol_method
|
||||||
(multi_symbol_method
|
|
||||||
method: (symbol_fragment) @_method
|
method: (symbol_fragment) @_method
|
||||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "luap")
|
(#set! injection.language "luap")
|
||||||
(#set! injection.include-children)))
|
(#set! injection.include-children)))
|
||||||
|
|
||||||
; (string.format "pi = %.2f" 3.14159)
|
; (string.format "pi = %.2f" 3.14159)
|
||||||
(list
|
(list
|
||||||
.
|
call: (multi_symbol) @_func
|
||||||
(multi_symbol) @_func
|
|
||||||
(#eq? @_func "string.format")
|
(#eq? @_func "string.format")
|
||||||
.
|
.
|
||||||
(string
|
item: (string
|
||||||
(string_content) @injection.content
|
(string_content) @injection.content
|
||||||
(#set! injection.language "printf")))
|
(#set! injection.language "printf")))
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,56 @@
|
||||||
; TODO: Add tests
|
|
||||||
; TODO: Improve queries
|
|
||||||
(program) @local.scope
|
(program) @local.scope
|
||||||
|
|
||||||
((list
|
|
||||||
.
|
|
||||||
(symbol) @_call) @local.scope
|
|
||||||
(#any-of? @_call
|
|
||||||
"let" "fn" "lambda" "λ" "while" "each" "for" "if" "when" "do" "collect" "icollect" "accumulate"
|
|
||||||
"case" "match"))
|
|
||||||
|
|
||||||
(symbol) @local.reference
|
(symbol) @local.reference
|
||||||
|
|
||||||
|
[
|
||||||
|
(let_form)
|
||||||
|
(fn_form)
|
||||||
|
(lambda_form)
|
||||||
|
(each_form)
|
||||||
|
(for_form)
|
||||||
|
(collect_form)
|
||||||
|
(icollect_form)
|
||||||
|
(accumulate_form)
|
||||||
|
(for_form)
|
||||||
|
(fcollect_form)
|
||||||
|
(faccumulate_form)
|
||||||
|
(case_form)
|
||||||
|
(match_form)
|
||||||
|
(case_try_form)
|
||||||
|
(match_try_form)
|
||||||
|
(if_form)
|
||||||
|
] @local.scope
|
||||||
|
|
||||||
(list
|
(list
|
||||||
.
|
call: (symbol) @_call
|
||||||
(symbol) @_fn
|
(#any-of? @_call "while" "when" "do")) @local.scope
|
||||||
(#any-of? @_fn "fn" "lambda" "λ")
|
|
||||||
.
|
(fn_form
|
||||||
[
|
name: [
|
||||||
(symbol) @local.definition.function
|
(symbol) @local.definition.function
|
||||||
(multi_symbol
|
(multi_symbol
|
||||||
member: (symbol_fragment) @local.definition.function .)
|
member: (symbol_fragment) @local.definition.function .)
|
||||||
]
|
]
|
||||||
(#set! definition.function.scope "parent")
|
args: (sequence_arguments
|
||||||
.
|
(symbol_binding) @local.definition.parameter)
|
||||||
(sequence
|
(#set! definition.function.scope "parent"))
|
||||||
(symbol)* @local.definition.parameter
|
|
||||||
(#not-contains? @local.definition.parameter "&")))
|
(lambda_form
|
||||||
|
name: [
|
||||||
|
(symbol) @local.definition.function
|
||||||
|
(multi_symbol
|
||||||
|
member: (symbol_fragment) @local.definition.function .)
|
||||||
|
]
|
||||||
|
args: (sequence_arguments
|
||||||
|
(symbol_binding) @local.definition.parameter)
|
||||||
|
(#set! definition.function.scope "parent"))
|
||||||
|
|
||||||
|
(macro_form
|
||||||
|
name: [
|
||||||
|
(symbol) @local.definition.function
|
||||||
|
(multi_symbol
|
||||||
|
member: (symbol_fragment) @local.definition.function .)
|
||||||
|
]
|
||||||
|
args: (sequence_arguments
|
||||||
|
(symbol_binding) @local.definition.parameter)
|
||||||
|
(#set! definition.function.scope "parent"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue