Skip to content

SQL: make foreign tags for 'interenal' functions #4240

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions Tmain/extras-field-for-pseudo-tags.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
!_TAG_ROLE_DESCRIPTION!C!function foreigncall /called in foreign languages/
!_TAG_ROLE_DESCRIPTION!C!function foreigndecl /declared in foreign languages/
!_TAG_ROLE_DESCRIPTION!C!header local /local header/
!_TAG_ROLE_DESCRIPTION!C!header system /system header/
Expand Down Expand Up @@ -54,6 +55,7 @@ main input.c /^int main (void) { return 0; }$/
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //;" extras:pseudo
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/;" extras:pseudo
!_TAG_PROGRAM_URL https://ctags.io/ /official site/;" extras:pseudo
!_TAG_ROLE_DESCRIPTION!C!function foreigncall /called in foreign languages/;" extras:pseudo
!_TAG_ROLE_DESCRIPTION!C!function foreigndecl /declared in foreign languages/;" extras:pseudo
!_TAG_ROLE_DESCRIPTION!C!header local /local header/;" extras:pseudo
!_TAG_ROLE_DESCRIPTION!C!header system /system header/;" extras:pseudo
Expand Down
3 changes: 2 additions & 1 deletion Tmain/json-output-format.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@
{"_type": "ptag", "name": "TAG_KIND_DESCRIPTION", "parserName": "Python", "path": "m,member", "pattern": "class members"}
{"_type": "ptag", "name": "TAG_KIND_DESCRIPTION", "parserName": "Python", "path": "v,variable", "pattern": "variables"}
{"_type": "ptag", "name": "TAG_OUTPUT_EXCMD", "path": "mixed", "pattern": "number, pattern, mixed, or combineV2"}
{"_type": "ptag", "name": "TAG_PARSER_VERSION", "parserName": "C", "path": "1.1", "pattern": "current.age"}
{"_type": "ptag", "name": "TAG_PARSER_VERSION", "parserName": "C", "path": "2.2", "pattern": "current.age"}
{"_type": "ptag", "name": "TAG_PARSER_VERSION", "parserName": "Go", "path": "0.0", "pattern": "current.age"}
{"_type": "ptag", "name": "TAG_PARSER_VERSION", "parserName": "Man", "path": "0.0", "pattern": "current.age"}
{"_type": "ptag", "name": "TAG_PARSER_VERSION", "parserName": "Python", "path": "1.1", "pattern": "current.age"}
{"_type": "ptag", "name": "TAG_PATTERN_LENGTH_LIMIT", "path": "96", "pattern": "0 for no limit"}
{"_type": "ptag", "name": "TAG_PROGRAM_AUTHOR", "path": "Universal Ctags Team", "pattern": ""}
{"_type": "ptag", "name": "TAG_PROGRAM_NAME", "path": "Universal Ctags", "pattern": "Derived from Exuberant Ctags"}
{"_type": "ptag", "name": "TAG_PROGRAM_URL", "path": "https://ctags.io/", "pattern": "official site"}
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "C", "kindName": "function", "path": "foreigncall", "pattern": "called in foreign languages"}
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "C", "kindName": "function", "path": "foreigndecl", "pattern": "declared in foreign languages"}
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "C", "kindName": "header", "path": "local", "pattern": "local header"}
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "C", "kindName": "header", "path": "system", "pattern": "system header"}
Expand Down
2 changes: 1 addition & 1 deletion Tmain/list-kinds-full.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ D macroparam no no 0 C parameters inside macro definitions
L label no no 0 C goto labels
d macro yes no 2 C macro definitions
e enumerator yes no 0 C enumerators (values inside an enumeration)
f function yes no 1 C function definitions
f function yes no 2 C function definitions
g enum yes no 0 C enumeration names
h header yes yes 2 C included header files
l local no no 0 C local variables
Expand Down
27 changes: 27 additions & 0 deletions Tmain/list-roles.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Basic f/function decl on declared
Bats S/script loaded on script loaed with "load" command
C d/macro condition off used in part of #if/#ifdef/#elif conditions
C d/macro undef on undefined
C f/function foreigncall on called in foreign languages
C f/function foreigndecl on declared in foreign languages
C h/header local on local header
C h/header system on system header
Expand Down Expand Up @@ -173,6 +174,7 @@ Basic f/function decl on declared
Bats S/script loaded on script loaed with "load" command
C d/macro condition off used in part of #if/#ifdef/#elif conditions
C d/macro undef on undefined
C f/function foreigncall on called in foreign languages
C f/function foreigndecl on declared in foreign languages
C h/header local on local header
C h/header system on system header
Expand Down Expand Up @@ -301,6 +303,7 @@ Zsh s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand Down Expand Up @@ -340,6 +343,7 @@ s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -351,6 +355,7 @@ s/struct foreigndecl off declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -363,6 +368,7 @@ s/struct foreigndecl off declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -375,6 +381,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -386,6 +393,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -404,6 +412,7 @@ s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -423,6 +432,7 @@ s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -443,6 +453,7 @@ s/script loaded off loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition on used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -462,6 +473,7 @@ s/script loaded off loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -480,6 +492,7 @@ s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -499,6 +512,7 @@ s/script loaded on loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -519,6 +533,7 @@ s/script loaded off loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -538,6 +553,7 @@ s/script loaded off loaded
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system off system header
Expand All @@ -549,6 +565,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system off system header
Expand All @@ -560,6 +577,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -571,6 +589,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -582,6 +601,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -593,6 +613,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local off local header
h/header system off system header
Expand All @@ -605,6 +626,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -617,6 +639,7 @@ s/struct foreigndecl off declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -628,6 +651,7 @@ s/struct foreigndecl off declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local off local header
h/header system on system header
Expand All @@ -639,6 +663,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef on undefined
f/function foreigncall on called in foreign languages
f/function foreigndecl on declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -650,6 +675,7 @@ s/struct foreigndecl on declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand All @@ -661,6 +687,7 @@ s/struct foreigndecl off declared in foreign languages
#KIND(L/N) NAME ENABLED DESCRIPTION
d/macro condition off used in part of #if/#ifdef/#elif conditions
d/macro undef off undefined
f/function foreigncall off called in foreign languages
f/function foreigndecl off declared in foreign languages
h/header local on local header
h/header system on system header
Expand Down
2 changes: 1 addition & 1 deletion Tmain/nested-subparsers.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ D macroparam no no 0 C parameters inside macro definit
L label no no 0 C goto labels
d macro yes no 2 C macro definitions
e enumerator yes no 0 C enumerators (values inside an enumeration)
f function yes no 1 C function definitions
f function yes no 2 C function definitions
g enum yes no 0 C enumeration names
h header yes yes 2 C included header files
l local no no 0 C local variables
Expand Down
2 changes: 1 addition & 1 deletion Tmain/version-option.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
parser/C: 1.1
parser/C: 2.2
1 change: 1 addition & 0 deletions Units/parser-sql.r/funcions.d/args.ctags
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--sort=no
--fields=+S
--extras=+g
9 changes: 9 additions & 0 deletions Units/parser-sql.r/funcions.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ isalpha input.sql /^create or replace FUNCTION isalpha(ch CHAR)$/;" f typeref:ty
isalphanum input.sql /^create or replace FUNCTION isalphanum(ch CHAR)$/;" f typeref:typename:BOOLEAN signature:(ch CHAR)
isdigit input.sql /^create or replace function isdigit(ch CHAR)$/;" f typeref:typename:BOOLEAN signature:(ch CHAR)
rpmver_array input.sql /^create or replace FUNCTION rpmver_array (string1 IN VARCHAR)$/;" f typeref:typename:evr_array_item[] signature:(string1 IN VARCHAR)
str1 input.sql /^ str1 VARCHAR := string1;$/;" v
digits input.sql /^ digits VARCHAR(10) := '0123456789';$/;" v
lc_alpha input.sql /^ lc_alpha VARCHAR(27) := 'abcdefghijklmnopqrstuvwxyz';$/;" v
uc_alpha input.sql /^ uc_alpha VARCHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';$/;" v
alpha input.sql /^ alpha VARCHAR(54) := lc_alpha || uc_alpha;$/;" v
one input.sql /^ one VARCHAR;$/;" v
isnum input.sql /^ isnum BOOLEAN;$/;" v
ver_array input.sql /^ ver_array evr_array_item[] := ARRAY[]::evr_array_item[];$/;" v
segment_loop input.sql /^ <<segment_loop>>$/;" L
dfunc0 input-0.sql /^create function dfunc0(a text DEFAULT '->''Hello', b text DEFAULT 'World''') returns text as $\$$/;" f typeref:typename:text signature:(a text DEFAULT '->''Hello', b text DEFAULT 'World''')
dfunc1 input-0.sql /^create function dfunc1(r numeric = 20.39, p numeric DEFAULT 99.88) returns numeric as $\$$/;" f typeref:typename:numeric signature:(r numeric = 20.39, p numeric DEFAULT 99.88)
dfunc2 input-0.sql /^create function dfunc2(anyelement = 'World'::text) returns text as $\$$/;" f typeref:typename:text signature:(anyelement = 'World'::text)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--sort=no
--fields=+lSr
--extras=+r
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
isnlt input.sql /^CREATE FUNCTION isnlt(ean13, ean13)$/;" f language:SQL typeref:typename:boolean signature:(ean13, ean13) roles:def
int8lt input.sql /^ AS 'int8lt'$/;" f language:C roles:foreigncall
isnle input.sql /^CREATE FUNCTION isnle(ean13, ean13)$/;" f language:SQL typeref:typename:boolean signature:(ean13, ean13) roles:def
int8le input.sql /^ AS 'int8le'$/;" f language:C roles:foreigncall
12 changes: 12 additions & 0 deletions Units/parser-sql.r/sql_pgSQL_with_language_internal.d/input.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE FUNCTION isnlt(ean13, ean13)
RETURNS boolean
AS 'int8lt'
LANGUAGE 'internal'
IMMUTABLE STRICT
PARALLEL SAFE;
CREATE FUNCTION isnle(ean13, ean13)
RETURNS boolean
AS 'int8le'
LANGUAGE 'internal'
IMMUTABLE STRICT
PARALLEL SAFE;
5 changes: 5 additions & 0 deletions docs/man/ctags-lang-c.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Change since "0.0"

* New field ``alias``

Change since "1.1"
~~~~~~~~~~~~~~~~~~

* New role ``foreigncall`` for ``function`` kind

SEE ALSO
--------
:ref:`ctags(1) <ctags(1)>`,
Expand Down
5 changes: 5 additions & 0 deletions man/ctags-lang-c.7.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Change since "0.0"

* New field ``alias``

Change since "1.1"
~~~~~~~~~~~~~~~~~~

* New role ``foreigncall`` for ``function`` kind

SEE ALSO
--------
ctags(1),
Expand Down
4 changes: 2 additions & 2 deletions parsers/cxx/cxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ parserDefinition * CParser (void)
def->dependencyCount = ARRAY_SIZE (dependencies);
def->useCork = CORK_QUEUE|CORK_SYMTAB; // We use corking to block output until the end of file

def->versionCurrent = 1;
def->versionAge = 1;
def->versionCurrent = 2;
def->versionAge = 2;

return def;
}
Expand Down
Loading
Loading