Fixed bug #1906062: Triple single-quoted strings were not skipped when parsing for tags.
git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@646 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
parent
cdbef108ff
commit
259d907009
3
NEWS
3
NEWS
|
@ -4,6 +4,9 @@ ctags-@VERSION@ (@DATE@)
|
|||
* Added regex support when compiling with MinGW. Gnu regex module now included in all distributions.
|
||||
* Added support for class and member variables [PHP, Bug #1037086]
|
||||
* Fixed parsing of global scope qualifiers in base class lists. [C++, Bug #1799343].
|
||||
* Fixed bug with detecting identifiers inside variables. [Python, Bug #1809024].
|
||||
* Fixed bug with detecting identifiers at the start of variables. [Python, Bug #1856363].
|
||||
* Fixed parsing of triple single-quoted multi-line strings. [Python, Bug #1906062].
|
||||
|
||||
ctags-5.7 (04 Sep 2007)
|
||||
* Added support for DIM AS [Freebasic, Bug #1741778].
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
def detach (self):
|
||||
|
||||
model = self.view.props.model
|
||||
sort_id, sort_order = tree_sortable_get_sort_column_id (model)
|
||||
if sort_id >= 0:
|
||||
self.app.state.sort_column = self.find_item_class (id = sort_id)
|
||||
if sort_order == gtk.SORT_ASCENDING:
|
||||
self.app.state.sort_order = "ascending"
|
||||
else:
|
||||
self.app.state.sort_order = "descending"
|
|
@ -0,0 +1,4 @@
|
|||
include_file = '''
|
||||
class (b)
|
||||
'''
|
||||
|
|
@ -26,8 +26,11 @@ class one:
|
|||
def public_function(self, key):
|
||||
class this_is_ignored:
|
||||
|
||||
def _pack(self, i, s):
|
||||
|
||||
def _pack(self, i, s): '''this is''' """a""" '''string
|
||||
literal'''"""
|
||||
class inside_string:
|
||||
"""
|
||||
|
||||
class so_is_this:
|
||||
|
||||
def _test(test, code, outcome, exception):
|
||||
|
|
58
python.c
58
python.c
|
@ -52,6 +52,9 @@ struct NestingLevels
|
|||
int allocated;
|
||||
};
|
||||
|
||||
static char const * const singletriple = "'''";
|
||||
static char const * const doubletriple = "\"\"\"";
|
||||
|
||||
/*
|
||||
* FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
@ -336,6 +339,39 @@ static void addNestingLevel(NestingLevels *nls, int indentation,
|
|||
nl->is_class = is_class;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
char *s;
|
||||
if ((s = strstr (string, doubletriple)))
|
||||
*which = doubletriple;
|
||||
else if ((s = strstr (string, singletriple)))
|
||||
*which = singletriple;
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Find the end of a triple string as pointed to by "which", and update "which"
|
||||
* with any other triple strings following in the given string.
|
||||
*/
|
||||
static void find_triple_end(char const *string, char const **which)
|
||||
{
|
||||
char const *s = string;
|
||||
while (1)
|
||||
{
|
||||
/* Check if the sting ends in the same line. */
|
||||
s = strstr (string, *which);
|
||||
if (!s) break;
|
||||
s += 3;
|
||||
*which = NULL;
|
||||
/* If yes, check if another one starts in the same line. */
|
||||
s = find_triple_start(s, which);
|
||||
if (!s) break;
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
|
||||
static void findPythonTags (void)
|
||||
{
|
||||
vString *const continuation = vStringNew ();
|
||||
|
@ -346,7 +382,7 @@ static void findPythonTags (void)
|
|||
|
||||
const char *line;
|
||||
int line_skip = 0;
|
||||
boolean longStringLiteral = FALSE;
|
||||
char const *longStringLiteral = NULL;
|
||||
|
||||
while ((line = (const char *) fileReadLine ()) != NULL)
|
||||
{
|
||||
|
@ -379,28 +415,22 @@ static void findPythonTags (void)
|
|||
/* Deal with multiline string ending. */
|
||||
if (longStringLiteral)
|
||||
{
|
||||
/* Note: We do ignore anything in the same line after a multiline
|
||||
* string for now.
|
||||
*/
|
||||
if (strstr (cp, "\"\"\""))
|
||||
longStringLiteral = FALSE;
|
||||
find_triple_end(cp, &longStringLiteral);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Deal with multiline string start. */
|
||||
if ((longstring = strstr (cp, "\"\"\"")) != NULL)
|
||||
longstring = find_triple_start(cp, &longStringLiteral);
|
||||
if (longstring)
|
||||
{
|
||||
/* Note: For our purposes, the line just ends at the first long
|
||||
* string.
|
||||
* string. I.e. we don't parse for any tags in the rest of the
|
||||
* line, but we do look for the string ending of course.
|
||||
*/
|
||||
*longstring = '\0';
|
||||
|
||||
longstring += 3;
|
||||
longStringLiteral = TRUE;
|
||||
while ((longstring = strstr (longstring, "\"\"\"")) != NULL)
|
||||
{
|
||||
longstring += 3;
|
||||
longStringLiteral = !longStringLiteral;
|
||||
}
|
||||
find_triple_end(longstring, &longStringLiteral);
|
||||
}
|
||||
|
||||
/* Deal with def and class keywords. */
|
||||
|
|
Loading…
Reference in New Issue