mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Add fennel support
This commit is contained in:
parent
cf37d143bf
commit
72905524c2
4 changed files with 176 additions and 0 deletions
|
|
@ -252,6 +252,7 @@ List of currently supported languages:
|
|||
- [x] css (maintained by @TravonteD)
|
||||
- [x] dart (maintained by @Akin909)
|
||||
- [ ] elm
|
||||
- [x] fennel (maintained by @TravonteD)
|
||||
- [x] go (maintained by @theHamsta, @WinWisely268)
|
||||
- [ ] haskell
|
||||
- [x] html (maintained by @TravonteD)
|
||||
|
|
|
|||
|
|
@ -221,6 +221,13 @@ list.rst = {
|
|||
}
|
||||
}
|
||||
|
||||
list.fennel = {
|
||||
install_info = {
|
||||
url = "https://github.com/travonted/tree-sitter-fennel",
|
||||
files = { "src/parser.c" },
|
||||
}
|
||||
}
|
||||
|
||||
-- Parsers for injections
|
||||
list.regex = {
|
||||
install_info = {
|
||||
|
|
|
|||
123
queries/fennel/highlights.scm
Normal file
123
queries/fennel/highlights.scm
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
(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
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
; hash function
|
||||
"#" @function
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(lambda_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_call
|
||||
name: (identifier) @function)
|
||||
|
||||
(field_expression
|
||||
(identifier)
|
||||
"." @punctuation.delimiter
|
||||
(identifier) @function)
|
||||
|
||||
(field_expression
|
||||
(identifier)
|
||||
(field) @function)
|
||||
|
||||
(parameters (identifier) @parameter)
|
||||
45
queries/fennel/locals.scm
Normal file
45
queries/fennel/locals.scm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
; Scope
|
||||
[
|
||||
(program)
|
||||
(function_definition)
|
||||
(lambda_definition)
|
||||
(let_definition)
|
||||
] @scope
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
name: (identifier) @definition.function)
|
||||
(lambda_definition
|
||||
name: (identifier) @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)
|
||||
|
||||
; references
|
||||
(set
|
||||
(assignment (identifier) @reference))
|
||||
(function_call
|
||||
name: (identifier) @reference)
|
||||
(identifier) @reference
|
||||
Loading…
Add table
Add a link
Reference in a new issue