mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(idris): add parser and queries (#7274)
This commit is contained in:
parent
a67a312e7b
commit
8758abeb4d
7 changed files with 273 additions and 0 deletions
|
|
@ -291,6 +291,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [hurl](https://github.com/pfeiferj/tree-sitter-hurl) (maintained by @pfeiferj)
|
- [x] [hurl](https://github.com/pfeiferj/tree-sitter-hurl) (maintained by @pfeiferj)
|
||||||
- [x] [hyprlang](https://github.com/luckasRanarison/tree-sitter-hyprlang) (maintained by @luckasRanarison)
|
- [x] [hyprlang](https://github.com/luckasRanarison/tree-sitter-hyprlang) (maintained by @luckasRanarison)
|
||||||
- [x] [idl](https://github.com/cathaysia/tree-sitter-idl) (maintained by @cathaysia)
|
- [x] [idl](https://github.com/cathaysia/tree-sitter-idl) (maintained by @cathaysia)
|
||||||
|
- [x] [idris](https://github.com/kayhide/tree-sitter-idris) (maintained by @srghma)
|
||||||
- [x] [ini](https://github.com/justinmk/tree-sitter-ini) (experimental, maintained by @theHamsta)
|
- [x] [ini](https://github.com/justinmk/tree-sitter-ini) (experimental, maintained by @theHamsta)
|
||||||
- [x] [inko](https://github.com/inko-lang/tree-sitter-inko) (maintained by @yorickpeterse)
|
- [x] [inko](https://github.com/inko-lang/tree-sitter-inko) (maintained by @yorickpeterse)
|
||||||
- [x] [ipkg](https://github.com/srghma/tree-sitter-ipkg) (maintained by @srghma)
|
- [x] [ipkg](https://github.com/srghma/tree-sitter-ipkg) (maintained by @srghma)
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,9 @@
|
||||||
"idl": {
|
"idl": {
|
||||||
"revision": "86ff7f19747a761dc8ba72f4045fd64aed94ba4c"
|
"revision": "86ff7f19747a761dc8ba72f4045fd64aed94ba4c"
|
||||||
},
|
},
|
||||||
|
"idris": {
|
||||||
|
"revision": "c56a25cf57c68ff929356db25505c1cc4c7820f6"
|
||||||
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"revision": "962568c9efa71d25720ab42c5d36e222626ef3a6"
|
"revision": "962568c9efa71d25720ab42c5d36e222626ef3a6"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1051,6 +1051,15 @@ list.idl = {
|
||||||
maintainers = { "@cathaysia" },
|
maintainers = { "@cathaysia" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.idris = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/kayhide/tree-sitter-idris",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
filetype = "idris2",
|
||||||
|
maintainers = { "@srghma" },
|
||||||
|
}
|
||||||
|
|
||||||
list.ini = {
|
list.ini = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/justinmk/tree-sitter-ini",
|
url = "https://github.com/justinmk/tree-sitter-ini",
|
||||||
|
|
|
||||||
1
queries/idris/folds.scm
Normal file
1
queries/idris/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
(function) @fold
|
||||||
224
queries/idris/highlights.scm
Normal file
224
queries/idris/highlights.scm
Normal file
|
|
@ -0,0 +1,224 @@
|
||||||
|
; ------------------------------------------------------------------------------
|
||||||
|
; Literals and comments
|
||||||
|
[
|
||||||
|
(integer)
|
||||||
|
(quantity)
|
||||||
|
] @number
|
||||||
|
|
||||||
|
(literal
|
||||||
|
(number)) @number.float
|
||||||
|
|
||||||
|
(char) @character
|
||||||
|
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(pat_string)
|
||||||
|
(triple_quote_string)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(comment) @comment @spell
|
||||||
|
|
||||||
|
((comment) @comment.documentation
|
||||||
|
(#lua-match? @comment.documentation "^|||"))
|
||||||
|
|
||||||
|
(unit) @constant
|
||||||
|
|
||||||
|
; more general captures are moved to the top
|
||||||
|
; before overwritten later by more specific captures
|
||||||
|
[
|
||||||
|
(loname)
|
||||||
|
(caname)
|
||||||
|
] @variable
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------------
|
||||||
|
; Punctuation
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"@{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"[<"
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
(comma)
|
||||||
|
(colon)
|
||||||
|
(pat_op)
|
||||||
|
(tuple_operator)
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
(pat_name
|
||||||
|
(loname) @variable.parameter)
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------------
|
||||||
|
; Types
|
||||||
|
(signature
|
||||||
|
(loname) @type)
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------------
|
||||||
|
; Keywords, operators, imports
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
"case"
|
||||||
|
"of"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"import"
|
||||||
|
"module"
|
||||||
|
"namespace"
|
||||||
|
"parameters"
|
||||||
|
] @keyword.import
|
||||||
|
|
||||||
|
[
|
||||||
|
(operator)
|
||||||
|
(equal)
|
||||||
|
(wildcard)
|
||||||
|
"."
|
||||||
|
"|"
|
||||||
|
"=>"
|
||||||
|
"⇒"
|
||||||
|
"<="
|
||||||
|
"⇐"
|
||||||
|
"->"
|
||||||
|
"→"
|
||||||
|
"<-"
|
||||||
|
"←"
|
||||||
|
"\\"
|
||||||
|
"`"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(qualified_loname
|
||||||
|
(caname) @module)
|
||||||
|
|
||||||
|
(qualified_caname
|
||||||
|
(caname) @constructor)
|
||||||
|
|
||||||
|
(qualified_operator
|
||||||
|
(caname) @module)
|
||||||
|
|
||||||
|
(import
|
||||||
|
(caname) @module)
|
||||||
|
|
||||||
|
(module
|
||||||
|
(caname) @module)
|
||||||
|
|
||||||
|
[
|
||||||
|
(where)
|
||||||
|
"rewrite"
|
||||||
|
"interface"
|
||||||
|
"implementation"
|
||||||
|
"using"
|
||||||
|
"record"
|
||||||
|
"as"
|
||||||
|
"do"
|
||||||
|
(forall)
|
||||||
|
(fixity)
|
||||||
|
(impossible)
|
||||||
|
(with)
|
||||||
|
(proof)
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"data"
|
||||||
|
"let"
|
||||||
|
"in"
|
||||||
|
(visibility)
|
||||||
|
(totality)
|
||||||
|
] @keyword.modifier
|
||||||
|
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"$="
|
||||||
|
":="
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(hole) @label
|
||||||
|
|
||||||
|
[
|
||||||
|
(pragma_language)
|
||||||
|
(pragma_default)
|
||||||
|
(pragma_builtin)
|
||||||
|
(pragma_name)
|
||||||
|
(pragma_ambiguity_depth)
|
||||||
|
(pragma_auto_implicit_depth)
|
||||||
|
(pragma_logging)
|
||||||
|
(pragma_prefix_record_projections)
|
||||||
|
(pragma_transform)
|
||||||
|
(pragma_unbound_implicits)
|
||||||
|
(pragma_auto_lazy)
|
||||||
|
(pragma_search_timeout)
|
||||||
|
(pragma_nf_metavar_threshold)
|
||||||
|
(pragma_cg)
|
||||||
|
(pragma_allow_overloads)
|
||||||
|
(pragma_deprecate)
|
||||||
|
(pragma_inline)
|
||||||
|
(pragma_noinline)
|
||||||
|
(pragma_tcinline)
|
||||||
|
(pragma_hide)
|
||||||
|
(pragma_unhide)
|
||||||
|
(pragma_unsafe)
|
||||||
|
(pragma_spec)
|
||||||
|
(pragma_foreign)
|
||||||
|
(pragma_foreign_impl)
|
||||||
|
(pragma_export)
|
||||||
|
(pragma_nomangle)
|
||||||
|
(pragma_hint)
|
||||||
|
(pragma_defaulthint)
|
||||||
|
(pragma_globalhint)
|
||||||
|
(pragma_extern)
|
||||||
|
(pragma_macro)
|
||||||
|
(pragma_start)
|
||||||
|
(pragma_rewrite)
|
||||||
|
(pragma_pair)
|
||||||
|
(pragma_integerLit)
|
||||||
|
(pragma_stringLit)
|
||||||
|
(pragma_charLit)
|
||||||
|
(pragma_doubleLit)
|
||||||
|
(pragma_TTImpLit)
|
||||||
|
(pragma_declsLit)
|
||||||
|
(pragma_nameLit)
|
||||||
|
(pragma_runElab)
|
||||||
|
(pragma_search)
|
||||||
|
(pragma_World)
|
||||||
|
(pragma_MkWorld)
|
||||||
|
(pragma_syntactic)
|
||||||
|
] @label
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------------
|
||||||
|
; Functions and variables
|
||||||
|
(exp_name
|
||||||
|
(loname) @function.call)
|
||||||
|
|
||||||
|
(constructor
|
||||||
|
"constructor" @keyword.function
|
||||||
|
.
|
||||||
|
(caname) @constructor)
|
||||||
|
|
||||||
|
(exp_record_access
|
||||||
|
field: (_) @variable.member)
|
||||||
|
|
||||||
|
(signature
|
||||||
|
name: (loname) @function)
|
||||||
|
|
||||||
|
(function
|
||||||
|
(lhs
|
||||||
|
(funvar
|
||||||
|
subject: [
|
||||||
|
(loname)
|
||||||
|
(caname)
|
||||||
|
] @function)))
|
||||||
|
|
||||||
|
(data
|
||||||
|
name: (data_name) @type)
|
||||||
|
|
||||||
|
(interface_head
|
||||||
|
name: (interface_name) @type)
|
||||||
|
|
||||||
|
(implementation_head
|
||||||
|
(interface_name) @type)
|
||||||
2
queries/idris/injections.scm
Normal file
2
queries/idris/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
33
queries/idris/locals.scm
Normal file
33
queries/idris/locals.scm
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
(signature
|
||||||
|
name: (loname)) @local.definition.var
|
||||||
|
|
||||||
|
(signature
|
||||||
|
name: (caname)) @local.definition.type
|
||||||
|
|
||||||
|
(function
|
||||||
|
(lhs
|
||||||
|
(funvar
|
||||||
|
subject: (loname)))) @local.definition.function
|
||||||
|
|
||||||
|
(function
|
||||||
|
(lhs
|
||||||
|
(funvar
|
||||||
|
subject: (caname)))) @local.definition.function
|
||||||
|
|
||||||
|
(type_var
|
||||||
|
(loname)) @local.definition.type
|
||||||
|
|
||||||
|
(pat_name
|
||||||
|
(loname)) @local.definition.var
|
||||||
|
|
||||||
|
(pat_name
|
||||||
|
(caname)) @local.definition.var
|
||||||
|
|
||||||
|
(exp_name
|
||||||
|
(loname)) @local.reference
|
||||||
|
|
||||||
|
(exp_name
|
||||||
|
(caname)) @local.reference
|
||||||
|
|
||||||
|
(function
|
||||||
|
(rhs) @local.scope)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue