diff --git a/tests/rules-data/match/repeat/cclmatch.xml b/tests/rules-data/match/repeat/cclmatch.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0cb604806b776ef09acdd404e840b881fd96d393
--- /dev/null
+++ b/tests/rules-data/match/repeat/cclmatch.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk id="ch1" type="p">
+  <sentence>
+   <tok>
+    <orth>Na</orth>
+    <lex><base>na</base><ctag>prep:acc</ctag></lex>
+    <lex><base>na</base><ctag>prep:loc</ctag></lex>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+   </tok>
+   <tok>
+    <orth>stole</orth>
+    <lex><base>stola</base><ctag>subst:pl:acc:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:nom:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:voc:f</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:loc:m3</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:voc:m3</ctag></lex>
+   </tok>
+   <tok>
+    <orth>pod</orth>
+    <lex><base>pod</base><ctag>prep:acc:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:gen:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:inst:nwok</ctag></lex>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+   </tok>
+   <tok>
+    <orth>sufitem</orth>
+    <lex><base>sufit</base><ctag>subst:sg:inst:m3</ctag></lex>
+   </tok>
+   <tok>
+    <orth>pies</orth>
+    <lex><base>pies</base><ctag>subst:sg:nom:m2</ctag></lex>
+   </tok>
+   <tok>
+    <orth>stał</orth>
+    <lex><base>stać</base><ctag>praet:sg:m1:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m1:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:perf</ctag></lex>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/repeat/cclmatch3.ccl b/tests/rules-data/match/repeat/cclmatch3.ccl
new file mode 100644
index 0000000000000000000000000000000000000000..81cf3c67ad32dddd771f9598a961f16d2b5a01d7
--- /dev/null
+++ b/tests/rules-data/match/repeat/cclmatch3.ccl
@@ -0,0 +1,9 @@
+apply(
+  match(
+    optional(repeat(inter(class[0], {adj, pact, ppas}))),
+    inter(class[0], {subst, ger, depr})
+  ),
+  actions(
+    mark(M, 'NP')
+  )
+)
diff --git a/tests/rules-data/match/repeat/cclmatch3.out.xml b/tests/rules-data/match/repeat/cclmatch3.out.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5d77b0be9b4c30037efe39e7a2f76b8a928da636
--- /dev/null
+++ b/tests/rules-data/match/repeat/cclmatch3.out.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk id="ch1" type="p">
+  <sentence>
+   <tok>
+    <orth>Na</orth>
+    <lex><base>na</base><ctag>prep:acc</ctag></lex>
+    <lex><base>na</base><ctag>prep:loc</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+    <ann chan="NP" head="1">1</ann>
+   </tok>
+   <tok>
+    <orth>stole</orth>
+    <lex><base>stola</base><ctag>subst:pl:acc:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:nom:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:voc:f</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:loc:m3</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:voc:m3</ctag></lex>
+    <ann chan="NP">1</ann>
+   </tok>
+   <tok>
+    <orth>pod</orth>
+    <lex><base>pod</base><ctag>prep:acc:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:gen:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:inst:nwok</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+    <ann chan="NP" head="1">2</ann>
+   </tok>
+   <tok>
+    <orth>sufitem</orth>
+    <lex><base>sufit</base><ctag>subst:sg:inst:m3</ctag></lex>
+    <ann chan="NP">2</ann>
+   </tok>
+   <tok>
+    <orth>pies</orth>
+    <lex><base>pies</base><ctag>subst:sg:nom:m2</ctag></lex>
+    <ann chan="NP" head="1">3</ann>
+   </tok>
+   <tok>
+    <orth>stał</orth>
+    <lex><base>stać</base><ctag>praet:sg:m1:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m1:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:perf</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/repeat/cclmatch4.ccl b/tests/rules-data/match/repeat/cclmatch4.ccl
new file mode 100644
index 0000000000000000000000000000000000000000..68a50fadac34bf64c6b521de63cc9b2c8850859a
--- /dev/null
+++ b/tests/rules-data/match/repeat/cclmatch4.ccl
@@ -0,0 +1,12 @@
+apply(
+  match(
+    repeat(
+      optional(inter(class[0], {prep})),
+      optional(repeat(inter(class[0], {adj, pact, ppas}))),
+      inter(class[0], {subst, ger, depr})
+    )
+  ),
+  actions(
+    mark(M, 'MultiNP')
+  )
+)
diff --git a/tests/rules-data/match/repeat/cclmatch4.out.xml b/tests/rules-data/match/repeat/cclmatch4.out.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bcdafa1f51925aa043b62c49fef209e6f3a81258
--- /dev/null
+++ b/tests/rules-data/match/repeat/cclmatch4.out.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk id="ch1" type="p">
+  <sentence>
+   <tok>
+    <orth>Na</orth>
+    <lex><base>na</base><ctag>prep:acc</ctag></lex>
+    <lex><base>na</base><ctag>prep:loc</ctag></lex>
+    <ann chan="MultiNP" head="1">1</ann>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>stole</orth>
+    <lex><base>stola</base><ctag>subst:pl:acc:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:nom:f</ctag></lex>
+    <lex><base>stola</base><ctag>subst:pl:voc:f</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:loc:m3</ctag></lex>
+    <lex><base>stół</base><ctag>subst:sg:voc:m3</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>pod</orth>
+    <lex><base>pod</base><ctag>prep:acc:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:gen:nwok</ctag></lex>
+    <lex><base>pod</base><ctag>prep:inst:nwok</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>starym</orth>
+    <lex><base>stary</base><ctag>adj:pl:dat:f:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:pl:dat:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m1:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m2:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:m3:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:inst:n:pos</ctag></lex>
+    <lex><base>stary</base><ctag>adj:sg:loc:n:pos</ctag></lex>
+    <lex><base>stara</base><ctag>subst:pl:dat:f</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>sufitem</orth>
+    <lex><base>sufit</base><ctag>subst:sg:inst:m3</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>pies</orth>
+    <lex><base>pies</base><ctag>subst:sg:nom:m2</ctag></lex>
+    <ann chan="MultiNP">1</ann>
+   </tok>
+   <tok>
+    <orth>stał</orth>
+    <lex><base>stać</base><ctag>praet:sg:m1:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:imperf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m1:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m2:perf</ctag></lex>
+    <lex><base>stać</base><ctag>praet:sg:m3:perf</ctag></lex>
+    <ann chan="MultiNP">0</ann>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+    <ann chan="MultiNP">0</ann>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/single_tok/cclmatch.xml b/tests/rules-data/match/single_tok/cclmatch.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b23bc389cc4a3f21307c7467954fe218c562a644
--- /dev/null
+++ b/tests/rules-data/match/single_tok/cclmatch.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk id="ch1" type="p">
+  <sentence>
+   <tok>
+    <orth>To</orth>
+    <lex><base>ten</base><ctag>adj:sg:nom:n:pos</ctag></lex>
+    <lex><base>ten</base><ctag>adj:sg:acc:n:pos</ctag></lex>
+    <lex><base>to</base><ctag>conj</ctag></lex>
+    <lex><base>to</base><ctag>pred</ctag></lex>
+    <lex><base>to</base><ctag>qub</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:nom:n</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:acc:n</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:voc:n</ctag></lex>
+   </tok>
+    <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>fin:sg:ter:imperf</ctag></lex>
+   </tok>
+   <tok>
+    <orth>wyżyna</orth>
+    <lex><base>wyżyna</base><ctag>subst:sg:nom:f</ctag></lex>
+   </tok>
+   <tok>
+    <orth>pies</orth>
+    <lex><base>pies</base><ctag>subst:sg:nom:m2</ctag></lex>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/single_tok/cclmatch1.ccl b/tests/rules-data/match/single_tok/cclmatch1.ccl
new file mode 100644
index 0000000000000000000000000000000000000000..0ee107574ecd4050814d839cf4a78fd2d3e5efcd
--- /dev/null
+++ b/tests/rules-data/match/single_tok/cclmatch1.ccl
@@ -0,0 +1,8 @@
+apply(
+  match(
+    and( inter(class[0], {subst, ger, depr}), inter(cas[0], {nom}) )
+  ),
+  actions(
+    mark($m:_M, 'N_NOM')
+  )
+)
diff --git a/tests/rules-data/match/single_tok/cclmatch1.out.xml b/tests/rules-data/match/single_tok/cclmatch1.out.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0b09385e6e2c8c85764fcec63fff5ddbec83fe41
--- /dev/null
+++ b/tests/rules-data/match/single_tok/cclmatch1.out.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk id="ch1" type="p">
+  <sentence>
+   <tok>
+    <orth>To</orth>
+    <lex><base>ten</base><ctag>adj:sg:nom:n:pos</ctag></lex>
+    <lex><base>ten</base><ctag>adj:sg:acc:n:pos</ctag></lex>
+    <lex><base>to</base><ctag>conj</ctag></lex>
+    <lex><base>to</base><ctag>pred</ctag></lex>
+    <lex><base>to</base><ctag>qub</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:nom:n</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:acc:n</ctag></lex>
+    <lex><base>to</base><ctag>subst:sg:voc:n</ctag></lex>
+    <ann chan="N_NOM" head="1">1</ann>
+   </tok>
+   <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>fin:sg:ter:imperf</ctag></lex>
+    <ann chan="N_NOM">0</ann>
+   </tok>
+   <tok>
+    <orth>wyżyna</orth>
+    <lex><base>wyżyna</base><ctag>subst:sg:nom:f</ctag></lex>
+    <ann chan="N_NOM" head="1">2</ann>
+   </tok>
+   <tok>
+    <orth>pies</orth>
+    <lex><base>pies</base><ctag>subst:sg:nom:m2</ctag></lex>
+    <ann chan="N_NOM" head="1">3</ann>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>