mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
Update for teal-0.9
This commit is contained in:
parent
775021cbd5
commit
cfc68f929c
3 changed files with 76 additions and 47 deletions
|
|
@ -7,6 +7,9 @@
|
||||||
(function_statement)
|
(function_statement)
|
||||||
(record_declaration)
|
(record_declaration)
|
||||||
(enum_declaration)
|
(enum_declaration)
|
||||||
;(functiondef)
|
(anon_function)
|
||||||
(table_constructor)
|
(table_constructor)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
||||||
|
(record_declaration
|
||||||
|
(anon_record) @fold)
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,16 @@
|
||||||
(if_statement [ "if" "then" "end" ] @conditional)
|
|
||||||
(elseif_block [ "elseif" "then" ] @conditional)
|
|
||||||
(else_block [ "else" ] @conditional)
|
|
||||||
|
|
||||||
[ "else" "elseif" ] @conditional
|
;; Basic statements/Keywords
|
||||||
(for_statement [ "for" ] @repeat)
|
[ "if" "then" "elseif" "else" ] @conditional
|
||||||
(for_statement "in" @keyword)
|
[ "for" "while" "repeat" "until" ] @repeat
|
||||||
(for_body [ "do" "end" ] @repeat)
|
[ "in" "local" "return" (break) (goto) "do" "end" ] @keyword
|
||||||
(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
|
(label) @label
|
||||||
|
|
||||||
; Global isn't a real keyword, but it gets special treatment
|
;; Global isn't a real keyword, but it gets special treatment in these places
|
||||||
(var_declaration "global" @keyword)
|
(var_declaration "global" @keyword)
|
||||||
|
(type_declaration "global" @keyword)
|
||||||
(function_statement "global" @keyword)
|
(function_statement "global" @keyword)
|
||||||
|
(record_declaration "global" @keyword)
|
||||||
|
(enum_declaration "global" @keyword)
|
||||||
|
|
||||||
;; Ops
|
;; Ops
|
||||||
[ "not" "and" "or" "as" "is" ] @keyword.operator
|
[ "not" "and" "or" "as" "is" ] @keyword.operator
|
||||||
|
|
@ -27,44 +18,80 @@
|
||||||
[ "=" "~=" "==" "<=" ">=" "<" ">"
|
[ "=" "~=" "==" "<=" ">=" "<" ">"
|
||||||
"+" "-" "%" "/" "//" "*" "^"
|
"+" "-" "%" "/" "//" "*" "^"
|
||||||
"&" "~" "|" ">>" "<<"
|
"&" "~" "|" ">>" "<<"
|
||||||
".." "#"
|
".." "#" ] @operator
|
||||||
] @operator
|
|
||||||
|
|
||||||
[ "," "." ":"] @punctuation.delimiter
|
;; Functions
|
||||||
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
(function_statement
|
||||||
(typeargs ["<" ">"] @punctuation.bracket)
|
"function" @keyword.function
|
||||||
|
. name: (_) @function)
|
||||||
|
(anon_function
|
||||||
|
"function" @keyword.function)
|
||||||
|
(function_body "end" @keyword.function)
|
||||||
|
|
||||||
(identifier) @variable
|
(arg name: (identifier) @parameter)
|
||||||
(boolean) @boolean
|
|
||||||
(nil) @constant.builtin
|
|
||||||
(varargs) @constant
|
|
||||||
|
|
||||||
;; function stuffs;
|
(function_signature
|
||||||
|
(arguments
|
||||||
|
. (arg name: (identifier) @variable.builtin))
|
||||||
|
(#eq? @variable.builtin "self"))
|
||||||
|
|
||||||
(function_statement (function_name) @function)
|
(typeargs
|
||||||
(function_statement ["function" "end"] @keyword.function)
|
"<" @punctuation.bracket
|
||||||
|
. (identifier) @parameter
|
||||||
|
. ("," . (identifier) @parameter)*
|
||||||
|
. ">" @punctuation.bracket)
|
||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
(identifier) @function . (arguments))
|
(identifier) @function . (arguments))
|
||||||
|
(function_call
|
||||||
|
(index (_) key: (identifier) @function) . (arguments))
|
||||||
|
(function_call
|
||||||
|
(method_index (_) key: (identifier) @function) . (arguments))
|
||||||
|
|
||||||
(arg
|
;; Types
|
||||||
name: (identifier) @parameter)
|
(record_declaration
|
||||||
|
. "record" @keyword
|
||||||
|
name: (identifier) @type)
|
||||||
|
(anon_record . "record" @keyword)
|
||||||
|
(record_body
|
||||||
|
(record_entry
|
||||||
|
. [ "record" "enum" ] @keyword
|
||||||
|
. key: (identifier) @type)
|
||||||
|
(record_entry
|
||||||
|
. "type" @keyword
|
||||||
|
. key: (identifier) @type . "="))
|
||||||
|
|
||||||
|
(enum_declaration
|
||||||
|
"enum" @keyword
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
;; type stuffs
|
|
||||||
(type_declaration "type" @keyword)
|
(type_declaration "type" @keyword)
|
||||||
(type_declaration (type_name) @type)
|
(type_declaration (type_name) @type)
|
||||||
(simple_type) @type
|
(simple_type) @type
|
||||||
|
(type_index) @type
|
||||||
|
(type_union "|" @operator)
|
||||||
(function_type "function" @type)
|
(function_type "function" @type)
|
||||||
(record_declaration
|
|
||||||
name: (identifier) @type)
|
|
||||||
(enum_declaration
|
|
||||||
name: (identifier) @type)
|
|
||||||
(typeargs (identifier) @parameter)
|
|
||||||
|
|
||||||
(table_constructor ["{" "}"] @constructor)
|
;; The rest of it
|
||||||
|
(var_declaration
|
||||||
|
(var name: (identifier) @variable))
|
||||||
|
(var_declaration
|
||||||
|
(var
|
||||||
|
"<" @punctuation.bracket
|
||||||
|
. attribute: (attribute) @attribute
|
||||||
|
. ">" @punctuation.bracket))
|
||||||
|
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
||||||
|
(boolean) @boolean
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
(string) @string
|
(shebang_comment) @comment
|
||||||
|
(identifier) @variable
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#eq? @variable.builtin "self"))
|
||||||
|
(nil) @constant.builtin
|
||||||
(number) @number
|
(number) @number
|
||||||
;; TODO (label_statement) @label
|
(string) @string
|
||||||
|
(table_constructor ["{" "}"] @constructor)
|
||||||
|
(varargs "..." @constant.builtin)
|
||||||
|
[ "," "." ":" ";" ] @punctuation.delimiter
|
||||||
|
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,11 @@
|
||||||
(var (identifier)) @definition.var)
|
(var (identifier)) @definition.var)
|
||||||
|
|
||||||
(var_assignment
|
(var_assignment
|
||||||
(var (identifier)) @definition.var)
|
(var (identifier) @definition.var) @definition.associated)
|
||||||
|
|
||||||
(arg
|
(arg name: (identifier) @definition.parameter)
|
||||||
name: (identifier) @definition.parameter)
|
|
||||||
(typeargs (identifier) @definition.type)
|
|
||||||
|
|
||||||
;(functiondef) @scope
|
(anon_function) @scope
|
||||||
((function_statement
|
((function_statement
|
||||||
(function_name) @definition.function) @scope
|
(function_name) @definition.function) @scope
|
||||||
(#set! definition.function.scope "parent"))
|
(#set! definition.function.scope "parent"))
|
||||||
|
|
@ -22,3 +20,4 @@
|
||||||
(do_statement) @scope
|
(do_statement) @scope
|
||||||
|
|
||||||
(identifier) @reference
|
(identifier) @reference
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue