Skip to content
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: 5 additions & 5 deletions Tmain/extras-long.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- anonymous no NONE no Include tags for non-named objects like lambda
- subword no NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope no NONE no Include tags of file scope
f inputFile no NONE no Include an entry for the base file name of every input file
f inputFile no NONE no Include an entry for the base and full file names of every input file
g guest no NONE no Include tags generated by guest parsers
p pseudo no NONE no Include pseudo tags
q qualified no NONE no Include an extra class-qualified tag entry for each tag
Expand All @@ -14,7 +14,7 @@ s subparser yes NONE no Include tags generated by subpa
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword no NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope yes NONE no Include tags of file scope
f inputFile no NONE no Include an entry for the base file name of every input file
f inputFile no NONE no Include an entry for the base and full file names of every input file
g guest no NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified no NONE no Include an extra class-qualified tag entry for each tag
Expand All @@ -26,7 +26,7 @@ s subparser yes NONE no Include tags generated by subpa
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword no NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope no NONE no Include tags of file scope
f inputFile no NONE no Include an entry for the base file name of every input file
f inputFile no NONE no Include an entry for the base and full file names of every input file
g guest no NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified no NONE no Include an extra class-qualified tag entry for each tag
Expand All @@ -38,7 +38,7 @@ s subparser yes NONE no Include tags generated by subpa
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword no NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope no NONE no Include tags of file scope
f inputFile yes NONE no Include an entry for the base file name of every input file
f inputFile yes NONE no Include an entry for the base and full file names of every input file
g guest no NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified no NONE no Include an extra class-qualified tag entry for each tag
Expand All @@ -50,7 +50,7 @@ s subparser yes NONE no Include tags generated by subpa
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword no NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope no NONE no Include tags of file scope
f inputFile no NONE no Include an entry for the base file name of every input file
f inputFile no NONE no Include an entry for the base and full file names of every input file
g guest no NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified yes NONE no Include an extra class-qualified tag entry for each tag
Expand Down
4 changes: 2 additions & 2 deletions Tmain/list-extras.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword yes NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope yes NONE no Include tags of file scope
f inputFile yes NONE no Include an entry for the base file name of every input file
f inputFile yes NONE no Include an entry for the base and full file names of every input file
g guest yes NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified yes NONE no Include an extra class-qualified tag entry for each tag
Expand All @@ -14,7 +14,7 @@ s subparser yes NONE no Include tags generated by subpa
- anonymous yes NONE no Include tags for non-named objects like lambda
- subword yes NONE no Include tags for subwords generated by splitting the original tag (only for ctags development)
F fileScope yes NONE no Include tags of file scope
f inputFile yes NONE no Include an entry for the base file name of every input file
f inputFile yes NONE no Include an entry for the base and full file names of every input file
g guest yes NONE no Include tags generated by guest parsers
p pseudo yes NONE no Include pseudo tags
q qualified yes NONE no Include an extra class-qualified tag entry for each tag
Expand Down
1 change: 1 addition & 0 deletions Units/extra-total-lines.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
./Units/extra-total-lines.d/input.c input.c 1;" F end:6
input.c input.c 1;" F end:6
main input.c 2;" f typeref:typename:int end:5
1 change: 1 addition & 0 deletions Units/parser-autoconf.r/disabling-m4.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PKG_PREREQ input.ac /^AC_DEFUN([PKG_PREREQ],$/;" m line:4 language:Autoconf roles:def end:8
input.ac input.ac 1;" F line:1 language:Autoconf roles:def end:12
./Units/parser-autoconf.r/disabling-m4.d/input.ac input.ac 1;" F line:1 language:Autoconf roles:def end:12
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PKG_PREREQ input.m4 /^AC_DEFUN([PKG_PREREQ],$/;" m line:4 language:Autoconf roles:def end:8
input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:12
./Units/parser-autoconf.r/forcing-autoconf-and-disabling-m4.d/input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:12
1 change: 1 addition & 0 deletions Units/parser-autoconf.r/simple2.ac.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ PKG_PREREQ input.ac /^AC_DEFUN([PKG_PREREQ],$/;" m line:4 language:Autoconf role
y input.ac /^m4_define([y], 2)$/;" d line:9 language:M4 roles:def end:9
z input.ac /^define(`z', 3)$/;" d line:11 language:M4 roles:def end:11
input.ac input.ac 1;" F line:1 language:Autoconf roles:def end:12
./Units/parser-autoconf.r/simple2.ac.d/input.ac input.ac 1;" F line:1 language:Autoconf roles:def end:12
1 change: 1 addition & 0 deletions Units/parser-m4.r/disabling-autoconf.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ x input.m4 /^define(`x', 1)$/;" d line:1 language:M4 roles:def end:1
[y] input.m4 /^m4_define([y], 2)$/;" d line:7 language:M4 roles:def end:7
z input.m4 /^define(`z', 3)$/;" d line:9 language:M4 roles:def end:9
input.m4 input.m4 1;" F line:1 language:M4 roles:def end:10
./Units/parser-m4.r/disabling-autoconf.d/input.m4 input.m4 1;" F line:1 language:M4 roles:def end:10
1 change: 1 addition & 0 deletions Units/parser-m4.r/disabling-subparser.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ x input.m4 /^define(`x', 1)$/;" d line:1 language:M4 roles:def end:1
[y] input.m4 /^m4_define([y], 2)$/;" d line:7 language:M4 roles:def end:7
z input.m4 /^define(`z', 3)$/;" d line:9 language:M4 roles:def end:9
input.m4 input.m4 1;" F line:1 language:M4 roles:def end:10
./Units/parser-m4.r/disabling-subparser.d/input.m4 input.m4 1;" F line:1 language:M4 roles:def end:10
1 change: 1 addition & 0 deletions Units/parser-m4.r/m4-comment.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CAPTUREME input.m4 /^- define(CAPTUREME,val0)$/;" d line:1 language:M4 end:1
input.m4 input.m4 1;" F line:1 language:M4 end:3
./Units/parser-m4.r/m4-comment.d/input.m4 input.m4 1;" F line:1 language:M4 end:3
1 change: 1 addition & 0 deletions Units/parser-m4.r/m4-multi-undef.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ a input.m4 /^undefine(a,b,c)$/;" d line:1 language:M4 roles:undef
b input.m4 /^undefine(a,b,c)$/;" d line:1 language:M4 roles:undef
c input.m4 /^undefine(a,b,c)$/;" d line:1 language:M4 roles:undef
input.m4 input.m4 1;" F line:1 language:M4 roles:def end:1
./Units/parser-m4.r/m4-multi-undef.d/input.m4 input.m4 1;" F line:1 language:M4 roles:def end:1
1 change: 1 addition & 0 deletions Units/parser-m4.r/m4-switch-lang-by-ac.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ PKG_PREREQ input.m4 /^AC_DEFUN([PKG_PREREQ],$/;" m line:2 language:Autoconf role
y input.m4 /^m4_define([y], 2)$/;" d line:7 language:M4 roles:def end:7
z input.m4 /^define(`z', 3)$/;" d line:9 language:M4 roles:def end:9
input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:10
./Units/parser-m4.r/m4-switch-lang-by-ac.d/input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:10
1 change: 1 addition & 0 deletions Units/parser-m4.r/m4-switch-lang-by-m4.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
y input.m4 /^m4_define([y], 2)$/;" d line:1 language:M4 roles:def end:1
z input.m4 /^define(`z', 3)$/;" d line:3 language:M4 roles:def end:3
input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:3
./Units/parser-m4.r/m4-switch-lang-by-m4.d/input.m4 input.m4 1;" F line:1 language:Autoconf roles:def end:3
1 change: 1 addition & 0 deletions Units/parser-python.r/python-end-field.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ A.h input.py /^ def h(self):$/;" m line:12 class:A end:14
i input.py /^ def i(self):$/;" m line:16 class:A end:18
A.i input.py /^ def i(self):$/;" m line:16 class:A end:18
input.py input.py 1;" F line:1 end:18
./Units/parser-python.r/python-end-field.d/input.py input.py 1;" F line:1 end:18
1 change: 1 addition & 0 deletions Units/parser-python.r/simple.py.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ two.only input.py /^ def only(arg):$/;" kind:member line:48 language:Python s
three input.py /^three\\$/;" kind:class line:52 language:Python inherits:A, B, C access:public roles:def end:54
foo input.py /^foo($/;" kind:function line:57 language:Python access:public signature:( x , y, z) roles:def end:60
input.py input.py 1;" kind:file line:1 language:Python roles:def extras:inputFile end:60
./Units/parser-python.r/simple.py.d/input.py input.py 1;" kind:file line:1 language:Python roles:def extras:inputFile end:60
1 change: 1 addition & 0 deletions Units/parser-yacc.r/nested.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ yyerror input.y /^yyerror(char *s)$/;" f language:C typeref:typename:int extras:
yywrap input.y /^yywrap(void)$/;" f language:C typeref:typename:int extras:guest
CFGParseFile input.y /^CFGParseFile(FILE *file)$/;" f language:C typeref:typename:int extras:guest
input.y input.y 1;" F language:YACC extras:inputFile
./Units/parser-yacc.r/nested.d/input.y input.y 1;" F language:YACC extras:inputFile
1 change: 1 addition & 0 deletions Units/simple-glade.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ GtkWindow input.glade /^<widget class="GtkWindow" id="window1">$/;" class line:6
GtkButton input.glade /^ <widget class="GtkButton" id="button1">$/;" class line:23 roles:widget
on_button1_clicked input.glade /^ <signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 26 Dec 20/;" handler line:30 roles:handler
input.glade input.glade 1;" file line:1 roles:def
./Units/simple-glade.d/input.glade input.glade 1;" file line:1 roles:def
20 changes: 18 additions & 2 deletions main/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ static void addCommonPseudoTags (void)
extern void makeFileTag (const char *const fileName)
{
tagEntryInfo tag;
const char *base;
unsigned long endLine = 0;

if (!isXtagEnabled(XTAG_FILE_NAMES))
return;

initTagEntry (&tag, baseFilename (fileName), KIND_FILE_INDEX);
base = baseFilename (fileName);
initTagEntry (&tag, base, KIND_FILE_INDEX);

tag.isFileEntry = true;
tag.lineNumberEntry = true;
Expand All @@ -195,10 +198,23 @@ extern void makeFileTag (const char *const fileName)
unnecessary read line loop. */
while (readLineFromInputFile () != NULL)
; /* Do nothing */
tag.extensionFields.endLine = getInputLineNumber ();
endLine = getInputLineNumber ();
}

tag.extensionFields.endLine = endLine;
makeTagEntry (&tag);

/* add the full filename too */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to emit full filename only when --extras=+q is given.
So the comment will be :

/* add the full filename too if --extras=+q is given. */

if (base != fileName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition will be (if you follow my idea):

if (base != fileName && isXtagEnabled (XTAG_QUALIFIED_TAGS))

initTagEntry (&tag, fileName, KIND_FILE_INDEX);
tag.isFileEntry = true;
tag.lineNumberEntry = true;
markTagExtraBit (&tag, XTAG_FILE_NAMES);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markTagExtraBit (&tag, XTAG_QUALIFIED_TAGS);

tag.lineNumber = 1;
if (isFieldEnabled (FIELD_END_LINE))
tag.extensionFields.endLine = endLine;
makeTagEntry (&tag);
}
}

static void updateSortedFlag (
Expand Down
2 changes: 1 addition & 1 deletion main/xtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static xtagDefinition xtagDefinitions [] = {
{ true, 'F', "fileScope",
"Include tags of file scope" },
{ false, 'f', "inputFile",
"Include an entry for the base file name of every input file",
"Include an entry for the base and full file names of every input file",
NULL,
NULL,
enableFileKind},
Expand Down
8 changes: 4 additions & 4 deletions man/ctags.1.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,10 @@ are not listed here. They are experimental or debugging purpose.
Equivalent to ``--file-scope``.

f/inputFile
Include an entry for the base file name of every source file
(e.g. "example.c"), which addresses the first line of the file.
If ``end:`` field is enabled, the end line number of the file
can be attached to the tag.
Include entries for the base and full file names of every source
Copy link
Member

@masatake masatake Jul 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the original document as is.
Instead, could you add "If --extras=+q is given, ..." ?

file (e.g. "example.c" and "src/example.c"), which addresses the
first line of the file. If ``end:`` field is enabled, the end
line number of the file can be attached to the tag.

p/pseudo
Include pseudo tags. Enabled by default unless the tag file is
Expand Down