[geany/geany] 46a123: python: Fix handling of inline comments

Colomban Wendling git-noreply at xxxxx
Thu Jun 25 20:47:32 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Thu, 25 Jun 2015 20:47:32 UTC
Commit:      46a123d6fe6279896197738d709d4420861df651
             https://github.com/geany/geany/commit/46a123d6fe6279896197738d709d4420861df651

Log Message:
-----------
python: Fix handling of inline comments

If there was two hashes (#) in an inline comment, only the content
between the two was considered a comment.

X-Universal-CTags-Commit-ID: ee93f5b9f393e76a850cf8c894cc748a62981156


Modified Paths:
--------------
    tagmanager/ctags/python.c
    tests/ctags/Makefile.am
    tests/ctags/python-comments.py
    tests/ctags/python-comments.py.tags

Modified: tagmanager/ctags/python.c
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -239,8 +239,11 @@ static const char *skipEverything (const char *cp)
 	int match;
 	for (; *cp; cp++)
 	{
+		if (*cp == '#')
+			return strchr(cp, '\0');
+
 		match = 0;
-		if (*cp == '"' || *cp == '\'' || *cp == '#')
+		if (*cp == '"' || *cp == '\'')
 			match = 1;
 
 		/* these checks find unicode, binary (Python 3) and raw strings */


Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -239,6 +239,7 @@ test_sources = \
 	py_constructor_arglist.py		\
 	py-skipped-string.py			\
 	python-anonymous-nestlevel_ctags-bug-356.py	\
+	python-comments.py				\
 	qualified_types.f90				\
 	random.sql						\
 	readlob.sql						\


Modified: tests/ctags/python-comments.py
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,8 @@
+
+import foo ## as bug1
+
+"hello" ## import bug2
+"hi" # something # class bug3
+
+for i in range(1, 2): ##class bug4
+    pass ## class bug5


Modified: tests/ctags/python-comments.py.tags
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,2 @@
+# format=tagmanager
+foo�32768�0



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list