feat(fennel): update parser and queries

This commit is contained in:
Otto Modinos 2021-09-30 18:17:31 +03:00 committed by Stephan Seitz
parent 6714daf5ac
commit 99d4f72a5c
3 changed files with 23 additions and 28 deletions

View file

@ -57,7 +57,7 @@
"revision": "9d5fd0c329280a156bf7614a49dc5e8c58cc037c"
},
"fennel": {
"revision": "42823442a18dd2aa7b0b22dc719abb54abb3fe2e"
"revision": "fce4331731a960077ff5f98939bc675179f1908a"
},
"fish": {
"revision": "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f"

View file

@ -9,6 +9,14 @@
"]"
] @punctuation.bracket
[
":"
":until"
"&"
"&as"
"?"
] @punctuation.special
(nil) @constant.builtin
(vararg) @punctuation.special
@ -34,8 +42,7 @@
((symbol) @variable.builtin
(#match? @variable.builtin "^[$]"))
(sequential_table_binding (symbol) @symbol)
(table_binding ([(_) ":" @punctuation.special] (symbol) @symbol)*)
(binding) @symbol
[
"fn"
@ -54,8 +61,6 @@
(multi_symbol (symbol) @function .)
])
(parameters (symbol) @parameter)
[
"for"
"each"
@ -71,21 +76,23 @@
(#any-of? @conditional
"if" "when"))
((symbol) @include
(#any-of? @include
"require" "require-macros" "import-macros" "include"))
[
"global"
"local"
"let"
"set"
"var"
"where"
"or"
] @keyword
((symbol) @keyword
(#any-of? @keyword
"comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values"))
((symbol) @include
(#any-of? @include
"require" "require-macros" "import-macros" "include"))
((symbol) @function.macro
(#any-of? @function.macro
"->" "->>" "-?>" "-?>>" "?." "accumulate" "collect" "doto" "icollect"

View file

@ -8,29 +8,17 @@
(match)
] @scope
((symbol) @scope
(#any-of? @scope
"while" "if" "when" "do"))
(
(list . (symbol) @_special) @scope
(#any-of? @_special
"while" "if" "when" "do" "collect" "icollect" "accumulate")
)
(fn name: (symbol) @definition.function)
(lambda name: (symbol) @definition.function)
(parameters
(symbol) @definition.var)
; TODO: use @definition.parameter for parameters
(binding (symbol) @definition.var)
(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