Use proper quoted multi-line string check from CTags SVN.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2679 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
361a64c3fd
commit
95c9b0e751
@ -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>
|
2008-06-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||||
|
|
||||||
* src/utils.c:
|
* src/utils.c:
|
||||||
|
|||||||
@ -306,7 +306,9 @@ static boolean constructParentString(NestingLevels *nls, int indent,
|
|||||||
return is_class;
|
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)
|
static void checkParent(NestingLevels *nls, int indent, vString *parent)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -320,7 +322,7 @@ static void checkParent(NestingLevels *nls, int indent, vString *parent)
|
|||||||
{
|
{
|
||||||
if (n && indent <= n->indentation)
|
if (n && indent <= n->indentation)
|
||||||
{
|
{
|
||||||
/* invalidate this level by clearing its name */
|
/* remove this level by clearing its name */
|
||||||
vStringClear(n->name);
|
vStringClear(n->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -376,42 +378,32 @@ static void addNestingLevel(NestingLevels *nls, int indentation,
|
|||||||
nl->is_class = is_class;
|
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
|
/* 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.
|
* 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;
|
char const *cp = string;
|
||||||
*which = NULL;
|
|
||||||
if ((s = strstr (string, doubletriple)))
|
|
||||||
{
|
|
||||||
/* prevent parsing quoted triple strings */
|
|
||||||
if (isTripleQuoted (string, s, '\''))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
|
for (; *cp; cp++)
|
||||||
|
{
|
||||||
|
if (*cp == '"' || *cp == '\'')
|
||||||
|
{
|
||||||
|
if (strcmp(cp, doubletriple) == 0)
|
||||||
|
{
|
||||||
*which = doubletriple;
|
*which = doubletriple;
|
||||||
|
return cp;
|
||||||
}
|
}
|
||||||
else if ((s = strstr (string, singletriple)))
|
if (strcmp(cp, singletriple) == 0)
|
||||||
{
|
{
|
||||||
/* prevent parsing quoted triple strings */
|
|
||||||
if (isTripleQuoted (string, s, '"'))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
*which = singletriple;
|
*which = singletriple;
|
||||||
|
return cp;
|
||||||
}
|
}
|
||||||
return s;
|
cp = skipString(cp);
|
||||||
|
if (!*cp) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the end of a triple string as pointed to by "which", and update "which"
|
/* Find the end of a triple string as pointed to by "which", and update "which"
|
||||||
@ -422,7 +414,7 @@ static void find_triple_end(char const *string, char const **which)
|
|||||||
char const *s = string;
|
char const *s = string;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Check if the sting ends in the same line. */
|
/* Check if the string ends in the same line. */
|
||||||
s = strstr (s, *which);
|
s = strstr (s, *which);
|
||||||
if (!s) break;
|
if (!s) break;
|
||||||
s += 3;
|
s += 3;
|
||||||
@ -497,7 +489,7 @@ static void findPythonTags (void)
|
|||||||
if (*cp == '\0') /* skip blank line */
|
if (*cp == '\0') /* skip blank line */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* skip comment if we are not inside a triple string */
|
/* Skip comment if we are not inside a multi-line string */
|
||||||
if (*cp == '#' && !longStringLiteral)
|
if (*cp == '#' && !longStringLiteral)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user