Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units: add test using GNU extension regex pattern, i.e. \s, \w #3035

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Units/regex-flag-anonymous-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--sort=no

--langdef=foo
--map-foo=.foo
--kinddef-foo=m,module,modules
--kinddef-foo=x,exception,exceptions

--regex-foo=/^defmodule\s*(\w+)\s*do/\1/m/{scope=push}
--regex-foo=/^end//{scope=pop}{placeholder}
--regex-foo=/\s+defexception(\s+.*)$//x/{_anonymous=exception}{scope=ref}
4 changes: 4 additions & 0 deletions Units/regex-flag-anonymous-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MyAppError1 input.foo /^defmodule MyAppError1 do$/;" m
exception4808aff60101 input.foo /^ defexception [:message]$/;" x module:MyAppError1
MyAppError2 input.foo /^defmodule MyAppError2 do$/;" m
exception4808aff60201 input.foo /^ defexception [:message]$/;" x module:MyAppError2
12 changes: 12 additions & 0 deletions Units/regex-flag-anonymous-gnu.d/input.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Taken from commit log subitted by @dreamtigers in #2024.
#
defmodule MyAppError1 do
defexception [:message]
# code
end

defmodule MyAppError2 do
defexception [:message]
# code
end
6 changes: 6 additions & 0 deletions Units/regex-multiline-flag-dos-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Taken from #1473 opened by WillDHB
--langdef=mltest
--mline-regex-mltest=/@subscribe\s*[a-z ]+\s*([a-zA-Z]*)\(([a-zA-Z]*)/\1-\2/s,subscription/{mgroup=1}
--excmd=mixed
--fields=+ln
--language-force=mltest
6 changes: 6 additions & 0 deletions Units/regex-multiline-flag-dos-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
A-SomeEvent input.mlt /^public void catchA(SomeEvent e)$/;" s line:3 language:mltest
B-SomeEvent input.mlt /^public void catchB(SomeEvent e)$/;" s line:10 language:mltest
C-SomeEvent input.mlt /^public void catchC(SomeEvent e)$/;" s line:17 language:mltest
D-SomeEvent input.mlt /^public void catchD(SomeEvent e)$/;" s line:24 language:mltest
E-SomeEvent input.mlt /^public void catchE(SomeEvent e)$/;" s line:33 language:mltest
F-SomeEvent input.mlt /^public void catchF(SomeEvent e)$/;" s line:43 language:mltest
46 changes: 46 additions & 0 deletions Units/regex-multiline-flag-dos-gnu.d/input.mlt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Taken from #1473 opened by WillDHB
@subscribe
public void catchA(SomeEvent e)
{
int x = 4 * 4;
return;
}

@subscribe
public void catchB(SomeEvent e)
{
int x = 4 * 4;
return;
}

@subscribe
public void catchC(SomeEvent e)
{
int x = 7 * 7 * 7;
return;
}

@subscribe
public void catchD(SomeEvent e)
{
int x = 9;

return;

}

@subscribe
public void catchE(SomeEvent e)
{

int x = 30;

return;

}

@subscribe
public void catchF(SomeEvent e)
{
return;
}
5 changes: 5 additions & 0 deletions Units/regex-multiline-flag-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--langdef=javaspring
--langmap=javaspring:.java
--mline-regex-javaspring=/@Subscribe\s*[a-z ]+\s*([a-zA-Z]*)\(([a-zA-Z]*)/\1-\2/s,subscription/{mgroup=1}
--excmd=mixed
--fields=+ln
2 changes: 2 additions & 0 deletions Units/regex-multiline-flag-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Event-SomeEvent input.java /^public void catchEvent(SomeEvent e)$/;" s line:2 language:javaspring
recover-Exception input.java /^ recover(Exception e)$/;" s line:10 language:javaspring
13 changes: 13 additions & 0 deletions Units/regex-multiline-flag-gnu.d/input.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@Subscribe
public void catchEvent(SomeEvent e)
{
return;
}


@Subscribe
public void
recover(Exception e)
{
return;
}
7 changes: 7 additions & 0 deletions Units/regex-multiline-flag-hat-and-doller-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--langdef=FOOBAR
--langmap=FOOBAR:.foobar
--kinddef-FOOBAR=d,def,definitions
--kinddef-FOOBAR=D,Def,Definitions
--mline-regex-foobar=/^def\s+([a-z]+)$/\1/d/{mgroup=1}
--mline-regex-foobar=/[\n]?def\s+([a-z]+)\n/\1/D/{mgroup=1}
--fields=+ln
7 changes: 7 additions & 0 deletions Units/regex-multiline-flag-hat-and-doller-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a input.foobar /^ a$/;" D line:2 language:FOOBAR
a input.foobar /^ a$/;" d line:2 language:FOOBAR
b input.foobar /^ b$/;" D line:4 language:FOOBAR
b input.foobar /^ b$/;" d line:4 language:FOOBAR
c input.foobar /^ c$/;" D line:6 language:FOOBAR
c input.foobar /^ c$/;" d line:6 language:FOOBAR
d input.foobar /^ d$/;" D line:8 language:FOOBAR
9 changes: 9 additions & 0 deletions Units/regex-multiline-flag-hat-and-doller-gnu.d/input.foobar
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def
a
def
b
def
c
# def
d

5 changes: 5 additions & 0 deletions Units/regex-multiline-flag-newline-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--langdef=FOOBAR
--langmap=FOOBAR:.foobar
--kinddef-FOOBAR=d,def,definitions
--mline-regex-foobar=/^def(\n[\n\t]|: )(\w+)/\2/d/{mgroup=2}
--fields=+ln
3 changes: 3 additions & 0 deletions Units/regex-multiline-flag-newline-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
captureme0 input.foobar /^def: captureme0$/;" d line:4 language:FOOBAR
captureme1 input.foobar /^captureme1$/;" d line:8 language:FOOBAR
captureme2 input.foobar /^ captureme2$/;" d line:15 language:FOOBAR
17 changes: 17 additions & 0 deletions Units/regex-multiline-flag-newline-gnu.d/input.foobar
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def
dont-cptureme0

def: captureme0

def

captureme1

def


dont-captureme1
def
captureme2


16 changes: 16 additions & 0 deletions Units/regex-with-scope-autoFQTag-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To check the output easier
--sort=no
--fields=+e
--extras=+q

--langdef=foo{_autoFQTag}
--map-foo=+.foo
--regex-foo=/^#.*//{exclusive}
--regex-foo=/^\s*define\s+(\w+)\s*\{/\1/d,definition/{scope=push}
--regex-foo=/^\s*\{/_/d,definition/{scope=push}{placeholder}
--regex-foo=/^\s*package\s+(\w+)/\1/p,package/{scope=push}
--regex-foo=/^\s*end\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*\}\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*ns\s+(\w+)/\1/n,namespace/{scope=set}
--regex-foo=/^\s*var\s+(\w+)/\1/v,var/{scope=ref}
--regex-foo=/^\s*global//{scope=clear}{exclusive}
37 changes: 37 additions & 0 deletions Units/regex-with-scope-autoFQTag-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
NS1 input.foo /^ns NS1$/;" n end:16
x input.foo /^define x {$/;" d namespace:NS1 end:14
NS1.x input.foo /^define x {$/;" d namespace:NS1 end:14
y input.foo /^ define y {$/;" d definition:NS1.x end:7
NS1.x.y input.foo /^ define y {$/;" d definition:NS1.x end:7
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
NS1.x.y.v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
NS1.x.y.v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
z input.foo /^ define z {$/;" d definition:NS1.x end:13
NS1.x.z input.foo /^ define z {$/;" d definition:NS1.x end:13
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
NS1.x.z.v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
NS1.x.z.v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
NS1.x.z.a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
NS2 input.foo /^ns NS2$/;" n end:24
p input.foo /^define p {$/;" d namespace:NS2 end:22
NS2.p input.foo /^define p {$/;" d namespace:NS2 end:22
q input.foo /^ define q {$/;" d definition:NS2.p end:21
NS2.p.q input.foo /^ define q {$/;" d definition:NS2.p end:21
v_g1 input.foo /^var v_g1$/;" v
d_g input.foo /^define d_g {$/;" d end:28
v_l input.foo /^ var v_l$/;" v definition:d_g
d_g.v_l input.foo /^ var v_l$/;" v definition:d_g
NS3 input.foo /^ns NS3$/;" n end:47
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
NS3.PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
NS3.PACKAGE.p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
NS3.PACKAGE.p.q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
NS3.PACKAGE.p.q.L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
v_g2 input.foo /^var v_g2$/;" v namespace:NS3
NS3.v_g2 input.foo /^var v_g2$/;" v namespace:NS3
47 changes: 47 additions & 0 deletions Units/regex-with-scope-autoFQTag-gnu.d/input.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# open:X
ns NS1
define x {
define y {
var v_y_0
var v_y_1
}
define z {
var v_z_0
var v_z_1
define a {
}
}
}

ns NS2
define p {
# def:WRAPPER
define q {
print
}
}

global
var v_g1
define d_g {
var v_l
}

ns NS3
package PACKAGE
define p {
define q {
print
{
var L
}
}

# end of define
}

# end of package
end

var v_g2
# close
14 changes: 14 additions & 0 deletions Units/regex-with-scope-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# To check the output easier
--sort=no

--langdef=foo
--map-foo=+.foo
--regex-foo=/^#.*//{exclusive}
--regex-foo=/^\s*define\s+(\w+)\s*\{/\1/d,definition/{scope=push}
--regex-foo=/^\s*\{/_/d,definition/{scope=push}{placeholder}
--regex-foo=/^\s*package\s+(\w+)/\1/p,package/{scope=push}
--regex-foo=/^\s*end\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*\}\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*ns\s+(\w+)/\1/n,namespace/{scope=set}
--regex-foo=/^\s*var\s+(\w+)/\1/v,var/{scope=ref}
--regex-foo=/^\s*global//{scope=clear}{exclusive}
21 changes: 21 additions & 0 deletions Units/regex-with-scope-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NS1 input.foo /^ns NS1$/;" n
x input.foo /^define x {$/;" d namespace:NS1
y input.foo /^ define y {$/;" d definition:NS1.x
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
z input.foo /^ define z {$/;" d definition:NS1.x
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
a input.foo /^ define a {$/;" d definition:NS1.x.z
NS2 input.foo /^ns NS2$/;" n
p input.foo /^define p {$/;" d namespace:NS2
q input.foo /^ define q {$/;" d definition:NS2.p
v_g1 input.foo /^var v_g1$/;" v
d_g input.foo /^define d_g {$/;" d
v_l input.foo /^ var v_l$/;" v definition:d_g
NS3 input.foo /^ns NS3$/;" n
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3
p input.foo /^define p {$/;" d package:NS3.PACKAGE
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
v_g2 input.foo /^var v_g2$/;" v namespace:NS3
44 changes: 44 additions & 0 deletions Units/regex-with-scope-gnu.d/input.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ns NS1
define x {
define y {
var v_y_0
var v_y_1
}
define z {
var v_z_0
var v_z_1
define a {
}
}
}

ns NS2
define p {
define q {
print
}
}

global
var v_g1
define d_g {
var v_l
}

ns NS3
package PACKAGE
define p {
define q {
print
{
var L
}
}

# end of define
}

# end of package
end

var v_g2
22 changes: 22 additions & 0 deletions Units/regex-with-scope-nested-gnu.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# To check the output easier
--sort=no
--fields=+e

--langdef=foo
--map-foo=+.foo
--regex-foo=/^#.*//{exclusive}
--regex-foo=/^\s*define\s+(\w+)\s*\{/\1/d,definition/{scope=push}
--regex-foo=/^\s*\{/_/d,definition/{scope=push}{placeholder}
--regex-foo=/^\s*package\s+(\w+)/\1/p,package/{scope=push}
--regex-foo=/^\s*end\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*\}\s*$//{scope=pop}{exclusive}
--regex-foo=/^\s*ns\s+(\w+)/\1/n,namespace/{scope=set}
--regex-foo=/^\s*var\s+(\w+)/\1/v,var/{scope=ref}
--regex-foo=/^\s*global//{scope=clear}{exclusive}

--langdef=bar{base=foo}
--kinddef-bar=s,scope,scopes
--kinddef-bar=d,definition,definitions
--regex-bar=/^# open:(\w+)/\1/s/{scope=push}
--regex-bar=/^# def:(\w+)/\1/d/{scope=ref}
--regex-bar=/^# close//{scope=pop}{exclusive}
23 changes: 23 additions & 0 deletions Units/regex-with-scope-nested-gnu.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
X input.foo /^# open:X$/;" s end:47
NS1 input.foo /^ns NS1$/;" n end:16
x input.foo /^define x {$/;" d namespace:NS1 end:14
y input.foo /^ define y {$/;" d definition:NS1.x end:7
v_y_0 input.foo /^ var v_y_0$/;" v definition:NS1.x.y
v_y_1 input.foo /^ var v_y_1$/;" v definition:NS1.x.y
z input.foo /^ define z {$/;" d definition:NS1.x end:13
v_z_0 input.foo /^ var v_z_0$/;" v definition:NS1.x.z
v_z_1 input.foo /^ var v_z_1$/;" v definition:NS1.x.z
a input.foo /^ define a {$/;" d definition:NS1.x.z end:12
NS2 input.foo /^ns NS2$/;" n end:24
p input.foo /^define p {$/;" d namespace:NS2 end:22
WRAPPER input.foo /^# def:WRAPPER$/;" d scope:X
q input.foo /^ define q {$/;" d definition:NS2.p end:21
v_g1 input.foo /^var v_g1$/;" v
d_g input.foo /^define d_g {$/;" d end:28
v_l input.foo /^ var v_l$/;" v definition:d_g
NS3 input.foo /^ns NS3$/;" n end:47
PACKAGE input.foo /^package PACKAGE$/;" p namespace:NS3 end:44
p input.foo /^define p {$/;" d package:NS3.PACKAGE end:41
q input.foo /^ define q {$/;" d definition:NS3.PACKAGE.p end:38
L input.foo /^ var L$/;" v definition:NS3.PACKAGE.p.q
v_g2 input.foo /^var v_g2$/;" v namespace:NS3
Loading