diff options
| author | Eli Zaretskii | 2015-12-11 11:17:31 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-11 11:17:31 +0200 |
| commit | cabe9044380df45c1d5d57243955b49de721861a (patch) | |
| tree | 126cc068eceedef7451a1b2695b238167bb1d167 /lib-src | |
| parent | 95b6e13c13e4de9cdd0c3659d4864b17bafd040e (diff) | |
| download | emacs-cabe9044380df45c1d5d57243955b49de721861a.tar.gz emacs-cabe9044380df45c1d5d57243955b49de721861a.zip | |
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.c | 18 |
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 [] = | |||
| 724 | generate a tag."; | 724 | generate a tag."; |
| 725 | 725 | ||
| 726 | static const char *Ruby_suffixes [] = | 726 | static const char *Ruby_suffixes [] = |
| 727 | { "rb", NULL }; | 727 | { "rb", "ruby", NULL }; |
| 728 | static const char Ruby_help [] = | 728 | static const char Ruby_help [] = |
| 729 | "In Ruby code, 'def' or 'class' at the beginning of a line\n\ | 729 | "In Ruby code, 'def' or 'class' or 'module' at the beginning of\n\ |
| 730 | generate a tag."; | 730 | a line generate a tag."; |
| 731 | 731 | ||
| 732 | /* Can't do the `SCM' or `scm' prefix with a version number. */ | 732 | /* Can't do the `SCM' or `scm' prefix with a version number. */ |
| 733 | static const char *Scheme_suffixes [] = | 733 | static const char *Scheme_suffixes [] = |
| @@ -4552,15 +4552,19 @@ Ruby_functions (FILE *inf) | |||
| 4552 | LOOP_ON_INPUT_LINES (inf, lb, cp) | 4552 | LOOP_ON_INPUT_LINES (inf, lb, cp) |
| 4553 | { | 4553 | { |
| 4554 | cp = skip_spaces (cp); | 4554 | cp = skip_spaces (cp); |
| 4555 | if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) | 4555 | if (LOOKING_AT (cp, "def") |
| 4556 | || LOOKING_AT (cp, "class") | ||
| 4557 | || LOOKING_AT (cp, "module")) | ||
| 4556 | { | 4558 | { |
| 4557 | char *name = cp; | 4559 | char *name = cp; |
| 4558 | 4560 | ||
| 4559 | while (!notinname (*cp)) | 4561 | /* Ruby method names can end in a '='. Also, operator overloading can |
| 4562 | define operators whose names include '='. */ | ||
| 4563 | while (!notinname (*cp) || *cp == '=') | ||
| 4560 | cp++; | 4564 | cp++; |
| 4561 | 4565 | ||
| 4562 | make_tag(name, cp -name, true, | 4566 | make_tag (name, cp - name, true, |
| 4563 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); | 4567 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
| 4564 | } | 4568 | } |
| 4565 | } | 4569 | } |
| 4566 | } | 4570 | } |