diff options
| author | Corey Williamson <euclidianAce@protonmail.com> | 2020-10-04 19:39:12 -0500 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-10-05 12:02:59 +0200 |
| commit | c2acddd651f5a1619e6378d2b3698465a810e485 (patch) | |
| tree | 17557460fcb038b27faefc3c92ded3fa3968a519 /queries/teal | |
| parent | Dart highlights: Reset highlight in interpolation (diff) | |
| download | nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar.gz nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar.bz2 nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar.lz nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar.xz nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.tar.zst nvim-treesitter-c2acddd651f5a1619e6378d2b3698465a810e485.zip | |
Add teal parser
Diffstat (limited to 'queries/teal')
| -rw-r--r-- | queries/teal/folds.scm | 12 | ||||
| -rw-r--r-- | queries/teal/highlights.scm | 71 | ||||
| -rw-r--r-- | queries/teal/locals.scm | 20 |
3 files changed, 103 insertions, 0 deletions
diff --git a/queries/teal/folds.scm b/queries/teal/folds.scm new file mode 100644 index 000000000..1f8df9fb5 --- /dev/null +++ b/queries/teal/folds.scm @@ -0,0 +1,12 @@ +[ +(do_statement) +(for_statement) +(while_statement) +(repeat_statement) +(if_statement) +(function_statement) +(record_declaration) +(enum_declaration) +(functiondef) +(table_constructor) +] @fold diff --git a/queries/teal/highlights.scm b/queries/teal/highlights.scm new file mode 100644 index 000000000..6c7055d28 --- /dev/null +++ b/queries/teal/highlights.scm @@ -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 + diff --git a/queries/teal/locals.scm b/queries/teal/locals.scm new file mode 100644 index 000000000..5feb3e5f5 --- /dev/null +++ b/queries/teal/locals.scm @@ -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 |
