diff options
| author | Connor Lay (Clay) <connorlay@pm.me> | 2022-02-05 11:44:06 -0800 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-02-15 19:01:02 +0100 |
| commit | 4e902798210ba51ac94ea25a0002e8a2065464dc (patch) | |
| tree | 98fa1843de7722ca2c04ab08c4d95b4239505882 /queries/gleam | |
| parent | Add Gleam parser (diff) | |
| download | nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar.gz nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar.bz2 nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar.lz nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar.xz nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.tar.zst nvim-treesitter-4e902798210ba51ac94ea25a0002e8a2065464dc.zip | |
Add Gleam highlights
Diffstat (limited to 'queries/gleam')
| -rw-r--r-- | queries/gleam/highlights.scm | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm new file mode 100644 index 000000000..e39a9c92f --- /dev/null +++ b/queries/gleam/highlights.scm @@ -0,0 +1,167 @@ +; Keywords +[ + "as" + "const" + "external" + "let" + "opaque" + "pub" + "todo" + "try" +] @keyword + +; Function Keywords +[ + "fn" + "type" +] @keyword.function + +; Imports +[ + "import" +] @include + +; Conditionals +[ + "case" + "if" +] @conditional + +; Exceptions +[ + "assert" +] @exception + +; Punctuation +[ + "(" + ")" + "<<" + ">>" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + "." +] @punctuation.delimiter + +[ + "#" +] @punctuation.special + +; Operators +[ + "%" + "&&" + "*" + "*." + "+" + "+." + "-" + "-." + "->" + ".." + "/" + "/." + ":" + "<" + "<." + "<=" + "<=." + "=" + "==" + ">" + ">." + ">=" + ">=." + "|>" + "||" +] @operator + +; Comments +[ + (module_comment) + (statement_comment) + (comment) +] @comment + +; Unused Identifiers +[ + (discard) + (hole) +] @comment + +; Modules & Imports +(module ("/" @namespace)?) @namespace +(remote_type_identifier module: (identifier) @namespace) +(import alias: ((identifier) @namespace)?) + + +; Identifiers +(identifier) @variable + +; Strings +(string) @string + +; TODO Escape Sequences + +; TODO: Bit Strings + +; Numbers +[ + (integer) + (float) +] @number + +; Function Parameter Labels +(function_call arguments: (arguments (argument label: (label) @symbol ":" @symbol))) +(function_parameter label: (label)? @symbol name: (identifier) @parameter (":" @parameter)?) + +; Records +(record arguments: (arguments (argument label: (label) @property ":" @property)?)) +(record_pattern_argument label: (label) @property ":" @property) +(record_update_argument label: (label) @property ":" @property) + +; Type Constructors +(type_constructor_argument label: (label) @property ":" @property) + +; Types +((type_identifier) @type (#not-any-of? @type "True" "False")) + +; Booleans +((type_identifier) @boolean (#any-of? @boolean "True" "False")) + +; Type Variables +(type_var) @type + +; Tuples +(tuple_access index: (integer) @operator) + +; Functions +(public_function name: (identifier) @function) + +(function name: (identifier) @function) + +(function_call function: (identifier) @function) + +(function_call function: (field_access record: (identifier) @namespace field: (label) @function)) + +; Unqualified Imports +(unqualified_import name: (identifier) @function) + +; External Functions +(public_external_function name: (identifier) @function) +(external_function_body (string) @namespace . (string) @function) + +; Pipe Operator +(binary_expression operator: "|>" right: (identifier) @function) + +; Parser Errors +(ERROR) @error + +; TODO does nvim-treesitter support #is-not? local matches for highlights? +; see https://github.com/tree-sitter/tree-sitter/pull/448 for documentation |
