SF.net SVN: geany: [2679] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Jun 11 16:37:52 UTC 2008


Revision: 2679
          http://geany.svn.sourceforge.net/geany/?rev=2679&view=rev
Author:   eht16
Date:     2008-06-11 09:37:18 -0700 (Wed, 11 Jun 2008)

Log Message:
-----------
Use proper quoted multi-line string check from CTags SVN.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tagmanager/python.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-06-10 16:44:00 UTC (rev 2678)
+++ trunk/ChangeLog	2008-06-11 16:37:18 UTC (rev 2679)
@@ -1,3 +1,9 @@
+2008-06-11  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * tagmanager/python.c:
+   Use proper quoted multi-line string check from CTags SVN.
+
+
 2008-06-10  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/utils.c:

Modified: trunk/tagmanager/python.c
===================================================================
--- trunk/tagmanager/python.c	2008-06-10 16:44:00 UTC (rev 2678)
+++ trunk/tagmanager/python.c	2008-06-11 16:37:18 UTC (rev 2679)
@@ -306,7 +306,9 @@
 	return is_class;
 }
 
-/* check whether parent's indentation level is higher than the current level and if so, remove it */
+/* Check whether parent's indentation level is higher than the current level and
+ * if so, remove it.
+ */
 static void checkParent(NestingLevels *nls, int indent, vString *parent)
 {
 	int i;
@@ -320,7 +322,7 @@
 		{
 			if (n && indent <= n->indentation)
 			{
-				/* invalidate this level by clearing its name */
+				/* remove this level by clearing its name */
 				vStringClear(n->name);
 			}
 			break;
@@ -376,42 +378,32 @@
 	nl->is_class = is_class;
 }
 
-/* Checks whether a triple string was quoted before.
- */
-static boolean isTripleQuoted(char const *start, char const *end, char quote_char)
-{
-    char const *cp = start;
-
-	while (cp < end && *cp != quote_char)
-		cp++;
-
-	return (cp < end);
-}
-
 /* Return a pointer to the start of the next triple string, or NULL. Store
  * the kind of triple string in "which" if the return is not NULL.
  */
-static char *find_triple_start(char const *string, char const **which)
+static char const *find_triple_start(char const *string, char const **which)
 {
-    char *s;
-    *which = NULL;
-    if ((s = strstr (string, doubletriple)))
-    {
-		/* prevent parsing quoted triple strings */
-        if (isTripleQuoted (string, s, '\''))
-			return NULL;
+    char const *cp = string;
 
-		*which = doubletriple;
-    }
-    else if ((s = strstr (string, singletriple)))
-    {
-		/* prevent parsing quoted triple strings */
-        if (isTripleQuoted (string, s, '"'))
-			return NULL;
-
-        *which = singletriple;
-    }
-    return s;
+    for (; *cp; cp++)
+	{
+	    if (*cp == '"' || *cp == '\'')
+		{
+		    if (strcmp(cp, doubletriple) == 0)
+		    {
+		        *which = doubletriple;
+		        return cp;
+		    }
+		    if (strcmp(cp, singletriple) == 0)
+		    {
+		        *which = singletriple;
+		        return cp;
+		    }
+			cp = skipString(cp);
+			if (!*cp) break;
+		}
+	}
+    return NULL;
 }
 
 /* Find the end of a triple string as pointed to by "which", and update "which"
@@ -422,7 +414,7 @@
     char const *s = string;
     while (1)
 	{
-	    /* Check if the sting ends in the same line. */
+	    /* Check if the string ends in the same line. */
 	    s = strstr (s, *which);
 		if (!s) break;
 		s += 3;
@@ -497,8 +489,8 @@
 		if (*cp == '\0')  /* skip blank line */
 			continue;
 
-		/* skip comment if we are not inside a triple string */
-		if (*cp == '#' && ! longStringLiteral)
+		/* Skip comment if we are not inside a multi-line string */
+		if (*cp == '#' && !longStringLiteral)
 			continue;
 
 		/* Deal with line continuation. */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list