aboutsummaryrefslogtreecommitdiffstats
path: root/queries
diff options
context:
space:
mode:
authorMae Brooks <138945353+MaeBrooks@users.noreply.github.com>2024-10-15 18:14:39 -0700
committerGitHub <noreply@github.com>2024-10-15 18:14:39 -0700
commitd0f567251b25974f508527253d590019c4062887 (patch)
treea18cb8474ca5fdf0b27c3f804034747e30f18eeb /queries
parentfeat(typst): fold sections (diff)
downloadnvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar.gz
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar.bz2
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar.lz
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar.xz
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.tar.zst
nvim-treesitter-d0f567251b25974f508527253d590019c4062887.zip
feat(gren): gren parser and queries (#7237)
Diffstat (limited to 'queries')
-rw-r--r--queries/gren/highlights.scm121
-rw-r--r--queries/gren/injections.scm5
2 files changed, 126 insertions, 0 deletions
diff --git a/queries/gren/highlights.scm b/queries/gren/highlights.scm
new file mode 100644
index 000000000..5cc6fff54
--- /dev/null
+++ b/queries/gren/highlights.scm
@@ -0,0 +1,121 @@
+; Keywords
+[
+ (as)
+ (port)
+ (exposing)
+ (alias)
+ (infix)
+] @keyword
+
+; Keywords - Conditionals
+[
+ "if"
+ "then"
+ "else"
+ "let"
+ "in"
+ (case)
+ (of)
+] @keyword.conditional
+
+; Keywords - Imports
+[
+ (import)
+ (module)
+] @keyword.import
+
+; Operators
+[
+ (arrow)
+ (backslash)
+ (colon)
+ (operator_identifier)
+ (eq)
+] @operator
+
+; Punctuation
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+[
+ ","
+ "|"
+ (dot)
+] @punctuation.delimiter
+
+; Comments
+[
+ (block_comment)
+ (line_comment)
+] @comment
+
+; Strings
+[
+ (close_quote)
+ (open_quote)
+ (regular_string_part)
+] @string
+
+; Strings - Escape
+(string_escape) @string.escape
+
+; Characters
+[
+ (open_char)
+ (close_char)
+] @character
+
+(type_annotation
+ (lower_case_identifier) @function)
+
+(port_annotation
+ (lower_case_identifier) @function)
+
+(function_declaration_left
+ (lower_case_identifier) @function)
+
+(function_call_expr
+ target: (value_expr) @function)
+
+(field_access_expr
+ (value_expr
+ (value_qid) @variable.member))
+
+(lower_pattern) @variable.parameter
+
+(record_base_identifier) @variable
+
+(number_constant_expr) @number
+
+(type) @keyword.type
+
+(type_declaration
+ (upper_case_identifier) @type)
+
+(type_ref) @type
+
+(type_alias_declaration
+ name: (upper_case_identifier) @type)
+
+(union_variant
+ (upper_case_identifier) @type)
+
+(union_pattern
+ constructor: (upper_case_qid
+ (upper_case_identifier) @label
+ (dot)
+ (upper_case_identifier) @type))
+
+(union_pattern
+ constructor: (upper_case_qid
+ (upper_case_identifier) @type))
+
+(value_expr
+ (upper_case_qid
+ (upper_case_identifier)) @type)
diff --git a/queries/gren/injections.scm b/queries/gren/injections.scm
new file mode 100644
index 000000000..3cd6aac8e
--- /dev/null
+++ b/queries/gren/injections.scm
@@ -0,0 +1,5 @@
+([
+ (line_comment)
+ (block_comment)
+] @injection.content
+ (#set! injection.language "comment"))