[geany/geany] be2b28: python: do not ignore the character after a skipped string

Markus Heidelberg git-noreply at xxxxx
Wed Feb 11 17:28:59 UTC 2015


Branch:      refs/heads/master
Author:      Markus Heidelberg <markus.heidelberg at web.de>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 11 Feb 2015 17:28:59 UTC
Commit:      be2b280377b0479db749cfcf573ff7b35d70693b
             https://github.com/geany/geany/commit/be2b280377b0479db749cfcf573ff7b35d70693b

Log Message:
-----------
python: do not ignore the character after a skipped string

Regression for the triple start string issue has been introduced in SVN
revision 669 (fishman git a314e11158307db84c0dadb758846b2302fe69cd) on
2008-06-11. In ctags 5.7 it did work, in 5.8 not anymore.
See also http://sourceforge.net/p/ctags/bugs/229/ for the original bug,
which led to the old fix.

The other issue with normal strings in skipEverything() is even older.


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

Modified: tagmanager/ctags/python.c
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -266,6 +266,8 @@ static const char *skipEverything (const char *cp)
 		}
 		if (isIdentifierFirstCharacter ((int) *cp))
 			return cp;
+		if (match)
+			cp--; /* avoid jumping over the character after a skipped string */
 	}
 	return cp;
 }
@@ -536,6 +538,7 @@ static char const *find_triple_start(char const *string, char const **which)
 			}
 			cp = skipString(cp);
 			if (!*cp) break;
+			cp--; /* avoid jumping over the character after a skipped string */
 		}
 	}
 	return NULL;


Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -228,6 +228,7 @@ test_sources = \
 	prototype.h						\
 	pure_elem.f95					\
 	py_constructor_arglist.py		\
+	py-skipped-string.py			\
 	qualified_types.f90				\
 	random.sql						\
 	readlob.sql						\


Modified: tests/ctags/py-skipped-string.py
30 lines changed, 30 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,30 @@
+# triple start string immediately after a normal string not detected
+
+def f1():
+    ''"""
+    The string above was not detected as triple start string,
+    but the one below instead.
+    """
+    print "f1"
+
+def f2():
+    ''"""
+    The string above was then detected as end string,
+    and the one below as start string again.
+    """
+    print "f2"
+
+def f3():
+    """
+    The string below is prepared so that ctags with the bug does not start a
+    new triple string. For a clean precondition for the next test.
+    ''"""
+    print "f3"
+
+# normal string immediately after a normal string not detected
+
+''" import os\
+"
+
+""' def fX():\
+'


Modified: tests/ctags/py-skipped-string.py.tags
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,4 @@
+# format=tagmanager
+f1�16�()�0
+f2�16�()�0
+f3�16�()�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