diff options
| author | Corey Williamson <euclidianAce@protonmail.com> | 2020-12-16 16:42:33 -0600 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-12-17 00:44:01 +0100 |
| commit | cfc68f929c7edfede870c3e3e1281a9705d1d6e6 (patch) | |
| tree | cbe48ca1e710f38fe3fe3da5d650cbe30da03a9c /queries | |
| parent | Remove duplicate capture for `function_definition` (diff) | |
| download | nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar.gz nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar.bz2 nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar.lz nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar.xz nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.tar.zst nvim-treesitter-cfc68f929c7edfede870c3e3e1281a9705d1d6e6.zip | |
Update for teal-0.9
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/teal/folds.scm | 5 | ||||
| -rw-r--r-- | queries/teal/highlights.scm | 109 | ||||
| -rw-r--r-- | queries/teal/locals.scm | 9 |
3 files changed, 76 insertions, 47 deletions
diff --git a/queries/teal/folds.scm b/queries/teal/folds.scm index 0c0bf4adb..e2defecdf 100644 --- a/queries/teal/folds.scm +++ b/queries/teal/folds.scm @@ -7,6 +7,9 @@ (function_statement) (record_declaration) (enum_declaration) -;(functiondef) +(anon_function) (table_constructor) ] @fold + +(record_declaration + (anon_record) @fold) diff --git a/queries/teal/highlights.scm b/queries/teal/highlights.scm index 782ae1c01..28d1f4b0f 100644 --- a/queries/teal/highlights.scm +++ b/queries/teal/highlights.scm @@ -1,25 +1,16 @@ -(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 +;; Basic statements/Keywords +[ "if" "then" "elseif" "else" ] @conditional +[ "for" "while" "repeat" "until" ] @repeat +[ "in" "local" "return" (break) (goto) "do" "end" ] @keyword (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) +(type_declaration "global" @keyword) (function_statement "global" @keyword) - +(record_declaration "global" @keyword) +(enum_declaration "global" @keyword) ;; Ops [ "not" "and" "or" "as" "is" ] @keyword.operator @@ -27,44 +18,80 @@ [ "=" "~=" "==" "<=" ">=" "<" ">" "+" "-" "%" "/" "//" "*" "^" "&" "~" "|" ">>" "<<" -".." "#" - ] @operator +".." "#" ] @operator -[ "," "." ":"] @punctuation.delimiter -[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket -(typeargs ["<" ">"] @punctuation.bracket) +;; Functions +(function_statement + "function" @keyword.function + . name: (_) @function) +(anon_function + "function" @keyword.function) +(function_body "end" @keyword.function) -(identifier) @variable -(boolean) @boolean -(nil) @constant.builtin -(varargs) @constant +(arg name: (identifier) @parameter) -;; function stuffs; +(function_signature + (arguments + . (arg name: (identifier) @variable.builtin)) + (#eq? @variable.builtin "self")) -(function_statement (function_name) @function) -(function_statement ["function" "end"] @keyword.function) +(typeargs + "<" @punctuation.bracket + . (identifier) @parameter + . ("," . (identifier) @parameter)* + . ">" @punctuation.bracket) (function_call - (identifier) @function . (arguments)) + (identifier) @function . (arguments)) +(function_call + (index (_) key: (identifier) @function) . (arguments)) +(function_call + (method_index (_) key: (identifier) @function) . (arguments)) -(arg - name: (identifier) @parameter) +;; Types +(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_name) @type) (simple_type) @type +(type_index) @type +(type_union "|" @operator) (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 -(string) @string +(shebang_comment) @comment +(identifier) @variable +((identifier) @variable.builtin + (#eq? @variable.builtin "self")) +(nil) @constant.builtin (number) @number -;; TODO (label_statement) @label +(string) @string +(table_constructor ["{" "}"] @constructor) +(varargs "..." @constant.builtin) +[ "," "." ":" ";" ] @punctuation.delimiter (ERROR) @error diff --git a/queries/teal/locals.scm b/queries/teal/locals.scm index cf82c4d44..86b6a9354 100644 --- a/queries/teal/locals.scm +++ b/queries/teal/locals.scm @@ -3,13 +3,11 @@ (var (identifier)) @definition.var) (var_assignment - (var (identifier)) @definition.var) + (var (identifier) @definition.var) @definition.associated) -(arg - name: (identifier) @definition.parameter) -(typeargs (identifier) @definition.type) +(arg name: (identifier) @definition.parameter) -;(functiondef) @scope +(anon_function) @scope ((function_statement (function_name) @definition.function) @scope (#set! definition.function.scope "parent")) @@ -22,3 +20,4 @@ (do_statement) @scope (identifier) @reference + |
