mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
Add teal parser
This commit is contained in:
parent
93f9708a3c
commit
c2acddd651
4 changed files with 111 additions and 0 deletions
|
|
@ -269,6 +269,14 @@ list.fennel = {
|
||||||
maintainers = {'@TravonteD'},
|
maintainers = {'@TravonteD'},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.teal = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/euclidianAce/tree-sitter-teal",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
maintainers = {'@euclidianAce'},
|
||||||
|
}
|
||||||
|
|
||||||
list.ql = {
|
list.ql = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/tree-sitter/tree-sitter-ql",
|
url = "https://github.com/tree-sitter/tree-sitter-ql",
|
||||||
|
|
|
||||||
12
queries/teal/folds.scm
Normal file
12
queries/teal/folds.scm
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
[
|
||||||
|
(do_statement)
|
||||||
|
(for_statement)
|
||||||
|
(while_statement)
|
||||||
|
(repeat_statement)
|
||||||
|
(if_statement)
|
||||||
|
(function_statement)
|
||||||
|
(record_declaration)
|
||||||
|
(enum_declaration)
|
||||||
|
(functiondef)
|
||||||
|
(table_constructor)
|
||||||
|
] @fold
|
||||||
71
queries/teal/highlights.scm
Normal file
71
queries/teal/highlights.scm
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
(if_statement [ "if" "then" "end" ] @conditional)
|
||||||
|
(elseif_block [ "elseif" "then" ] @conditional)
|
||||||
|
(else_block [ "else" ] @conditional)
|
||||||
|
|
||||||
|
[ "else" "elseif" ] @conditional
|
||||||
|
(for_statement [ "for" ] @repeat)
|
||||||
|
(for_statement "in" @keyword)
|
||||||
|
(for_body [ "do" "end" ] @repeat)
|
||||||
|
(while_statement [ "while" ] @repeat)
|
||||||
|
(while_body [ "do" "end" ] @repeat)
|
||||||
|
(repeat_statement [ "repeat" "until" ] @repeat)
|
||||||
|
(do_statement [ "do" "end" ] @keyword)
|
||||||
|
(record_declaration [ "record" "end" ] @keyword)
|
||||||
|
(enum_declaration [ "enum" "end" ] @keyword)
|
||||||
|
|
||||||
|
[ "in" "local" "return" (break) (goto) ] @keyword
|
||||||
|
(label) @label
|
||||||
|
|
||||||
|
; Global isn't a real keyword, but it gets special treatment
|
||||||
|
(var_declaration "global" @keyword)
|
||||||
|
(function_statement "global" @keyword)
|
||||||
|
|
||||||
|
|
||||||
|
; Ops
|
||||||
|
[ "not" "and" "or" "as" "is" ] @keyword.operator
|
||||||
|
|
||||||
|
[ "=" "~=" "==" "<=" ">=" "<" ">"
|
||||||
|
"+" "-" "%" "/" "//" "*" "^"
|
||||||
|
"&" "~" "|" ">>" "<<"
|
||||||
|
".." "#"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[ "," "." ":"] @punctuation.delimiter
|
||||||
|
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
||||||
|
("<" @punctuation.bracket
|
||||||
|
. (typearg)+ .
|
||||||
|
">" @punctuation.bracket)
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
(boolean) @boolean
|
||||||
|
(nil) @constant.builtin
|
||||||
|
(varargs) @constant
|
||||||
|
|
||||||
|
; function stuffs
|
||||||
|
(functiondef ["function" "end"] @keyword.function)
|
||||||
|
|
||||||
|
(function_statement [(function_name) (function_name (*))] @function)
|
||||||
|
(function_statement ["function" "end"] @keyword.function)
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
(identifier) @function . (arguments))
|
||||||
|
|
||||||
|
(arg_name) @parameter
|
||||||
|
|
||||||
|
; type stuffs
|
||||||
|
(type_declaration "type" @keyword)
|
||||||
|
(type_declaration (type_name) @type)
|
||||||
|
(simple_type) @type
|
||||||
|
(function_type "function" @type)
|
||||||
|
(record_name) @type
|
||||||
|
(enum_name) @type
|
||||||
|
(typearg) @parameter
|
||||||
|
|
||||||
|
(table_constructor ["{" "}"] @constructor)
|
||||||
|
(comment) @comment
|
||||||
|
(string) @string
|
||||||
|
(number) @number
|
||||||
|
; TODO (label_statement) @label
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
|
|
||||||
20
queries/teal/locals.scm
Normal file
20
queries/teal/locals.scm
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
(var_declaration
|
||||||
|
(var (identifier)) @definition.var)
|
||||||
|
|
||||||
|
(var_assignment
|
||||||
|
(var (identifier)) @definition.associated @definition.var)
|
||||||
|
|
||||||
|
(arg_name) @definition.parameter
|
||||||
|
|
||||||
|
(functiondef) @scope
|
||||||
|
(function_statement (function_name) @definition.function) @scope
|
||||||
|
|
||||||
|
(program) @scope
|
||||||
|
(if_statement) @scope
|
||||||
|
(for_statement (for_body) @scope)
|
||||||
|
(repeat_statement) @scope
|
||||||
|
(while_statement (while_body) @scope)
|
||||||
|
(do_statement) @scope
|
||||||
|
|
||||||
|
(identifier) @reference
|
||||||
Loading…
Add table
Add a link
Reference in a new issue