Permalink
Browse files

trunk/ruby.c: simple-minded (but reasonably effective) skipping of st…

…ring literals, so we don't accidentally recognize "keywords" inside string literals.

trunk/Test/bug1742588.rb: test case.

trunk/NEWS: news item.
  • Loading branch information...
1 parent e2caf2d commit d48f9ff90c45f0798e6d3418459ccdcccb8c219d Elliott Hughes committed Jun 24, 2007
Showing with 18 additions and 1 deletion.
  1. +1 −0 NEWS
  2. +7 −0 Test/bug1742588.rb
  3. +10 −1 ruby.c
View
1 NEWS
@@ -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].
View
@@ -0,0 +1,7 @@
+class A
+ def a()
+ super(" do ")
+ end
+ def b()
+ end
+end
View
11 ruby.c
@@ -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

0 comments on commit d48f9ff

Please sign in to comment.