Skip to content

Commit 2806c9a

Browse files
committed
Units: copy regex tests on which GNU extension can be used.
1 parent 41d7384 commit 2806c9a

File tree

24 files changed

+423
-0
lines changed

24 files changed

+423
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--sort=no
2+
3+
--langdef=foo
4+
--map-foo=.foo
5+
--kinddef-foo=m,module,modules
6+
--kinddef-foo=x,exception,exceptions
7+
8+
--regex-foo=/^defmodule *([a-zA-Z0-9]+) *do/\1/m/{scope=push}
9+
--regex-foo=/^end//{scope=pop}{placeholder}
10+
--regex-foo=/ +defexception( +.*)$//x/{_anonymous=exception}{scope=ref}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MyAppError1 input.foo /^defmodule MyAppError1 do$/;" m
2+
exceptionf9e1959f0101 input.foo /^ defexception [:message]$/;" x module:MyAppError1
3+
MyAppError2 input.foo /^defmodule MyAppError2 do$/;" m
4+
exceptionf9e1959f0201 input.foo /^ defexception [:message]$/;" x module:MyAppError2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Taken from commit log subitted by @dreamtigers in #2024.
3+
#
4+
defmodule MyAppError1 do
5+
defexception [:message]
6+
# code
7+
end
8+
9+
defmodule MyAppError2 do
10+
defexception [:message]
11+
# code
12+
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Taken from #1473 opened by WillDHB
2+
--langdef=mltest
3+
--mline-regex-mltest=/@subscribe([[:space:]])*([a-z ]+)[[:space:]]*([a-zA-Z]*)\(([a-zA-Z]*)/\3-\4/s,subscription/{mgroup=3}
4+
--excmd=mixed
5+
--fields=+ln
6+
--language-force=mltest
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
A-SomeEvent input.mlt /^public void catchA(SomeEvent e)$/;" s line:3 language:mltest
2+
B-SomeEvent input.mlt /^public void catchB(SomeEvent e)$/;" s line:10 language:mltest
3+
C-SomeEvent input.mlt /^public void catchC(SomeEvent e)$/;" s line:17 language:mltest
4+
D-SomeEvent input.mlt /^public void catchD(SomeEvent e)$/;" s line:24 language:mltest
5+
E-SomeEvent input.mlt /^public void catchE(SomeEvent e)$/;" s line:33 language:mltest
6+
F-SomeEvent input.mlt /^public void catchF(SomeEvent e)$/;" s line:43 language:mltest
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Taken from #1473 opened by WillDHB
2+
@subscribe
3+
public void catchA(SomeEvent e)
4+
{
5+
int x = 4 * 4;
6+
return;
7+
}
8+
9+
@subscribe
10+
public void catchB(SomeEvent e)
11+
{
12+
int x = 4 * 4;
13+
return;
14+
}
15+
16+
@subscribe
17+
public void catchC(SomeEvent e)
18+
{
19+
int x = 7 * 7 * 7;
20+
return;
21+
}
22+
23+
@subscribe
24+
public void catchD(SomeEvent e)
25+
{
26+
int x = 9;
27+
28+
return;
29+
30+
}
31+
32+
@subscribe
33+
public void catchE(SomeEvent e)
34+
{
35+
36+
int x = 30;
37+
38+
return;
39+
40+
}
41+
42+
@subscribe
43+
public void catchF(SomeEvent e)
44+
{
45+
return;
46+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--langdef=javaspring
2+
--langmap=javaspring:.java
3+
--mline-regex-javaspring=/@Subscribe([[:space:]])*([a-z ]+)[[:space:]]*([a-zA-Z]*)\(([a-zA-Z]*)/\3-\4/s,subscription/{mgroup=3}
4+
--excmd=mixed
5+
--fields=+ln
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Event-SomeEvent input.java /^public void catchEvent(SomeEvent e)$/;" s line:2 language:javaspring
2+
recover-Exception input.java /^ recover(Exception e)$/;" s line:10 language:javaspring
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@Subscribe
2+
public void catchEvent(SomeEvent e)
3+
{
4+
return;
5+
}
6+
7+
8+
@Subscribe
9+
public void
10+
recover(Exception e)
11+
{
12+
return;
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--langdef=FOOBAR
2+
--langmap=FOOBAR:.foobar
3+
--kinddef-FOOBAR=d,def,definitions
4+
--kinddef-FOOBAR=D,Def,Definitions
5+
--mline-regex-foobar=/^def[\n\t ]+([a-z]+)$/\1/d/{mgroup=1}
6+
--mline-regex-foobar=/[\n]?def[\n\t ]+([a-z]+)\n/\1/D/{mgroup=1}
7+
--fields=+ln
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
a input.foobar /^ a$/;" D line:2 language:FOOBAR
2+
a input.foobar /^ a$/;" d line:2 language:FOOBAR
3+
b input.foobar /^ b$/;" D line:4 language:FOOBAR
4+
b input.foobar /^ b$/;" d line:4 language:FOOBAR
5+
c input.foobar /^ c$/;" D line:6 language:FOOBAR
6+
c input.foobar /^ c$/;" d line:6 language:FOOBAR
7+
d input.foobar /^ d$/;" D line:8 language:FOOBAR
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def
2+
a
3+
def
4+
b
5+
def
6+
c
7+
# def
8+
d
9+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--langdef=FOOBAR
2+
--langmap=FOOBAR:.foobar
3+
--kinddef-FOOBAR=d,def,definitions
4+
--mline-regex-foobar=/^def((\n[\n\t])|(: ))([a-z0-9-]+)/\4/d/{mgroup=4}
5+
--fields=+ln
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
captureme0 input.foobar /^def: captureme0$/;" d line:4 language:FOOBAR
2+
captureme1 input.foobar /^captureme1$/;" d line:8 language:FOOBAR
3+
captureme2 input.foobar /^ captureme2$/;" d line:15 language:FOOBAR
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def
2+
dont-cptureme0
3+
4+
def: captureme0
5+
6+
def
7+
8+
captureme1
9+
10+
def
11+
12+
13+
dont-captureme1
14+
def
15+
captureme2
16+
17+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To check the output easier
2+
--sort=no
3+
--fields=+e
4+
--extras=+q
5+
6+
--langdef=foo{_autoFQTag}
7+
--map-foo=+.foo
8+
--regex-foo=/^#.*//{exclusive}
9+
--regex-foo=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push}
10+
--regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder}
11+
--regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push}
12+
--regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive}
13+
--regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive}
14+
--regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set}
15+
--regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref}
16+
--regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
NS1 input.foo /^ns NS1$/;" n end:16
2+
x input.foo /^define x {$/;" d namespace:NS1 end:14
3+
NS1.x input.foo /^define x {$/;" d namespace:NS1 end:14
4+
y input.foo /^ define y {$/;" d definition:NS1.x end:7
5+
NS1.x.y input.foo /^ define y {$/;" d definition:NS1.x end:7
6+
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
7+
NS1.x.y.v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
8+
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
9+
NS1.x.y.v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
10+
z input.foo /^ define z {$/;" d definition:NS1.x end:13
11+
NS1.x.z input.foo /^ define z {$/;" d definition:NS1.x end:13
12+
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
13+
NS1.x.z.v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
14+
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
15+
NS1.x.z.v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
16+
a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
17+
NS1.x.z.a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
18+
NS2 input.foo /^ns NS2$/;" n end:24
19+
p input.foo /^define p {$/;" d namespace:NS2 end:22
20+
NS2.p input.foo /^define p {$/;" d namespace:NS2 end:22
21+
q input.foo /^ define q {$/;" d definition:NS2.p end:21
22+
NS2.p.q input.foo /^ define q {$/;" d definition:NS2.p end:21
23+
v_g1 input.foo /^var v_g1$/;" v
24+
d_g input.foo /^define d_g {$/;" d end:28
25+
v_l input.foo /^ var v_l$/;" v definition:d_g
26+
d_g.v_l input.foo /^ var v_l$/;" v definition:d_g
27+
NS3 input.foo /^ns NS3$/;" n end:47
28+
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
29+
NS3.PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
30+
p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
31+
NS3.PACKAGE.p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
32+
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
33+
NS3.PACKAGE.p.q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
34+
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
35+
NS3.PACKAGE.p.q.L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
36+
v_g2 input.foo /^var v_g2$/;" v namespace:NS3
37+
NS3.v_g2 input.foo /^var v_g2$/;" v namespace:NS3
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# open:X
2+
ns NS1
3+
define x {
4+
define y {
5+
var v_y_0
6+
var v_y_1
7+
}
8+
define z {
9+
var v_z_0
10+
var v_z_1
11+
define a {
12+
}
13+
}
14+
}
15+
16+
ns NS2
17+
define p {
18+
# def:WRAPPER
19+
define q {
20+
print
21+
}
22+
}
23+
24+
global
25+
var v_g1
26+
define d_g {
27+
var v_l
28+
}
29+
30+
ns NS3
31+
package PACKAGE
32+
define p {
33+
define q {
34+
print
35+
{
36+
var L
37+
}
38+
}
39+
40+
# end of define
41+
}
42+
43+
# end of package
44+
end
45+
46+
var v_g2
47+
# close
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# To check the output easier
2+
--sort=no
3+
4+
--langdef=foo
5+
--map-foo=+.foo
6+
--regex-foo=/^#.*//{exclusive}
7+
--regex-foo=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push}
8+
--regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder}
9+
--regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push}
10+
--regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive}
11+
--regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive}
12+
--regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set}
13+
--regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref}
14+
--regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
NS1 input.foo /^ns NS1$/;" n
2+
x input.foo /^define x {$/;" d namespace:NS1
3+
y input.foo /^ define y {$/;" d definition:NS1.x
4+
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
5+
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
6+
z input.foo /^ define z {$/;" d definition:NS1.x
7+
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
8+
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
9+
a input.foo /^ define a {$/;" d definition:NS1.x.z
10+
NS2 input.foo /^ns NS2$/;" n
11+
p input.foo /^define p {$/;" d namespace:NS2
12+
q input.foo /^ define q {$/;" d definition:NS2.p
13+
v_g1 input.foo /^var v_g1$/;" v
14+
d_g input.foo /^define d_g {$/;" d
15+
v_l input.foo /^ var v_l$/;" v definition:d_g
16+
NS3 input.foo /^ns NS3$/;" n
17+
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3
18+
p input.foo /^define p {$/;" d package:NS3.PACKAGE
19+
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p
20+
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
21+
v_g2 input.foo /^var v_g2$/;" v namespace:NS3
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
ns NS1
2+
define x {
3+
define y {
4+
var v_y_0
5+
var v_y_1
6+
}
7+
define z {
8+
var v_z_0
9+
var v_z_1
10+
define a {
11+
}
12+
}
13+
}
14+
15+
ns NS2
16+
define p {
17+
define q {
18+
print
19+
}
20+
}
21+
22+
global
23+
var v_g1
24+
define d_g {
25+
var v_l
26+
}
27+
28+
ns NS3
29+
package PACKAGE
30+
define p {
31+
define q {
32+
print
33+
{
34+
var L
35+
}
36+
}
37+
38+
# end of define
39+
}
40+
41+
# end of package
42+
end
43+
44+
var v_g2
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# To check the output easier
2+
--sort=no
3+
--fields=+e
4+
5+
--langdef=foo
6+
--map-foo=+.foo
7+
--regex-foo=/^#.*//{exclusive}
8+
--regex-foo=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push}
9+
--regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder}
10+
--regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push}
11+
--regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive}
12+
--regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive}
13+
--regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set}
14+
--regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref}
15+
--regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive}
16+
17+
--langdef=bar{base=foo}
18+
--kinddef-bar=s,scope,scopes
19+
--kinddef-bar=d,definition,definitions
20+
--regex-bar=/^# open:([[:alnum:]_]+)/\1/s/{scope=push}
21+
--regex-bar=/^# def:([[:alnum:]_]+)/\1/d/{scope=ref}
22+
--regex-bar=/^# close//{scope=pop}{exclusive}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
X input.foo /^# open:X$/;" s end:47
2+
NS1 input.foo /^ns NS1$/;" n end:16
3+
x input.foo /^define x {$/;" d namespace:NS1 end:14
4+
y input.foo /^ define y {$/;" d definition:NS1.x end:7
5+
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
6+
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
7+
z input.foo /^ define z {$/;" d definition:NS1.x end:13
8+
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
9+
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
10+
a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
11+
NS2 input.foo /^ns NS2$/;" n end:24
12+
p input.foo /^define p {$/;" d namespace:NS2 end:22
13+
WRAPPER input.foo /^# def:WRAPPER$/;" d scope:X
14+
q input.foo /^ define q {$/;" d definition:NS2.p end:21
15+
v_g1 input.foo /^var v_g1$/;" v
16+
d_g input.foo /^define d_g {$/;" d end:28
17+
v_l input.foo /^ var v_l$/;" v definition:d_g
18+
NS3 input.foo /^ns NS3$/;" n end:47
19+
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
20+
p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
21+
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
22+
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
23+
v_g2 input.foo /^var v_g2$/;" v namespace:NS3

0 commit comments

Comments
 (0)