aboutsummaryrefslogtreecommitdiffstats
path: root/queries/gn
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-10-22 00:37:11 -0400
committerAmaan Qureshi <amaanq12@gmail.com>2023-10-22 01:17:15 -0400
commit6cb93819c9d7107f5e1ff704eb35d230858ec698 (patch)
tree07d16bba7fa76b2342e188a49570376686b87e7c /queries/gn
parentUpdate README (#5558) (diff)
downloadnvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar.gz
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar.bz2
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar.lz
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar.xz
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.tar.zst
nvim-treesitter-6cb93819c9d7107f5e1ff704eb35d230858ec698.zip
feat: add GN (Generate Ninja)
Diffstat (limited to 'queries/gn')
-rw-r--r--queries/gn/folds.scm6
-rw-r--r--queries/gn/highlights.scm74
-rw-r--r--queries/gn/indents.scm12
-rw-r--r--queries/gn/injections.scm2
-rw-r--r--queries/gn/locals.scm6
5 files changed, 100 insertions, 0 deletions
diff --git a/queries/gn/folds.scm b/queries/gn/folds.scm
new file mode 100644
index 000000000..352b0f0ec
--- /dev/null
+++ b/queries/gn/folds.scm
@@ -0,0 +1,6 @@
+[
+ (list)
+ (block)
+ (if_statement)
+ (else_statement)
+] @fold
diff --git a/queries/gn/highlights.scm b/queries/gn/highlights.scm
new file mode 100644
index 000000000..87082a30a
--- /dev/null
+++ b/queries/gn/highlights.scm
@@ -0,0 +1,74 @@
+; Includes
+
+"import" @include
+
+; Conditionals
+
+[
+ "if"
+ "else"
+] @conditional
+
+; Repeats
+
+"foreach" @repeat
+
+; Operators
+
+[
+ "="
+ "+="
+ "-="
+ "!"
+ "+"
+ "-"
+ "<"
+ "<="
+ ">"
+ ">="
+ "=="
+ "!="
+ "&&"
+ "||"
+] @operator
+
+; Variables
+
+(identifier) @variable
+
+; Functions
+
+(call_expression function: (identifier) @function.call)
+
+; Fields
+
+(scope_access field: (identifier) @field)
+
+; Literals
+
+(string) @string
+
+(escape_sequence) @string.escape
+
+(expansion) @none
+
+(integer) @number
+
+(hex) @string.special
+
+(boolean) @boolean
+
+; Punctuation
+
+[ "{" "}" "[" "]" "(" ")" ] @punctuation.bracket
+
+[
+ "."
+ ","
+] @punctuation.delimiter
+
+(expansion ["$" "${" "}"] @punctuation.special)
+
+; Comments
+
+(comment) @comment
diff --git a/queries/gn/indents.scm b/queries/gn/indents.scm
new file mode 100644
index 000000000..82f44711d
--- /dev/null
+++ b/queries/gn/indents.scm
@@ -0,0 +1,12 @@
+[
+ (block)
+ (parenthesized_expression)
+] @indent.begin
+
+[
+ "}"
+ ")"
+ "]"
+] @indent.end @indent.branch
+
+(comment) @indent.auto
diff --git a/queries/gn/injections.scm b/queries/gn/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/gn/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/gn/locals.scm b/queries/gn/locals.scm
new file mode 100644
index 000000000..1350a2318
--- /dev/null
+++ b/queries/gn/locals.scm
@@ -0,0 +1,6 @@
+[
+ (source_file)
+ (block)
+] @scope
+
+(identifier) @reference