summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-02-06 11:08:20 +0200
committerEli Zaretskii <eliz@gnu.org>2016-02-06 11:08:20 +0200
commit87ae21858adc173c129ff8dfec8ce74cd82e77be (patch)
tree4f1bb96cf27a38ed387746d1bc6e5d6e5bfd3678
parentaa35257118a09ff8c90d5dc364e8dc65e2fbd6dd (diff)
downloademacs-87ae21858adc173c129ff8dfec8ce74cd82e77be.tar.gz
Extend etags Ruby support for accessors
* lib-src/etags.c (Ruby_functions): Support accessors defined with parentheses. (Bug#22563) * test/etags/ruby-src/test1.ru (A::B): Add tests for accessors defined with parentheses. * test/etags/ETAGS.good_1: * test/etags/ETAGS.good_2: * test/etags/ETAGS.good_3: * test/etags/ETAGS.good_4: * test/etags/ETAGS.good_5: * test/etags/ETAGS.good_6: * test/etags/CTAGS.good: Adapt to changes in Ruby tests.
-rw-r--r--lib-src/etags.c6
-rw-r--r--test/etags/CTAGS.good8
-rw-r--r--test/etags/ETAGS.good_112
-rw-r--r--test/etags/ETAGS.good_212
-rw-r--r--test/etags/ETAGS.good_312
-rw-r--r--test/etags/ETAGS.good_412
-rw-r--r--test/etags/ETAGS.good_512
-rw-r--r--test/etags/ETAGS.good_612
-rw-r--r--test/etags/ruby-src/test1.ru6
9 files changed, 64 insertions, 28 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 0f5bfa3a951..182cb4cc876 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -4730,8 +4730,12 @@ Ruby_functions (FILE *inf)
if (reader || writer || alias)
{
do {
- char *np = cp;
+ char *np;
+ cp = skip_spaces (cp);
+ if (*cp == '(')
+ cp = skip_spaces (cp + 1);
+ np = cp;
cp = skip_name (cp);
if (*np != ':')
continue;
diff --git a/test/etags/CTAGS.good b/test/etags/CTAGS.good
index 58b1db6b0a3..ebde715272a 100644
--- a/test/etags/CTAGS.good
+++ b/test/etags/CTAGS.good
@@ -454,7 +454,7 @@ Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is privat
Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is$/
Configure pyt-src/server.py /^class Configure(Frame, ControlEdit):$/
ConfirmQuit pyt-src/server.py /^def ConfirmQuit(frame, context):$/
-Constant ruby-src/test1.ru 38
+Constant ruby-src/test1.ru 42
ControlEdit pyt-src/server.py /^class ControlEdit(Frame):$/
Controls pyt-src/server.py /^class Controls:$/
CopyTextString pas-src/common.pas /^function CopyTextString;(*($/
@@ -2555,6 +2555,7 @@ bar c-src/c.c /^void bar() {while(0) {}}$/
bar c.c 143
bar c-src/h.h 19
bar cp-src/x.cc /^XX::bar()$/
+bar1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
bar= ruby-src/test1.ru /^ attr_writer :bar,$/
bas_syn prol-src/natded.prolog /^bas_syn(n(_)).$/
base c-src/emacs/src/lisp.h 2188
@@ -3008,6 +3009,8 @@ foo f-src/entry.strange /^ character*(*) function foo()$/
foo php-src/ptest.php /^foo()$/
foo ruby-src/test1.ru /^ attr_reader :foo$/
foo! ruby-src/test1.ru /^ def foo!$/
+foo1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
+foo2 ruby-src/test1.ru /^ alias_method ( :foo2, #cmmt$/
foobar c-src/c.c /^int foobar() {;}$/
foobar c.c /^extern void foobar (void) __attribute__ ((section /
foobar2 c-src/h.h 20
@@ -3880,7 +3883,8 @@ questo ../c/c.web 34
quiettest make-src/Makefile /^quiettest:$/
quit_char c-src/emacs/src/keyboard.c 192
quit_throw_to_read_char c-src/emacs/src/keyboard.c /^quit_throw_to_read_char (bool from_signal)$/
-qux ruby-src/test1.ru /^ alias_method :qux, :tee, attr_accessor :bogus$/
+qux ruby-src/test1.ru /^ alias_method :qux, :tee, attr_accessor(:bogus)/
+qux1 ruby-src/test1.ru /^ :qux1)$/
qux= ruby-src/test1.ru /^ def qux=(tee)$/
r0 c-src/sysdep.h 54
r1 c-src/sysdep.h 55
diff --git a/test/etags/ETAGS.good_1 b/test/etags/ETAGS.good_1
index 90bbe774f05..d2550863428 100644
--- a/test/etags/ETAGS.good_1
+++ b/test/etags/ETAGS.good_1
@@ -3061,7 +3061,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -3084,9 +3084,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ETAGS.good_2 b/test/etags/ETAGS.good_2
index d774bb1b190..9eb1d4297c8 100644
--- a/test/etags/ETAGS.good_2
+++ b/test/etags/ETAGS.good_2
@@ -3631,7 +3631,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -3654,9 +3654,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ETAGS.good_3 b/test/etags/ETAGS.good_3
index e3855a59309..1f5a34272e3 100644
--- a/test/etags/ETAGS.good_3
+++ b/test/etags/ETAGS.good_3
@@ -3408,7 +3408,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -3431,9 +3431,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ETAGS.good_4 b/test/etags/ETAGS.good_4
index dbae59bd59e..b8a3d9de6db 100644
--- a/test/etags/ETAGS.good_4
+++ b/test/etags/ETAGS.good_4
@@ -3225,7 +3225,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -3248,9 +3248,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ETAGS.good_5 b/test/etags/ETAGS.good_5
index 9ea77977ab6..9e3b258eabc 100644
--- a/test/etags/ETAGS.good_5
+++ b/test/etags/ETAGS.good_5
@@ -4142,7 +4142,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -4165,9 +4165,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ETAGS.good_6 b/test/etags/ETAGS.good_6
index 7420a41b108..f5e0ad4407f 100644
--- a/test/etags/ETAGS.good_6
+++ b/test/etags/ETAGS.good_6
@@ -4142,7 +4142,7 @@ module ModuleExample1,0
def module_instance_method46,1051
def ModuleExample.module_class_methodmodule_class_method49,1131
-ruby-src/test1.ru,785
+ruby-src/test1.ru,935
class A1,0
def a(2,8
def b(5,38
@@ -4165,9 +4165,13 @@ module A9,57
attr_accessor :teetee31,382
attr_accessor :teetee=31,382
alias_method :qux,qux32,405
- alias_method :xyz,xyz33,455
- :tee ; attr_reader :subtlesubtle34,478
-A::Constant Constant38,533
+ alias_method :xyz,xyz33,456
+ :tee ; attr_reader :subtlesubtle34,479
+ attr_reader(:foo1,foo135,523
+ attr_reader(:foo1, :bar1,bar135,523
+ :qux1)qux136,563
+ alias_method ( :foo2,foo237,586
+A::Constant Constant42,655
tex-src/testenv.tex,52
\newcommand{\nm}\nm4,77
diff --git a/test/etags/ruby-src/test1.ru b/test/etags/ruby-src/test1.ru
index 93888c1040b..eafaec6248b 100644
--- a/test/etags/ruby-src/test1.ru
+++ b/test/etags/ruby-src/test1.ru
@@ -29,9 +29,13 @@ module A
:baz,
:more
attr_accessor :tee
- alias_method :qux, :tee, attr_accessor :bogus
+ alias_method :qux, :tee, attr_accessor(:bogus)
alias_method :xyz,
:tee ; attr_reader :subtle
+ attr_reader(:foo1, :bar1, # comment
+ :qux1)
+ alias_method ( :foo2, #cmmt
+ :bar2)
end
end