[geany/geany] d2052b: Merge pull request #532 from techee/optimize_python
Colomban Wendling
git-noreply at xxxxx
Thu Jun 25 20:39:02 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:39:02 UTC
Commit: d2052b55bafeb0a6433dfdc9f3b7f95623bb73c2
https://github.com/geany/geany/commit/d2052b55bafeb0a6433dfdc9f3b7f95623bb73c2
Log Message:
-----------
Merge pull request #532 from techee/optimize_python
python: optimize skipEverything()
Modified Paths:
--------------
tagmanager/ctags/python.c
Modified: tagmanager/ctags/python.c
33 lines changed, 20 insertions(+), 13 deletions(-)
===================================================================
@@ -244,20 +244,27 @@ static const char *skipEverything (const char *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)))
+ if (!match)
{
- 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;
+ boolean r_first = (*cp == 'r' || *cp == 'R');
+
+ /* "r" | "R" | "u" | "U" | "b" | "B" */
+ if (r_first || *cp == 'u' || *cp == 'U' || *cp == 'b' || *cp == 'B')
+ {
+ unsigned int i = 1;
+
+ /* r_first -> "rb" | "rB" | "Rb" | "RB"
+ !r_first -> "ur" | "UR" | "Ur" | "uR" | "br" | "Br" | "bR" | "BR" */
+ if (( r_first && (cp[i] == 'b' || cp[i] == 'B')) ||
+ (!r_first && (cp[i] == 'r' || cp[i] == 'R')))
+ i++;
+
+ if (cp[i] == '\'' || cp[i] == '"')
+ {
+ match = 1;
+ cp += i;
+ }
+ }
}
if (match)
{
--------------
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