Skip to content

Commit

Permalink
CXX: extract reference tags
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Nov 20, 2022
1 parent 7809a17 commit 1723d6b
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Tmain/list-kinds-full.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION
D macroparam no no 0 C parameters inside macro definitions
L label no no 0 C goto labels
Y unknown no yes 1 C unknown identifier
d macro yes no 2 C macro definitions
e enumerator yes no 0 C enumerators (values inside an enumeration)
f function yes no 0 C function definitions
Expand All @@ -21,6 +22,7 @@ D macroparam no no 0 C parameters inside macro definitions
L label no no 0 C goto labels
N name no no 0 NONE names imported via using scope::symbol
U using no no 0 NONE using namespace statements
Y unknown no yes 1 C unknown identifier
Z tparam no no 0 NONE template parameters
c class yes no 0 NONE classes
d macro yes no 2 C macro definitions
Expand Down
31 changes: 31 additions & 0 deletions Tmain/list-roles.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ Automake d/directory program on directory for PROGRA
Automake d/directory script on directory for SCRIPTS primary
Basic f/function decl on declared
Bats S/script loaded on script loaed with "load" command
C Y/unknown ref off referenced anyhow
C d/macro condition off used in part of #if/#ifdef/#elif conditions
C d/macro undef on undefined
C h/header local on local header
C h/header system on system header
C++ Y/unknown ref off referenced anyhow
C++ d/macro condition off used in part of #if/#ifdef/#elif conditions
C++ d/macro undef on undefined
C++ h/header local on local header
Expand All @@ -30,6 +32,7 @@ CPreProcessor d/macro condition off used in part of #if/
CPreProcessor d/macro undef on undefined
CPreProcessor h/header local on local header
CPreProcessor h/header system on system header
CUDA Y/unknown ref off referenced anyhow
CUDA d/macro condition off used in part of #if/#ifdef/#elif conditions
CUDA d/macro undef on undefined
CUDA h/header local on local header
Expand Down Expand Up @@ -136,10 +139,12 @@ Automake d/directory program on directory for PROGRA
Automake d/directory script on directory for SCRIPTS primary
Basic f/function decl on declared
Bats S/script loaded on script loaed with "load" command
C Y/unknown ref off referenced anyhow
C d/macro condition off used in part of #if/#ifdef/#elif conditions
C d/macro undef on undefined
C h/header local on local header
C h/header system on system header
C++ Y/unknown ref off referenced anyhow
C++ d/macro condition off used in part of #if/#ifdef/#elif conditions
C++ d/macro undef on undefined
C++ h/header local on local header
Expand All @@ -148,6 +153,7 @@ CPreProcessor d/macro condition off used in part of #if/
CPreProcessor d/macro undef on undefined
CPreProcessor h/header local on local header
CPreProcessor h/header system on system header
CUDA Y/unknown ref off referenced anyhow
CUDA d/macro condition off used in part of #if/#ifdef/#elif conditions
CUDA d/macro undef on undefined
CUDA h/header local on local header
Expand Down Expand Up @@ -239,6 +245,7 @@ Zsh s/script loaded on loaded
# C.*
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand Down Expand Up @@ -276,6 +283,7 @@ s/script loaded on loaded
# C.* with disabling all roles of all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local off local header
Expand All @@ -285,6 +293,7 @@ h/header system off system header
# C.* with disabling all roles of all kinds of all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local off local header
Expand All @@ -295,6 +304,7 @@ h/header system off system header
# after disabling system role of header kind of C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref on referenced anyhow
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -305,6 +315,7 @@ h/header system on system header
# after disabling system role of header kind of C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref on referenced anyhow
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -314,6 +325,7 @@ h/header system on system header
# C.* with disabling all roles in C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local off local header
Expand All @@ -330,6 +342,7 @@ s/script loaded on loaded
# C.* with disabling all roles of all kinds in C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local off local header
Expand All @@ -347,6 +360,7 @@ s/script loaded on loaded
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref on referenced anyhow
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -365,6 +379,7 @@ s/script loaded off loaded
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref on referenced anyhow
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -382,6 +397,7 @@ s/script loaded off loaded
# C.* with disabling all roles of {header} kind in C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local off local header
Expand All @@ -398,6 +414,7 @@ s/script loaded on loaded
# C.* with disabling all roles of h kind in C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local off local header
Expand All @@ -415,6 +432,7 @@ s/script loaded on loaded
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand All @@ -433,6 +451,7 @@ s/script loaded off loaded
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand All @@ -450,6 +469,7 @@ s/script loaded off loaded
# C.* with disabling system role of h kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -459,6 +479,7 @@ h/header system off system header
# C.* with disabling system role of {header} kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -468,6 +489,7 @@ h/header system off system header
# C.* with enabling system role of h kind after disabling the role
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -477,6 +499,7 @@ h/header system on system header
# C.* with enabling system role of {header} kind after disabling the role
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -486,6 +509,7 @@ h/header system on system header
# C.* with disabling system and local roles of h kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local off local header
Expand All @@ -495,6 +519,7 @@ h/header system off system header
# C.* with disabling system and local roles of {header} kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local off local header
Expand All @@ -505,6 +530,7 @@ h/header system off system header
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand All @@ -515,6 +541,7 @@ h/header system on system header
# after disabling all roles in all languages
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand All @@ -524,6 +551,7 @@ h/header system on system header
# C.* with disabling local role of h kind and undef role of d kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local off local header
Expand All @@ -533,6 +561,7 @@ h/header system on system header
# C.* with enabling all roles of header kinds after disabling all roles of the kind
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
h/header local on local header
Expand All @@ -542,6 +571,7 @@ h/header system on system header
# C.* with enabling all roles of header kinds after disabling all roles of the kinds of C language
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand All @@ -551,6 +581,7 @@ h/header system on system header
# C.* with enabling all roles of header kinds after disabling all roles of the kinds of C language (short notation)
#
#KIND(L/N) NAME ENABLED DESCRIPTION
Y/unknown ref off referenced anyhow
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
h/header local on local header
Expand Down
2 changes: 2 additions & 0 deletions Tmain/nested-subparsers.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ x external and forward variable declarations [off]
z function parameters inside function or prototype definitions [off]
L goto labels [off]
D parameters inside macro definitions [off]
Y unknown identifier [off]
#
# list kinds Event
#
Expand All @@ -36,6 +37,7 @@ n name
#LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION
D macroparam no no 0 C parameters inside macro definitions
L label no no 0 C goto labels
Y unknown no yes 1 C unknown identifier
d macro yes no 2 C macro definitions
e enumerator yes no 0 C enumerators (values inside an enumeration)
f function yes no 0 C function definitions
Expand Down
5 changes: 5 additions & 0 deletions Units/parser-c.r/c-reftags.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--sort=no
--extras=+r
--fields=+r
--kinds-C=*
--roles-C.{unknown}=*
13 changes: 13 additions & 0 deletions Units/parser-c.r/c-reftags.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
x input.c /^struct x {$/;" s file: roles:def
y input.c /^ int y;$/;" m struct:x typeref:typename:int file: roles:def
X input.c /^enum X {$/;" g file: roles:def
A input.c /^ A, B$/;" e enum:X file: roles:def
B input.c /^ A, B$/;" e enum:X file: roles:def
i input.c /^extern int i;$/;" x typeref:typename:int roles:def
f input.c /^int f(int j)$/;" f typeref:typename:int roles:def
j input.c /^int f(int j)$/;" z function:f typeref:typename:int file: roles:def
j input.c /^ if (j == 0)$/;" Y roles:ref
i input.c /^ return i + B + j + f(0);$/;" Y roles:ref
B input.c /^ return i + B + j + f(0);$/;" Y roles:ref
j input.c /^ return i + B + j + f(0);$/;" Y roles:ref
f input.c /^ return i + B + j + f(0);$/;" Y roles:ref
15 changes: 15 additions & 0 deletions Units/parser-c.r/c-reftags.d/input.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct x {
int y;
};

enum X {
A, B
};

extern int i;
int f(int j)
{
if (j == 0)
return 0;
return i + B + j + f(0);
}
4 changes: 2 additions & 2 deletions Units/parser-cxx.r/bug639644.cpp.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__anon21d591360111 input.h /^{$/;" n
foo input.h /^ int foo;$/;" v namespace:__anon21d591360111 typeref:typename:int
__anon21d591360112 input.h /^{$/;" n
foo input.h /^ int foo;$/;" v namespace:__anon21d591360112 typeref:typename:int
12 changes: 6 additions & 6 deletions Units/parser-cxx.r/namespace.cpp.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
__anon396601200111 input.cpp /^namespace {$/;" n file: end:8
anon_f input.cpp /^ void anon_f() { };$/;" f namespace:__anon396601200111 typeref:typename:void end:3
__anon396601200211 input.cpp /^ namespace {$/;" n namespace:__anon396601200111 file: end:7
anon_anon_f input.cpp /^ void anon_anon_f() { };$/;" f namespace:__anon396601200111::__anon396601200211 typeref:typename:void end:6
__anon396601200112 input.cpp /^namespace {$/;" n file: end:8
anon_f input.cpp /^ void anon_f() { };$/;" f namespace:__anon396601200112 typeref:typename:void end:3
__anon396601200212 input.cpp /^ namespace {$/;" n namespace:__anon396601200112 file: end:7
anon_anon_f input.cpp /^ void anon_anon_f() { };$/;" f namespace:__anon396601200112::__anon396601200212 typeref:typename:void end:6
a1 input.cpp /^namespace a1 {$/;" n file: end:24
a1_f input.cpp /^ void a1_f() { }$/;" f namespace:a1 typeref:typename:void end:11
a2 input.cpp /^ namespace a2 {$/;" n namespace:a1 file: end:19
a1_a2_f input.cpp /^ void a1_a2_f() { }$/;" f namespace:a1::a2 typeref:typename:void end:14
a3 input.cpp /^ namespace a3 {$/;" n namespace:a1::a2 file: end:18
a1_a2_a3_f input.cpp /^ void a1_a2_a3_f() { };$/;" f namespace:a1::a2::a3 typeref:typename:void end:17
__anon396601200311 input.cpp /^ namespace {$/;" n namespace:a1 file: end:23
a1_anon_f input.cpp /^ void a1_anon_f() { };$/;" f namespace:a1::__anon396601200311 typeref:typename:void end:22
__anon396601200312 input.cpp /^ namespace {$/;" n namespace:a1 file: end:23
a1_anon_f input.cpp /^ void a1_anon_f() { };$/;" f namespace:a1::__anon396601200312 typeref:typename:void end:22
b1 input.cpp /^namespace b1::b2 {$/;" n file: end:32
b2 input.cpp /^namespace b1::b2 {$/;" n namespace:b1 file: end:32
b1_b2_f input.cpp /^ void b1_b2_f() { };$/;" f namespace:b1::b2 typeref:typename:void end:27
Expand Down
6 changes: 6 additions & 0 deletions Units/parser-qtmoc.r/simple-qt-reftag.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--sort=no
--kinds-C++=+p
--fields=+lK
--extras=+r
--kinds-C++=+{unknown}
--roles-C++.{unknown}=+{ref}
Loading

0 comments on commit 1723d6b

Please sign in to comment.