[geany/geany] e9e9b9: ruby: handle singleton method including ?!= in its name(sf.bug:364)

Masatake YAMATO git-noreply at xxxxx
Mon Mar 14 18:27:22 UTC 2016


Branch:      refs/heads/master
Author:      Masatake YAMATO <yamato at redhat.com>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 14 Mar 2016 18:27:22 UTC
Commit:      e9e9b9988d889a06bc01d1a99fb6620e7d4fa115
             https://github.com/geany/geany/commit/e9e9b9988d889a06bc01d1a99fb6620e7d4fa115

Log Message:
-----------
ruby: handle singleton method including ?!= in its name(sf.bug:364)

This patch is intended a bug reported as sf.bug:364.
https://sourceforge.net/p/ctags/bugs/364/

Writing a test case is helped by Dmitry Gutov.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>


Modified Paths:
--------------
    tagmanager/ctags/ruby.c
    tests/ctags/Makefile.am
    tests/ctags/ruby-sf-bug-364.rb
    tests/ctags/ruby-sf-bug-364.rb.tags

Modified: tagmanager/ctags/ruby.c
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -194,6 +194,10 @@ static rubyKind parseIdentifier (
 	{
 		also_ok = "_.?!=";
 	}
+	else if (kind == K_SINGLETON)
+	{
+		also_ok = "_?!=";
+	}
 	else if (kind == K_DESCRIBE || kind == K_CONTEXT)
 	{
 		also_ok = " ,\".#_?!='/-";
@@ -237,7 +241,10 @@ static rubyKind parseIdentifier (
 				vStringClear (name);
 				return parseIdentifier (cp, name, K_SINGLETON);
 			}
+		}
 
+		if (kind == K_METHOD || kind == K_SINGLETON)
+		{
 			/* Recognize characters which mark the end of a method name. */
 			if (charIsIn (last_char, "?!="))
 			{


Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -255,6 +255,7 @@ test_sources = \
 	regexp.js						\
 	return-hint.zep					\
 	return-types.go					\
+	ruby-sf-bug-364.rb				\
 	rules.t2t						\
 	sample.t2t						\
 	secondary_fcn_name.js			\


Modified: tests/ctags/ruby-sf-bug-364.rb
16 lines changed, 16 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,16 @@
+class D
+  def self.x?
+  end
+  def self.y!
+  end
+  def self.z=(a)
+  end
+  def self._a?
+  end
+  def self._b!
+  end
+  def self._c=(a)
+  end
+end
+D._c=1
+D.z=1


Modified: tests/ctags/ruby-sf-bug-364.rb.tags
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,8 @@
+# format=tagmanager
+D�1�0
+_a?�64�D�0
+_b!�64�D�0
+_c=�64�D�0
+x?�64�D�0
+y!�64�D�0
+z=�64�D�0



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list