mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix(fennel): update parser and all the queries
This commit is contained in:
parent
d74ad4d2d6
commit
4f96b955d6
4 changed files with 121 additions and 146 deletions
|
|
@ -57,7 +57,7 @@
|
|||
"revision": "9d5fd0c329280a156bf7614a49dc5e8c58cc037c"
|
||||
},
|
||||
"fennel": {
|
||||
"revision": "e10b04389094d9b96aa8489121c1f285562d701d"
|
||||
"revision": "42823442a18dd2aa7b0b22dc719abb54abb3fe2e"
|
||||
},
|
||||
"fish": {
|
||||
"revision": "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f"
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ list.rst = {
|
|||
list.fennel = {
|
||||
install_info = {
|
||||
url = "https://github.com/travonted/tree-sitter-fennel",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
maintainers = { "@TravonteD" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,94 +1,4 @@
|
|||
(boolean) @boolean
|
||||
(nil) @constant.builtin
|
||||
(string) @string
|
||||
(number) @number
|
||||
(field) @constant
|
||||
(comment) @comment
|
||||
(identifier) @variable
|
||||
|
||||
[
|
||||
"fn"
|
||||
"lambda"
|
||||
"hashfn"
|
||||
"set"
|
||||
"tset"
|
||||
"λ"
|
||||
"global"
|
||||
"var"
|
||||
"local"
|
||||
"let"
|
||||
"do"
|
||||
"not"
|
||||
"not="
|
||||
"_ENV"
|
||||
"_G"
|
||||
"_VERSION"
|
||||
"arg"
|
||||
"assert"
|
||||
"collectgarbage"
|
||||
"coroutine"
|
||||
"debug"
|
||||
"dofile"
|
||||
"doto"
|
||||
"error"
|
||||
"eval-compiler"
|
||||
"gensym"
|
||||
"getmetatable"
|
||||
"in-scope?"
|
||||
"ipairs"
|
||||
"list"
|
||||
"list?"
|
||||
"load"
|
||||
"loadfile"
|
||||
"loadstring"
|
||||
"match"
|
||||
"macro"
|
||||
"macrodebug"
|
||||
"macroexpand"
|
||||
"macros"
|
||||
"multi-sym?"
|
||||
"next"
|
||||
"pairs"
|
||||
"package"
|
||||
"pcall"
|
||||
"print"
|
||||
"rawequal"
|
||||
"rawget"
|
||||
"rawlen"
|
||||
"rawset"
|
||||
"select"
|
||||
"sequence?"
|
||||
"setmetatable"
|
||||
"string"
|
||||
"sym"
|
||||
"sym?"
|
||||
"table"
|
||||
"table?"
|
||||
"tonumber"
|
||||
"tostring"
|
||||
"type"
|
||||
"unpack"
|
||||
"varg?"
|
||||
"xpcall"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"require"
|
||||
"require-macros"
|
||||
"import-macros"
|
||||
"include"
|
||||
] @include
|
||||
|
||||
[
|
||||
"each"
|
||||
"for"
|
||||
"while"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"when"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -99,26 +9,100 @@
|
|||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
; hash function
|
||||
"#" @function
|
||||
(nil) @constant.builtin
|
||||
(vararg) @punctuation.special
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
(boolean) @boolean
|
||||
(number) @number
|
||||
|
||||
(lambda_definition
|
||||
name: (identifier) @function)
|
||||
(string) @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(function_call
|
||||
name: (identifier) @function)
|
||||
(symbol) @variable
|
||||
|
||||
(field_expression
|
||||
(identifier)
|
||||
(multi_symbol
|
||||
"." @punctuation.delimiter
|
||||
(identifier) @function)
|
||||
(symbol) @field)
|
||||
|
||||
;; TODO: fix me
|
||||
;(field_expression
|
||||
;(identifier)
|
||||
;(field) @function)
|
||||
(multi_symbol_method
|
||||
":" @punctuation.delimiter
|
||||
(symbol) @method .)
|
||||
|
||||
(parameters (identifier) @parameter)
|
||||
(list . (symbol) @function)
|
||||
(list . (multi_symbol (symbol) @function .))
|
||||
|
||||
((symbol) @variable.builtin
|
||||
(#match? @variable.builtin "^[$]"))
|
||||
|
||||
(sequential_table_binding (symbol) @symbol)
|
||||
(table_binding ([(_) ":" @punctuation.special] (symbol) @symbol)*)
|
||||
|
||||
[
|
||||
"fn"
|
||||
"lambda"
|
||||
"hashfn"
|
||||
"#"
|
||||
] @keyword.function
|
||||
|
||||
(fn name: [
|
||||
(symbol) @function
|
||||
(multi_symbol (symbol) @function .)
|
||||
])
|
||||
|
||||
(lambda name: [
|
||||
(symbol) @function
|
||||
(multi_symbol (symbol) @function .)
|
||||
])
|
||||
|
||||
(parameters (symbol) @parameter)
|
||||
|
||||
[
|
||||
"for"
|
||||
"each"
|
||||
] @repeat
|
||||
((symbol) @repeat
|
||||
(#any-of? @repeat
|
||||
"while"))
|
||||
|
||||
[
|
||||
"match"
|
||||
] @conditional
|
||||
((symbol) @conditional
|
||||
(#any-of? @conditional
|
||||
"if" "when"))
|
||||
|
||||
((symbol) @include
|
||||
(#any-of? @include
|
||||
"require" "require-macros" "import-macros" "include"))
|
||||
|
||||
[
|
||||
"global"
|
||||
"local"
|
||||
"let"
|
||||
"set"
|
||||
"var"
|
||||
] @keyword
|
||||
((symbol) @keyword
|
||||
(#any-of? @keyword
|
||||
"comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values"))
|
||||
|
||||
((symbol) @function.macro
|
||||
(#any-of? @function.macro
|
||||
"->" "->>" "-?>" "-?>>" "?." "accumulate" "collect" "doto" "icollect"
|
||||
"macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open"))
|
||||
|
||||
; Lua builtins
|
||||
((symbol) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"arg" "_ENV" "_G" "_VERSION"))
|
||||
|
||||
((symbol) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs"
|
||||
"load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget"
|
||||
"rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring"
|
||||
"type" "warn" "xpcall"))
|
||||
|
||||
((symbol) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"loadstring" "module" "setfenv" "unpack"))
|
||||
|
|
|
|||
|
|
@ -1,45 +1,36 @@
|
|||
; Scope
|
||||
[
|
||||
(program)
|
||||
(function_definition)
|
||||
(lambda_definition)
|
||||
(let_definition)
|
||||
(fn)
|
||||
(lambda)
|
||||
(let)
|
||||
(each)
|
||||
(for)
|
||||
(match)
|
||||
] @scope
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
name: (identifier) @definition.function)
|
||||
(lambda_definition
|
||||
name: (identifier) @definition.function)
|
||||
((symbol) @scope
|
||||
(#any-of? @scope
|
||||
"while" "if" "when" "do"))
|
||||
|
||||
(fn name: (symbol) @definition.function)
|
||||
(lambda name: (symbol) @definition.function)
|
||||
|
||||
; Variable Definitions
|
||||
(local_definition
|
||||
(assignment
|
||||
(identifier) @definition.var))
|
||||
(var_definition
|
||||
(assignment
|
||||
(identifier) @definition.var))
|
||||
(global_definition
|
||||
(assignment
|
||||
(identifier) @definition.var))
|
||||
(assignment
|
||||
(identifier) @definition.var)
|
||||
(multi_value_assignment
|
||||
(value_list
|
||||
(identifier) @definition.var))
|
||||
(parameters
|
||||
((identifier) @definition.var))
|
||||
; iterators/loops
|
||||
((each
|
||||
(each_clause
|
||||
(identifier) @definition.var)) @scope)
|
||||
((for
|
||||
(for_clause
|
||||
(identifier) @definition.var)) @scope)
|
||||
(symbol) @definition.var)
|
||||
|
||||
; references
|
||||
(set
|
||||
(assignment (identifier) @reference))
|
||||
(function_call
|
||||
name: (identifier) @reference)
|
||||
(identifier) @reference
|
||||
(for_clause . (symbol) @definition.var)
|
||||
|
||||
; FIXME: how to distinguish between symbols-as-bindings and
|
||||
; symbols-as-expressions
|
||||
; (each_clause (symbol) @definition.var)
|
||||
; (let_clause ((symbol) @definition.var (_))*)
|
||||
|
||||
(global . (symbol) @definition.var)
|
||||
(local . (symbol) @definition.var)
|
||||
(var . (symbol) @definition.var)
|
||||
|
||||
(multi_value_binding (symbol) @definition.var)
|
||||
(sequential_table_binding (symbol) @definition.var)
|
||||
(table_binding ([(_) ":"] (symbol) @definition.var)*)
|
||||
|
||||
(symbol) @reference
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue