aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2022-06-14 17:30:49 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-06-14 22:34:03 +0200
commit6e3f888dc7e5ea78e121c9ee41d365f339957824 (patch)
tree44f3c02804d98f3f2a7bf3916fb93cfee52ba878 /tests/query
parentfeat(tiger): initial support (diff)
downloadnvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar.gz
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar.bz2
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar.lz
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar.xz
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.tar.zst
nvim-treesitter-6e3f888dc7e5ea78e121c9ee41d365f339957824.zip
test(tiger): import upstream tests
Diffstat (limited to 'tests/query')
-rw-r--r--tests/query/highlights/tiger/built-ins.tig43
-rw-r--r--tests/query/highlights/tiger/comment.tig5
-rw-r--r--tests/query/highlights/tiger/functions.tig8
-rw-r--r--tests/query/highlights/tiger/identifiers.tig29
-rw-r--r--tests/query/highlights/tiger/imports.tig3
-rw-r--r--tests/query/highlights/tiger/keywords.tig41
-rw-r--r--tests/query/highlights/tiger/literals.tig8
-rw-r--r--tests/query/highlights/tiger/meta-variables.tig13
-rw-r--r--tests/query/highlights/tiger/object-oriented.tig28
-rw-r--r--tests/query/highlights/tiger/operators.tig48
10 files changed, 226 insertions, 0 deletions
diff --git a/tests/query/highlights/tiger/built-ins.tig b/tests/query/highlights/tiger/built-ins.tig
new file mode 100644
index 000000000..68790541a
--- /dev/null
+++ b/tests/query/highlights/tiger/built-ins.tig
@@ -0,0 +1,43 @@
+let
+ var a := exit(0)
+ /* ^ function.builtin */
+
+ primitive exit(ret: int) /* Shadowing the prelude-included built-in */
+ /* ^ type.builtin */
+
+ var b := exit(0)
+ /* ^ function */
+
+ type int = string /* Shadowing the built-in type */
+ /* ^ type.builtin */
+
+ var c : int := "This is an \"int\""
+ /* ^ type.builtin (not sure why it isn't 'type')*/
+
+ var d : Object := nil
+ /* ^ type.builtin */
+
+ type Object = int
+
+ var self := "self"
+in
+ let
+ var c : int := "This is an int"
+ /* ^ type.builtin (not sure why it isn't 'type')*/
+ var d : Object := "This is an object"
+ /* ^ type.builtin (not sure why it isn't 'type')*/
+ in
+ end;
+
+ exit(1);
+ /* <- function */
+
+ print("shadowing is fun");
+ /* <- function.builtin */
+
+ self;
+ /* <- variable */
+
+ b := print
+ /* ^ variable */
+end
diff --git a/tests/query/highlights/tiger/comment.tig b/tests/query/highlights/tiger/comment.tig
new file mode 100644
index 000000000..b0e8262fd
--- /dev/null
+++ b/tests/query/highlights/tiger/comment.tig
@@ -0,0 +1,5 @@
+/* This is /* a nested */ comment */
+/* <- comment
+ ^ comment
+ ^ comment
+ */
diff --git a/tests/query/highlights/tiger/functions.tig b/tests/query/highlights/tiger/functions.tig
new file mode 100644
index 000000000..802f394af
--- /dev/null
+++ b/tests/query/highlights/tiger/functions.tig
@@ -0,0 +1,8 @@
+primitive print(s: string)
+/* ^ function */
+/* ^ variable.parameter */
+
+function func(a: int) : int = (print("Hello World!"); a)
+/* ^ function */
+/* ^ variable.parameter */
+/* ^ function */
diff --git a/tests/query/highlights/tiger/identifiers.tig b/tests/query/highlights/tiger/identifiers.tig
new file mode 100644
index 000000000..f177a5a5c
--- /dev/null
+++ b/tests/query/highlights/tiger/identifiers.tig
@@ -0,0 +1,29 @@
+type int = int
+/* ^ variable */
+/* ^ type.builtin */
+
+type int_array = array of int
+/* ^ type.builtin */
+
+type record = {a: int, b: string}
+/* ^ property */
+/* ^ type.builtin */
+/* ^ property */
+/* ^ type.builtin */
+
+var record := record {a = 12, b = "27"}
+/* ^ variable */
+/* ^ type */
+/* ^ property */
+/* ^ property */
+
+var array := int_array[12] of 27;
+/* ^ variable */
+/* ^ type */
+
+primitive func(a: int, b: string) : array
+/* ^ variable.parameter */
+/* ^ type.builtin */
+/* ^ variable.parameter */
+/* ^ type.builtin */
+/* ^ type */
diff --git a/tests/query/highlights/tiger/imports.tig b/tests/query/highlights/tiger/imports.tig
new file mode 100644
index 000000000..c056c301f
--- /dev/null
+++ b/tests/query/highlights/tiger/imports.tig
@@ -0,0 +1,3 @@
+import "lib.tih"
+/* <- keyword */
+/* ^ string.special.path */
diff --git a/tests/query/highlights/tiger/keywords.tig b/tests/query/highlights/tiger/keywords.tig
new file mode 100644
index 000000000..70cb82c05
--- /dev/null
+++ b/tests/query/highlights/tiger/keywords.tig
@@ -0,0 +1,41 @@
+let
+/* <- keyword */
+
+ var a := 12
+ /* <- keyword */
+
+ function f() : int = a
+ /* <- keyword.function */
+ primitive g()
+ /* <- keyword.function */
+
+ import "lib.tih"
+ /* <- keyword */
+
+ type array_of_int = array of int
+ /* <- keyword */
+ /* ^ keyword */
+ /* ^ keyword */
+
+in
+/* <- keyword */
+
+ 12;
+
+ if 12 then 27 else 42;
+ /* <- keyword */
+ /* ^ keyword */
+ /* ^ keyword */
+
+ for i := 12 to 27 do 42;
+ /* <- keyword.repeat */
+ /* ^ keyword.repeat */
+ /* ^ keyword.repeat */
+
+ while 12 do break
+ /* <- keyword.repeat */
+ /* ^ keyword.repeat */
+ /* ^ keyword */
+
+end
+/* <- keyword */
diff --git a/tests/query/highlights/tiger/literals.tig b/tests/query/highlights/tiger/literals.tig
new file mode 100644
index 000000000..029ac8742
--- /dev/null
+++ b/tests/query/highlights/tiger/literals.tig
@@ -0,0 +1,8 @@
+nil
+/* <- constant.builtin */
+42
+/* <- number */
+"Hello World!\n"
+/* <- string
+ ^ string.escape
+*/
diff --git a/tests/query/highlights/tiger/meta-variables.tig b/tests/query/highlights/tiger/meta-variables.tig
new file mode 100644
index 000000000..5c239cc52
--- /dev/null
+++ b/tests/query/highlights/tiger/meta-variables.tig
@@ -0,0 +1,13 @@
+let
+ _chunks(42)
+ /* <- keyword */
+
+in
+ _lvalue(12) : _namety(42) := _cast("I'm So Meta Even This Acronym", string);
+ /* <- keyword */
+ /* ^ keyword */
+ /* ^ keyword */
+
+ _exp(42)
+ /* <- keyword */
+end
diff --git a/tests/query/highlights/tiger/object-oriented.tig b/tests/query/highlights/tiger/object-oriented.tig
new file mode 100644
index 000000000..930eabf00
--- /dev/null
+++ b/tests/query/highlights/tiger/object-oriented.tig
@@ -0,0 +1,28 @@
+let
+ class A extends Object {}
+ /* <- keyword */
+ /* ^ keyword */
+ /* ^ type.builtin */
+
+ type B = class extends A {
+ /* ^ keyword */
+ /* ^ keyword */
+ /* ^ type */
+
+ var a := 12
+
+ method meth() : int = self.a
+ /* <- keyword.method */
+ /* ^ method */
+ /* ^ variable.builtin */
+ }
+
+ var object := new B
+ /* ^ keyword.constructor */
+in
+ object.a := 27;
+ /* ^ property */
+
+ object.meth()
+ /* ^ method */
+end
diff --git a/tests/query/highlights/tiger/operators.tig b/tests/query/highlights/tiger/operators.tig
new file mode 100644
index 000000000..21e600903
--- /dev/null
+++ b/tests/query/highlights/tiger/operators.tig
@@ -0,0 +1,48 @@
+let
+ var a : int := 42
+ /* ^ punctuation.delimiter */
+ /* ^ operator */
+in
+ (
+ /* <- punctuation.bracket */
+
+ -1 | 2 & 3 + 4 * 5;
+ /* <- operator */
+ /* ^ operator */
+ /* ^ operator */
+ /* ^ operator */
+ /* ^ operator */
+ /* ^ punctuation.delimiter */
+
+ 12 >= 27;
+ /* ^ operator */
+ 12 <= 27;
+ /* ^ operator */
+ 12 = 27;
+ /* ^ operator */
+ 12 <> 27;
+ /* ^ operator */
+ 12 < 27;
+ /* ^ operator */
+ 12 > 27;
+ /* ^ operator */
+
+ record.field;
+ /* ^ punctuation.delimiter */
+
+ func(a, b);
+ /* ^ punctuation.bracket */
+ /* ^ punctuation.bracket */
+ /* ^ punctuation.delimiter */
+
+ record_type { };
+ /* ^ punctuation.bracket */
+ /* ^ punctuation.bracket */
+
+ array[42]
+ /* ^ punctuation.bracket */
+ /* ^ punctuation.bracket */
+
+ )
+ /* <- punctuation.bracket */
+end