mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -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"
|
"revision": "9d5fd0c329280a156bf7614a49dc5e8c58cc037c"
|
||||||
},
|
},
|
||||||
"fennel": {
|
"fennel": {
|
||||||
"revision": "e10b04389094d9b96aa8489121c1f285562d701d"
|
"revision": "42823442a18dd2aa7b0b22dc719abb54abb3fe2e"
|
||||||
},
|
},
|
||||||
"fish": {
|
"fish": {
|
||||||
"revision": "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f"
|
"revision": "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f"
|
||||||
|
|
|
||||||
|
|
@ -498,7 +498,7 @@ list.rst = {
|
||||||
list.fennel = {
|
list.fennel = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/travonted/tree-sitter-fennel",
|
url = "https://github.com/travonted/tree-sitter-fennel",
|
||||||
files = { "src/parser.c", "src/scanner.c" },
|
files = { "src/parser.c" },
|
||||||
},
|
},
|
||||||
maintainers = { "@TravonteD" },
|
maintainers = { "@TravonteD" },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,94 +1,4 @@
|
||||||
(boolean) @boolean
|
|
||||||
(nil) @constant.builtin
|
|
||||||
(string) @string
|
|
||||||
(number) @number
|
|
||||||
(field) @constant
|
|
||||||
(comment) @comment
|
(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
|
] @punctuation.bracket
|
||||||
|
|
||||||
; hash function
|
(nil) @constant.builtin
|
||||||
"#" @function
|
(vararg) @punctuation.special
|
||||||
|
|
||||||
(function_definition
|
(boolean) @boolean
|
||||||
name: (identifier) @function)
|
(number) @number
|
||||||
|
|
||||||
(lambda_definition
|
(string) @string
|
||||||
name: (identifier) @function)
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(function_call
|
(symbol) @variable
|
||||||
name: (identifier) @function)
|
|
||||||
|
|
||||||
(field_expression
|
(multi_symbol
|
||||||
(identifier)
|
|
||||||
"." @punctuation.delimiter
|
"." @punctuation.delimiter
|
||||||
(identifier) @function)
|
(symbol) @field)
|
||||||
|
|
||||||
;; TODO: fix me
|
(multi_symbol_method
|
||||||
;(field_expression
|
":" @punctuation.delimiter
|
||||||
;(identifier)
|
(symbol) @method .)
|
||||||
;(field) @function)
|
|
||||||
|
|
||||||
(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)
|
(program)
|
||||||
(function_definition)
|
(fn)
|
||||||
(lambda_definition)
|
(lambda)
|
||||||
(let_definition)
|
(let)
|
||||||
|
(each)
|
||||||
|
(for)
|
||||||
|
(match)
|
||||||
] @scope
|
] @scope
|
||||||
|
|
||||||
; Functions
|
((symbol) @scope
|
||||||
(function_definition
|
(#any-of? @scope
|
||||||
name: (identifier) @definition.function)
|
"while" "if" "when" "do"))
|
||||||
(lambda_definition
|
|
||||||
name: (identifier) @definition.function)
|
(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
|
(parameters
|
||||||
((identifier) @definition.var))
|
(symbol) @definition.var)
|
||||||
; iterators/loops
|
|
||||||
((each
|
|
||||||
(each_clause
|
|
||||||
(identifier) @definition.var)) @scope)
|
|
||||||
((for
|
|
||||||
(for_clause
|
|
||||||
(identifier) @definition.var)) @scope)
|
|
||||||
|
|
||||||
; references
|
(for_clause . (symbol) @definition.var)
|
||||||
(set
|
|
||||||
(assignment (identifier) @reference))
|
; FIXME: how to distinguish between symbols-as-bindings and
|
||||||
(function_call
|
; symbols-as-expressions
|
||||||
name: (identifier) @reference)
|
; (each_clause (symbol) @definition.var)
|
||||||
(identifier) @reference
|
; (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