summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-12-11 11:17:31 +0200
committerEli Zaretskii <eliz@gnu.org>2015-12-11 11:17:31 +0200
commitcabe9044380df45c1d5d57243955b49de721861a (patch)
tree126cc068eceedef7451a1b2695b238167bb1d167 /lib-src
parent95b6e13c13e4de9cdd0c3659d4864b17bafd040e (diff)
downloademacs-cabe9044380df45c1d5d57243955b49de721861a.tar.gz
Improve and document Ruby support in 'etags'
* lib-src/etags.c (Ruby_suffixes): Add ".ruby". (Ruby_functions): Support "module" and overloaded operators. (Ruby_help): Mention "module". * test/etags/ruby-src/test.rb: * test/etags/ruby-src/test1.ruby: New files. * test/etags/Makefile (RBSRC): New tests. (SRCS): Add ${RBSRC}. * 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 the new Ruby tests. * doc/man/etags.1: Mention Ruby support. * etc/NEWS: Mention Ruby support.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index c91cef40bfa..cd49f7199ba 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -724,10 +724,10 @@ static const char Python_help [] =
generate a tag.";
static const char *Ruby_suffixes [] =
- { "rb", NULL };
+ { "rb", "ruby", NULL };
static const char Ruby_help [] =
- "In Ruby code, 'def' or 'class' at the beginning of a line\n\
-generate a tag.";
+ "In Ruby code, 'def' or 'class' or 'module' at the beginning of\n\
+a line generate a tag.";
/* Can't do the `SCM' or `scm' prefix with a version number. */
static const char *Scheme_suffixes [] =
@@ -4552,15 +4552,19 @@ Ruby_functions (FILE *inf)
LOOP_ON_INPUT_LINES (inf, lb, cp)
{
cp = skip_spaces (cp);
- if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
+ if (LOOKING_AT (cp, "def")
+ || LOOKING_AT (cp, "class")
+ || LOOKING_AT (cp, "module"))
{
char *name = cp;
- while (!notinname (*cp))
+ /* Ruby method names can end in a '='. Also, operator overloading can
+ define operators whose names include '='. */
+ while (!notinname (*cp) || *cp == '=')
cp++;
- make_tag(name, cp -name, true,
- lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
+ make_tag (name, cp - name, true,
+ lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
}
}