From dd177c363e2dd3e3248c5554e171c9424f2610ac Mon Sep 17 00:00:00 2001 From: Hiroo HAYASHI <24754036+hirooih@users.noreply.github.com> Date: Sat, 22 May 2021 11:10:24 +0900 Subject: [PATCH] Units: copy regex tests on which GNU extension can be used. --- Units/regex-flag-anonymous-gnu.d/args.ctags | 10 ++++ .../regex-flag-anonymous-gnu.d/expected.tags | 4 ++ Units/regex-flag-anonymous-gnu.d/input.foo | 12 +++++ .../regex-multiline-flag-dos-gnu.d/args.ctags | 6 +++ .../expected.tags | 6 +++ .../regex-multiline-flag-dos-gnu.d/input.mlt | 46 ++++++++++++++++++ Units/regex-multiline-flag-gnu.d/args.ctags | 5 ++ .../regex-multiline-flag-gnu.d/expected.tags | 2 + Units/regex-multiline-flag-gnu.d/input.java | 13 +++++ .../args.ctags | 7 +++ .../expected.tags | 7 +++ .../input.foobar | 9 ++++ .../args.ctags | 5 ++ .../expected.tags | 3 ++ .../input.foobar | 17 +++++++ .../args.ctags | 16 +++++++ .../expected.tags | 37 +++++++++++++++ .../input.foo | 47 +++++++++++++++++++ Units/regex-with-scope-gnu.d/args.ctags | 14 ++++++ Units/regex-with-scope-gnu.d/expected.tags | 21 +++++++++ Units/regex-with-scope-gnu.d/input.foo | 44 +++++++++++++++++ .../regex-with-scope-nested-gnu.d/args.ctags | 22 +++++++++ .../expected.tags | 23 +++++++++ Units/regex-with-scope-nested-gnu.d/input.foo | 47 +++++++++++++++++++ 24 files changed, 423 insertions(+) create mode 100644 Units/regex-flag-anonymous-gnu.d/args.ctags create mode 100644 Units/regex-flag-anonymous-gnu.d/expected.tags create mode 100644 Units/regex-flag-anonymous-gnu.d/input.foo create mode 100644 Units/regex-multiline-flag-dos-gnu.d/args.ctags create mode 100644 Units/regex-multiline-flag-dos-gnu.d/expected.tags create mode 100644 Units/regex-multiline-flag-dos-gnu.d/input.mlt create mode 100644 Units/regex-multiline-flag-gnu.d/args.ctags create mode 100644 Units/regex-multiline-flag-gnu.d/expected.tags create mode 100644 Units/regex-multiline-flag-gnu.d/input.java create mode 100644 Units/regex-multiline-flag-hat-and-doller-gnu.d/args.ctags create mode 100644 Units/regex-multiline-flag-hat-and-doller-gnu.d/expected.tags create mode 100644 Units/regex-multiline-flag-hat-and-doller-gnu.d/input.foobar create mode 100644 Units/regex-multiline-flag-newline-gnu.d/args.ctags create mode 100644 Units/regex-multiline-flag-newline-gnu.d/expected.tags create mode 100644 Units/regex-multiline-flag-newline-gnu.d/input.foobar create mode 100644 Units/regex-with-scope-autoFQTag-gnu.d/args.ctags create mode 100644 Units/regex-with-scope-autoFQTag-gnu.d/expected.tags create mode 100644 Units/regex-with-scope-autoFQTag-gnu.d/input.foo create mode 100644 Units/regex-with-scope-gnu.d/args.ctags create mode 100644 Units/regex-with-scope-gnu.d/expected.tags create mode 100644 Units/regex-with-scope-gnu.d/input.foo create mode 100644 Units/regex-with-scope-nested-gnu.d/args.ctags create mode 100644 Units/regex-with-scope-nested-gnu.d/expected.tags create mode 100644 Units/regex-with-scope-nested-gnu.d/input.foo diff --git a/Units/regex-flag-anonymous-gnu.d/args.ctags b/Units/regex-flag-anonymous-gnu.d/args.ctags new file mode 100644 index 0000000000..2d55e1ac39 --- /dev/null +++ b/Units/regex-flag-anonymous-gnu.d/args.ctags @@ -0,0 +1,10 @@ +--sort=no + +--langdef=foo +--map-foo=.foo +--kinddef-foo=m,module,modules +--kinddef-foo=x,exception,exceptions + +--regex-foo=/^defmodule *([a-zA-Z0-9]+) *do/\1/m/{scope=push} +--regex-foo=/^end//{scope=pop}{placeholder} +--regex-foo=/ +defexception( +.*)$//x/{_anonymous=exception}{scope=ref} diff --git a/Units/regex-flag-anonymous-gnu.d/expected.tags b/Units/regex-flag-anonymous-gnu.d/expected.tags new file mode 100644 index 0000000000..4f0fc29e54 --- /dev/null +++ b/Units/regex-flag-anonymous-gnu.d/expected.tags @@ -0,0 +1,4 @@ +MyAppError1 input.foo /^defmodule MyAppError1 do$/;" m +exceptionf9e1959f0101 input.foo /^ defexception [:message]$/;" x module:MyAppError1 +MyAppError2 input.foo /^defmodule MyAppError2 do$/;" m +exceptionf9e1959f0201 input.foo /^ defexception [:message]$/;" x module:MyAppError2 diff --git a/Units/regex-flag-anonymous-gnu.d/input.foo b/Units/regex-flag-anonymous-gnu.d/input.foo new file mode 100644 index 0000000000..925d0d7f19 --- /dev/null +++ b/Units/regex-flag-anonymous-gnu.d/input.foo @@ -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 diff --git a/Units/regex-multiline-flag-dos-gnu.d/args.ctags b/Units/regex-multiline-flag-dos-gnu.d/args.ctags new file mode 100644 index 0000000000..ef6f0538d2 --- /dev/null +++ b/Units/regex-multiline-flag-dos-gnu.d/args.ctags @@ -0,0 +1,6 @@ +# Taken from #1473 opened by WillDHB +--langdef=mltest +--mline-regex-mltest=/@subscribe([[:space:]])*([a-z ]+)[[:space:]]*([a-zA-Z]*)\(([a-zA-Z]*)/\3-\4/s,subscription/{mgroup=3} +--excmd=mixed +--fields=+ln +--language-force=mltest diff --git a/Units/regex-multiline-flag-dos-gnu.d/expected.tags b/Units/regex-multiline-flag-dos-gnu.d/expected.tags new file mode 100644 index 0000000000..ad92caee50 --- /dev/null +++ b/Units/regex-multiline-flag-dos-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-multiline-flag-dos-gnu.d/input.mlt b/Units/regex-multiline-flag-dos-gnu.d/input.mlt new file mode 100644 index 0000000000..977cd977c6 --- /dev/null +++ b/Units/regex-multiline-flag-dos-gnu.d/input.mlt @@ -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; +} diff --git a/Units/regex-multiline-flag-gnu.d/args.ctags b/Units/regex-multiline-flag-gnu.d/args.ctags new file mode 100644 index 0000000000..6b1dbbd8fb --- /dev/null +++ b/Units/regex-multiline-flag-gnu.d/args.ctags @@ -0,0 +1,5 @@ +--langdef=javaspring +--langmap=javaspring:.java +--mline-regex-javaspring=/@Subscribe([[:space:]])*([a-z ]+)[[:space:]]*([a-zA-Z]*)\(([a-zA-Z]*)/\3-\4/s,subscription/{mgroup=3} +--excmd=mixed +--fields=+ln diff --git a/Units/regex-multiline-flag-gnu.d/expected.tags b/Units/regex-multiline-flag-gnu.d/expected.tags new file mode 100644 index 0000000000..0a706bb416 --- /dev/null +++ b/Units/regex-multiline-flag-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-multiline-flag-gnu.d/input.java b/Units/regex-multiline-flag-gnu.d/input.java new file mode 100644 index 0000000000..cc04db7cd2 --- /dev/null +++ b/Units/regex-multiline-flag-gnu.d/input.java @@ -0,0 +1,13 @@ +@Subscribe +public void catchEvent(SomeEvent e) +{ + return; +} + + +@Subscribe +public void + recover(Exception e) +{ + return; +} diff --git a/Units/regex-multiline-flag-hat-and-doller-gnu.d/args.ctags b/Units/regex-multiline-flag-hat-and-doller-gnu.d/args.ctags new file mode 100644 index 0000000000..b340596bd6 --- /dev/null +++ b/Units/regex-multiline-flag-hat-and-doller-gnu.d/args.ctags @@ -0,0 +1,7 @@ +--langdef=FOOBAR +--langmap=FOOBAR:.foobar +--kinddef-FOOBAR=d,def,definitions +--kinddef-FOOBAR=D,Def,Definitions +--mline-regex-foobar=/^def[\n\t ]+([a-z]+)$/\1/d/{mgroup=1} +--mline-regex-foobar=/[\n]?def[\n\t ]+([a-z]+)\n/\1/D/{mgroup=1} +--fields=+ln diff --git a/Units/regex-multiline-flag-hat-and-doller-gnu.d/expected.tags b/Units/regex-multiline-flag-hat-and-doller-gnu.d/expected.tags new file mode 100644 index 0000000000..2db81e4aa1 --- /dev/null +++ b/Units/regex-multiline-flag-hat-and-doller-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-multiline-flag-hat-and-doller-gnu.d/input.foobar b/Units/regex-multiline-flag-hat-and-doller-gnu.d/input.foobar new file mode 100644 index 0000000000..84d9632e4c --- /dev/null +++ b/Units/regex-multiline-flag-hat-and-doller-gnu.d/input.foobar @@ -0,0 +1,9 @@ +def + a +def + b +def + c +# def + d + diff --git a/Units/regex-multiline-flag-newline-gnu.d/args.ctags b/Units/regex-multiline-flag-newline-gnu.d/args.ctags new file mode 100644 index 0000000000..d299d566f0 --- /dev/null +++ b/Units/regex-multiline-flag-newline-gnu.d/args.ctags @@ -0,0 +1,5 @@ +--langdef=FOOBAR +--langmap=FOOBAR:.foobar +--kinddef-FOOBAR=d,def,definitions +--mline-regex-foobar=/^def((\n[\n\t])|(: ))([a-z0-9-]+)/\4/d/{mgroup=4} +--fields=+ln diff --git a/Units/regex-multiline-flag-newline-gnu.d/expected.tags b/Units/regex-multiline-flag-newline-gnu.d/expected.tags new file mode 100644 index 0000000000..7ae01d629b --- /dev/null +++ b/Units/regex-multiline-flag-newline-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-multiline-flag-newline-gnu.d/input.foobar b/Units/regex-multiline-flag-newline-gnu.d/input.foobar new file mode 100644 index 0000000000..f8fef1e4b4 --- /dev/null +++ b/Units/regex-multiline-flag-newline-gnu.d/input.foobar @@ -0,0 +1,17 @@ +def +dont-cptureme0 + +def: captureme0 + +def + +captureme1 + +def + + +dont-captureme1 +def + captureme2 + + diff --git a/Units/regex-with-scope-autoFQTag-gnu.d/args.ctags b/Units/regex-with-scope-autoFQTag-gnu.d/args.ctags new file mode 100644 index 0000000000..fcdb2b8b1f --- /dev/null +++ b/Units/regex-with-scope-autoFQTag-gnu.d/args.ctags @@ -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=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push} + --regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder} + --regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push} + --regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set} + --regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref} + --regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive} diff --git a/Units/regex-with-scope-autoFQTag-gnu.d/expected.tags b/Units/regex-with-scope-autoFQTag-gnu.d/expected.tags new file mode 100644 index 0000000000..d18be0684f --- /dev/null +++ b/Units/regex-with-scope-autoFQTag-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-with-scope-autoFQTag-gnu.d/input.foo b/Units/regex-with-scope-autoFQTag-gnu.d/input.foo new file mode 100644 index 0000000000..bbd46beed2 --- /dev/null +++ b/Units/regex-with-scope-autoFQTag-gnu.d/input.foo @@ -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 diff --git a/Units/regex-with-scope-gnu.d/args.ctags b/Units/regex-with-scope-gnu.d/args.ctags new file mode 100644 index 0000000000..77615282ab --- /dev/null +++ b/Units/regex-with-scope-gnu.d/args.ctags @@ -0,0 +1,14 @@ +# To check the output easier +--sort=no + +--langdef=foo + --map-foo=+.foo + --regex-foo=/^#.*//{exclusive} + --regex-foo=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push} + --regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder} + --regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push} + --regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set} + --regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref} + --regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive} diff --git a/Units/regex-with-scope-gnu.d/expected.tags b/Units/regex-with-scope-gnu.d/expected.tags new file mode 100644 index 0000000000..3a6c44eb87 --- /dev/null +++ b/Units/regex-with-scope-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-with-scope-gnu.d/input.foo b/Units/regex-with-scope-gnu.d/input.foo new file mode 100644 index 0000000000..41eafd79a1 --- /dev/null +++ b/Units/regex-with-scope-gnu.d/input.foo @@ -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 diff --git a/Units/regex-with-scope-nested-gnu.d/args.ctags b/Units/regex-with-scope-nested-gnu.d/args.ctags new file mode 100644 index 0000000000..502137fa7f --- /dev/null +++ b/Units/regex-with-scope-nested-gnu.d/args.ctags @@ -0,0 +1,22 @@ +# To check the output easier +--sort=no +--fields=+e + +--langdef=foo + --map-foo=+.foo + --regex-foo=/^#.*//{exclusive} + --regex-foo=/^[[:blank:]]*define[[:blank:]]+([[:alnum:]_]+)[[:blank:]]*\{/\1/d,definition/{scope=push} + --regex-foo=/^[[:blank:]]*\{/_/d,definition/{scope=push}{placeholder} + --regex-foo=/^[[:blank:]]*package[[:blank:]]+([[:alnum:]_]+)/\1/p,package/{scope=push} + --regex-foo=/^[[:blank:]]*end[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{exclusive} + --regex-foo=/^[[:blank:]]*ns[[:blank:]]+([[:alnum:]_]+)/\1/n,namespace/{scope=set} + --regex-foo=/^[[:blank:]]*var[[:blank:]]+([[:alnum:]_]+)/\1/v,var/{scope=ref} + --regex-foo=/^[[:blank:]]*global//{scope=clear}{exclusive} + +--langdef=bar{base=foo} + --kinddef-bar=s,scope,scopes + --kinddef-bar=d,definition,definitions + --regex-bar=/^# open:([[:alnum:]_]+)/\1/s/{scope=push} + --regex-bar=/^# def:([[:alnum:]_]+)/\1/d/{scope=ref} + --regex-bar=/^# close//{scope=pop}{exclusive} diff --git a/Units/regex-with-scope-nested-gnu.d/expected.tags b/Units/regex-with-scope-nested-gnu.d/expected.tags new file mode 100644 index 0000000000..00331d4e6d --- /dev/null +++ b/Units/regex-with-scope-nested-gnu.d/expected.tags @@ -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 diff --git a/Units/regex-with-scope-nested-gnu.d/input.foo b/Units/regex-with-scope-nested-gnu.d/input.foo new file mode 100644 index 0000000000..bbd46beed2 --- /dev/null +++ b/Units/regex-with-scope-nested-gnu.d/input.foo @@ -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