trunk/ruby.c: simple-minded (but reasonably effective) skipping of string literals, so we don't accidentally recognize "keywords" inside string literals.

trunk/Test/bug1742588.rb: test case.

trunk/NEWS: news item.


git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@571 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
elliotth 2007-06-24 23:32:14 +00:00
parent 5aa0f741e5
commit 2c8f83e362
3 changed files with 18 additions and 1 deletions

1
NEWS
View File

@ -29,6 +29,7 @@ ctags-NEXT (Mon June 6 2007)
* Fixed typo in man page [Debian bug #366412].
* Fixed missing chunk of text in man page and over-use of hyphens in UTF-8 locales [Debian bug #271323].
* Fixed parsing of ` as a method name [Ruby].
* Fixed parsing of keywords in string literals [Ruby, Bug #1742588].
* Fixed potential segmentation violation [Bug #1672834, Bug #1222926].
* Fixed parsing of destructors with whitespace after the '~' [C++, Bug #1585745].
* Fixed default access of unions to be public [C++, Bug #1548443].

7
Test/bug1742588.rb Normal file
View File

@ -0,0 +1,7 @@
class A
def a()
super(" do ")
end
def b()
end
end

11
ruby.c
View File

@ -346,7 +346,7 @@ static void findRubyTags (void)
while (*cp != '\0')
{
/* FIXME: we don't cope with here documents, or string literals,
/* FIXME: we don't cope with here documents,
* or regular expression literals, or ... you get the idea.
* Hopefully, the restriction above that insists on seeing
* definitions at the starts of lines should keep us out of
@ -374,6 +374,15 @@ static void findRubyTags (void)
vStringDelete (stringListLast (nesting));
stringListRemoveLast (nesting);
}
else if (*cp == '"')
{
/* Skip string literals.
* FIXME: should cope with escapes and interpolation.
*/
do {
++cp;
} while (*cp != 0 && *cp != '"');
}
else if (*cp != '\0')
{
do