From 2d95161b051acc29e7db1163f185a87bb7702bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 29 May 2011 17:40:50 +0000 Subject: [PATCH] When checking for literal strings to ignore, consider also unicode, binary and raw strings. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5821 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ tagmanager/python.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index dc9fc80f..09ab02a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-05-29 Enrico Tröger + + * tagmanager/python.c: + When checking for literal strings to ignore, consider also + unicode, binary and raw strings. + + 2011-05-27 Colomban Wendling * src/prefs.c: diff --git a/tagmanager/python.c b/tagmanager/python.c index a9937013..87b08f73 100644 --- a/tagmanager/python.c +++ b/tagmanager/python.c @@ -195,9 +195,30 @@ static const char *skipString (const char *cp) /* Skip everything up to an identifier start. */ static const char *skipEverything (const char *cp) { + int match; for (; *cp; cp++) { + match = 0; if (*cp == '"' || *cp == '\'' || *cp == '#') + match = 1; + + /* these checks find unicode, binary (Python 3) and raw strings */ + if (!match && ( + !strncasecmp(cp, "u'", 2) || !strncasecmp(cp, "u\"", 2) || + !strncasecmp(cp, "r'", 2) || !strncasecmp(cp, "r\"", 2) || + !strncasecmp(cp, "b'", 2) || !strncasecmp(cp, "b\"", 2))) + { + match = 1; + cp += 1; + } + if (!match && ( + !strncasecmp(cp, "ur'", 3) || !strncasecmp(cp, "ur\"", 3) || + !strncasecmp(cp, "br'", 3) || !strncasecmp(cp, "br\"", 3))) + { + match = 1; + cp += 2; + } + if (match) { cp = skipString(cp); if (!*cp) break;