feat(fennel)!: switch to maintained parser (#6132)

Change the Fennel parser to a simpler and more consistent one, along with updating all the queries.
This commit is contained in:
Alexei Mozaidze 2024-02-21 17:44:01 +04:00 committed by GitHub
parent 71ae32c187
commit 7d1bab6546
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 398 additions and 107 deletions

View file

@ -1,32 +1,26 @@
[
(program)
(fn)
(lambda)
(let)
(each)
(for)
(match)
] @local.scope
; TODO: Add tests
; TODO: Improve queries
(program) @local.scope
((list
.
(symbol) @_special) @local.scope
(#any-of? @_special "while" "if" "when" "do" "collect" "icollect" "accumulate"))
(fn
name: (symbol) @local.definition.function
(#set! definition.function.scope "parent"))
(lambda
name: (symbol) @local.definition.function
(#set! definition.function.scope "parent"))
; TODO: use @local.definition.parameter for parameters
(binding
(symbol) @local.definition.var)
(for_clause
.
(symbol) @local.definition.var)
(symbol) @_call) @local.scope
(#any-of? @_call "let" "fn" "lambda" "λ" "while" "each" "for" "if" "when" "do" "collect" "icollect" "accumulate" "case" "match"))
(symbol) @local.reference
(list
.
(symbol) @_fn
(#any-of? @_fn "fn" "lambda" "λ")
.
[
(symbol) @local.definition.function
(multi_symbol
member: (symbol_fragment) @local.definition.function .)
]
(#set! definition.function.scope "parent")
.
(sequence
(symbol)* @local.definition.parameter
(#not-contains? @local.definition.parameter "&")))