mirror of
https://github.com/nvim-treesitter/nvim-treesitter
synced 2024-09-16 14:34:05 +02:00
feat(gap): add gap and gaptst parser and queries (#7110)
This commit is contained in:
parent
4e47268c6d
commit
2d8f0f37c4
10 changed files with 326 additions and 0 deletions
|
@ -241,6 +241,8 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna)
|
||||
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
|
||||
- [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn)
|
||||
- [x] [GAP system](https://github.com/gap-system/tree-sitter-gap) (maintained by @reiniscirpons)
|
||||
- [x] [GAP system test files](https://github.com/gap-system/tree-sitter-gaptst) (maintained by @reiniscirpons)
|
||||
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @PrestonKnopp)
|
||||
- [x] [gdshader](https://github.com/GodOfAvacyn/tree-sitter-gdshader) (maintained by @godofavacyn)
|
||||
- [x] [git_config](https://github.com/the-mikedavis/tree-sitter-git-config) (maintained by @amaanq)
|
||||
|
|
|
@ -203,6 +203,12 @@
|
|||
"fusion": {
|
||||
"revision": "19db2f47ba4c3a0f6238d4ae0e2abfca16e61dd6"
|
||||
},
|
||||
"gap": {
|
||||
"revision": "141b063335e85299bde3f61b4888d02d674a1abc"
|
||||
},
|
||||
"gaptst": {
|
||||
"revision": "e0723dc6136309b3d5904dad2c73ef71267428c1"
|
||||
},
|
||||
"gdscript": {
|
||||
"revision": "1f1e782fe2600f50ae57b53876505b8282388d77"
|
||||
},
|
||||
|
|
|
@ -633,6 +633,24 @@ list.fusion = {
|
|||
maintainers = { "@jirgn" },
|
||||
}
|
||||
|
||||
list.gap = {
|
||||
install_info = {
|
||||
url = "https://github.com/gap-system/tree-sitter-gap",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
},
|
||||
maintainers = { "@reiniscirpons" },
|
||||
readme_name = "GAP system",
|
||||
}
|
||||
|
||||
list.gaptst = {
|
||||
install_info = {
|
||||
url = "https://github.com/gap-system/tree-sitter-gaptst",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
},
|
||||
maintainers = { "@reiniscirpons" },
|
||||
readme_name = "GAP system test files",
|
||||
}
|
||||
|
||||
list.gdscript = {
|
||||
install_info = {
|
||||
url = "https://github.com/PrestonKnopp/tree-sitter-gdscript",
|
||||
|
|
12
queries/gap/folds.scm
Normal file
12
queries/gap/folds.scm
Normal file
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
(if_statement)
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
(while_statement)
|
||||
(repeat_statement)
|
||||
(for_statement)
|
||||
(atomic_statement)
|
||||
(lambda)
|
||||
(function)
|
||||
(atomic_function)
|
||||
] @fold
|
208
queries/gap/highlights.scm
Normal file
208
queries/gap/highlights.scm
Normal file
|
@ -0,0 +1,208 @@
|
|||
(identifier) @variable
|
||||
|
||||
; Functions
|
||||
(assignment_statement
|
||||
left: (identifier) @function
|
||||
right: (function))
|
||||
|
||||
(assignment_statement
|
||||
left: (identifier) @function
|
||||
right: (atomic_function))
|
||||
|
||||
(assignment_statement
|
||||
left: (identifier) @function
|
||||
right: (lambda))
|
||||
|
||||
(call
|
||||
function: (identifier) @function.call)
|
||||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "Assert" "Info" "IsBound" "Unbind" "TryNextMethod"))
|
||||
|
||||
(parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(qualified_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(qualified_parameters
|
||||
(qualified_identifier
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(lambda_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; arg is treated specially when it is the only parameter of a function
|
||||
((parameters
|
||||
.
|
||||
(identifier) @variable.parameter.builtin .)
|
||||
(#eq? @variable.parameter.builtin "arg"))
|
||||
|
||||
((qualified_parameters
|
||||
.
|
||||
(identifier) @variable.parameter.builtin .)
|
||||
(#eq? @variable.parameter.builtin "arg"))
|
||||
|
||||
((qualified_parameters
|
||||
.
|
||||
(qualified_identifier
|
||||
(identifier) @variable.parameter.builtin) .)
|
||||
(#eq? @variable.parameter.builtin "arg"))
|
||||
|
||||
((lambda_parameters
|
||||
.
|
||||
(identifier) @variable.parameter.builtin .)
|
||||
(#eq? @variable.parameter.builtin "arg"))
|
||||
|
||||
; Literals
|
||||
(bool) @constant.builtin
|
||||
|
||||
(integer) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(string) @string
|
||||
|
||||
(char) @character
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
[
|
||||
(help_topic)
|
||||
(help_book)
|
||||
] @string.special
|
||||
|
||||
(tilde) @variable.builtin
|
||||
|
||||
; Record selectors
|
||||
(record_entry
|
||||
left: [
|
||||
(identifier)
|
||||
(integer)
|
||||
] @variable.member)
|
||||
|
||||
(record_selector
|
||||
selector: [
|
||||
(identifier)
|
||||
(integer)
|
||||
] @variable.member)
|
||||
|
||||
(component_selector
|
||||
selector: [
|
||||
(identifier)
|
||||
(integer)
|
||||
] @variable.member)
|
||||
|
||||
(function_call_option
|
||||
[
|
||||
(identifier)
|
||||
(record_entry ;Record entries specify global properties in function calls
|
||||
left: [
|
||||
(identifier)
|
||||
(integer)
|
||||
])
|
||||
] @property)
|
||||
|
||||
(help_statement
|
||||
(help_selector) @property)
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"^"
|
||||
"->"
|
||||
":="
|
||||
"<"
|
||||
"<="
|
||||
"<>"
|
||||
"="
|
||||
">"
|
||||
">="
|
||||
".."
|
||||
(ellipsis)
|
||||
] @operator
|
||||
|
||||
(help_statement
|
||||
(help_operator) @operator)
|
||||
|
||||
; Keywords
|
||||
[
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
"atomic"
|
||||
(quit_statement)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"function"
|
||||
"local"
|
||||
"end"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"mod"
|
||||
"not"
|
||||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
"rec" @keyword.type
|
||||
|
||||
[
|
||||
"readonly"
|
||||
"readwrite"
|
||||
] @keyword.modifier
|
||||
|
||||
(atomic_function
|
||||
"atomic" @keyword.modifier)
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"do"
|
||||
"od"
|
||||
"repeat"
|
||||
"until"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"elif"
|
||||
"else"
|
||||
"fi"
|
||||
] @keyword.conditional
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
(pragma) @keyword.directive
|
||||
|
||||
;Punctuation
|
||||
[
|
||||
","
|
||||
";"
|
||||
"."
|
||||
"!."
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"!["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(help_statement
|
||||
"?" @punctuation.special)
|
||||
|
||||
;Comments
|
||||
(comment) @comment @spell
|
2
queries/gap/injections.scm
Normal file
2
queries/gap/injections.scm
Normal file
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
43
queries/gap/locals.scm
Normal file
43
queries/gap/locals.scm
Normal file
|
@ -0,0 +1,43 @@
|
|||
[
|
||||
(lambda)
|
||||
(function)
|
||||
(atomic_function)
|
||||
] @local.scope
|
||||
|
||||
(parameters
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(qualified_parameters
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(qualified_parameters
|
||||
(qualified_identifier
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(lambda_parameters
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(locals
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(record_entry
|
||||
left: [
|
||||
(identifier)
|
||||
(integer)
|
||||
] @local.definition.field)
|
||||
|
||||
(assignment_statement
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_statement
|
||||
identifier: (identifier) @local.definition.var)
|
||||
|
||||
(assignment_statement
|
||||
left: (identifier) @local.definition.function
|
||||
right: [
|
||||
(lambda)
|
||||
(function)
|
||||
(atomic_function)
|
||||
])
|
||||
|
||||
(identifier) @local.reference
|
7
queries/gaptst/folds.scm
Normal file
7
queries/gaptst/folds.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
(if_statement)
|
||||
(else_clause)
|
||||
(local_statement)
|
||||
(exec_statement)
|
||||
(test_case)
|
||||
] @fold
|
19
queries/gaptst/highlights.scm
Normal file
19
queries/gaptst/highlights.scm
Normal file
|
@ -0,0 +1,19 @@
|
|||
(output_line) @markup.raw.block
|
||||
|
||||
[
|
||||
"#@local"
|
||||
"#@exec"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"gap> "
|
||||
"> "
|
||||
] @keyword.debug
|
||||
|
||||
[
|
||||
"#@if"
|
||||
"#@else"
|
||||
"#@fi"
|
||||
] @keyword.conditional
|
||||
|
||||
(comment) @comment @spell
|
9
queries/gaptst/injections.scm
Normal file
9
queries/gaptst/injections.scm
Normal file
|
@ -0,0 +1,9 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((gap_expression) @injection.content
|
||||
(#set! injection.language "gap"))
|
||||
|
||||
((input_line) @injection.content
|
||||
(#set! injection.language "gap")
|
||||
(#set! injection.combined))
|
Loading…
Reference in a new issue