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

Tcl parser - Ctags can not generating tags for some proc #3638

Closed
kenifanying opened this issue Feb 5, 2023 · 1 comment · Fixed by #3639
Closed

Tcl parser - Ctags can not generating tags for some proc #3638

kenifanying opened this issue Feb 5, 2023 · 1 comment · Fixed by #3639
Assignees

Comments

@kenifanying
Copy link

The name of the parser:Universal Ctags

The command line you used to run ctags:

$ ctags -R .

The content of input file:

proc test1 {a} {
	set i 1
	set PORT1 Gi0/1
	set PORT2 Te1/1
	puts "[format "%10s %10s %10s" "$i |" $PORT1 $PORT2]"
}
proc test2 {} {
	puts "test2"
}

The tags output you are not satisfied with:

!_TAG_EXTRA_DESCRIPTION	anonymous	/Include tags for non-named objects like lambda/
!_TAG_EXTRA_DESCRIPTION	fileScope	/Include tags of file scope/
!_TAG_EXTRA_DESCRIPTION	pseudo	/Include pseudo tags/
!_TAG_EXTRA_DESCRIPTION	subparser	/Include tags generated by subparsers/
!_TAG_FIELD_DESCRIPTION	epoch	/the last modified time of the input file (only for F\/file kind tag)/
!_TAG_FIELD_DESCRIPTION	file	/File-restricted scoping/
!_TAG_FIELD_DESCRIPTION	input	/input file/
!_TAG_FIELD_DESCRIPTION	name	/tag name/
!_TAG_FIELD_DESCRIPTION	pattern	/pattern/
!_TAG_FIELD_DESCRIPTION	typeref	/Type and name of a variable or typedef/
!_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
!_TAG_KIND_DESCRIPTION!Tcl	n,namespace	/namespaces/
!_TAG_KIND_DESCRIPTION!Tcl	p,procedure	/procedures/
!_TAG_OUTPUT_EXCMD	mixed	/number, pattern, mixed, or combineV2/
!_TAG_OUTPUT_FILESEP	slash	/slash or backslash/
!_TAG_OUTPUT_MODE	u-ctags	/u-ctags or e-ctags/
!_TAG_OUTPUT_VERSION	0.0	/current.age/
!_TAG_PARSER_VERSION!Tcl	0.0	/current.age/
!_TAG_PATTERN_LENGTH_LIMIT	96	/0 for no limit/
!_TAG_PROC_CWD	C:/Users/tony/Desktop/test-ctags/	//
!_TAG_PROGRAM_AUTHOR	Universal Ctags Team	//
!_TAG_PROGRAM_NAME	Universal Ctags	/Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL	https://ctags.io/	/official site/
!_TAG_PROGRAM_VERSION	6.0.0	/p6.0.20230122.0/
test1	./fw_assistant.tcl	/^proc test1 {a} {$/;"	p

The proc test2 {} is missing.

The tags output you expect:
This is the output using Exuberant Ctags 5.8

!_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR	Darren Hiebert	/dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME	Exuberant Ctags	//
!_TAG_PROGRAM_URL	http://ctags.sourceforge.net	/official site/
!_TAG_PROGRAM_VERSION	5.8	//
test1	.\fw_assistant.tcl	/^proc test1 {a} {$/;"	p
test2	.\fw_assistant.tcl	/^proc test2 {} {$/;"	p

Ctags can generating tags correct after delete this line,

puts "[format "%10s %10s %10s" "$i |" $PORT1 $PORT2]"

The version of ctags:

$ ctags --version
Universal Ctags 6.0.0(p6.0.20230122.0)

How do you get ctags binary:

win32 binary taken from Universal-ctags/ctags-win32 project

@masatake masatake self-assigned this Feb 5, 2023
@masatake
Copy link
Member

masatake commented Feb 5, 2023

Thank you for reporting. The following change may fix this issue.
I don't have enough time to make a pull request for the change.

diff --git a/parsers/tcl.c b/parsers/tcl.c
index afc326bf5..249486806 100644
--- a/parsers/tcl.c
+++ b/parsers/tcl.c
@@ -177,7 +177,7 @@ static void readIdentifier (vString *string)
 	while (1)
 	{
 		int c = getcFromInputFile ();
-		if (isgraph (c) && (!strchr ("{}[]", c)))
+		if (isgraph (c) && (!strchr ("{}[]\"", c)))
 			vStringPut (string, c);
 		else
 		{

masatake added a commit to masatake/ctags that referenced this issue Feb 6, 2023
Close universal-ctags#3638.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
masatake added a commit to masatake/ctags that referenced this issue Feb 6, 2023
Close universal-ctags#3638.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants