aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorXi Lu2015-12-11 10:52:08 +0200
committerEli Zaretskii2015-12-11 10:52:08 +0200
commit95b6e13c13e4de9cdd0c3659d4864b17bafd040e (patch)
tree31fdfa3a17bb9f52ff8e6c1932444e67c2894333 /lib-src
parent1db9d8bd0fb41bda3cc8027ec0cf27aade71b400 (diff)
downloademacs-95b6e13c13e4de9cdd0c3659d4864b17bafd040e.tar.gz
emacs-95b6e13c13e4de9cdd0c3659d4864b17bafd040e.zip
Initial support for Ruby in 'etags'
* lib-src/etags.c <Ruby_suffixes>: New variable. (lang_names): Add an entry for Ruby. (Ruby_functions): New function. (Bug#22116)
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 5f985b027b2..c91cef40bfa 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -364,6 +364,7 @@ static void PHP_functions (FILE *);
364static void PS_functions (FILE *); 364static void PS_functions (FILE *);
365static void Prolog_functions (FILE *); 365static void Prolog_functions (FILE *);
366static void Python_functions (FILE *); 366static void Python_functions (FILE *);
367static void Ruby_functions (FILE *);
367static void Scheme_functions (FILE *); 368static void Scheme_functions (FILE *);
368static void TeX_commands (FILE *); 369static void TeX_commands (FILE *);
369static void Texinfo_nodes (FILE *); 370static void Texinfo_nodes (FILE *);
@@ -722,6 +723,12 @@ static const char Python_help [] =
722"In Python code, 'def' or 'class' at the beginning of a line\n\ 723"In Python code, 'def' or 'class' at the beginning of a line\n\
723generate a tag."; 724generate a tag.";
724 725
726static const char *Ruby_suffixes [] =
727 { "rb", NULL };
728static const char Ruby_help [] =
729 "In Ruby code, 'def' or 'class' at the beginning of a line\n\
730generate a tag.";
731
725/* 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. */
726static const char *Scheme_suffixes [] = 733static const char *Scheme_suffixes [] =
727 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; 734 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
@@ -800,6 +807,7 @@ static language lang_names [] =
800 { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, 807 { "proc", no_lang_help, plain_C_entries, plain_C_suffixes },
801 { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, 808 { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes },
802 { "python", Python_help, Python_functions, Python_suffixes }, 809 { "python", Python_help, Python_functions, Python_suffixes },
810 { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes },
803 { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, 811 { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes },
804 { "tex", TeX_help, TeX_commands, TeX_suffixes }, 812 { "tex", TeX_help, TeX_commands, TeX_suffixes },
805 { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, 813 { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes },
@@ -4532,6 +4540,31 @@ Python_functions (FILE *inf)
4532 } 4540 }
4533} 4541}
4534 4542
4543/*
4544 * Ruby support
4545 * Original code by Xi Lu <lx@shellcodes.org> (2015)
4546 */
4547static void
4548Ruby_functions (FILE *inf)
4549{
4550 char *cp = NULL;
4551
4552 LOOP_ON_INPUT_LINES (inf, lb, cp)
4553 {
4554 cp = skip_spaces (cp);
4555 if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
4556 {
4557 char *name = cp;
4558
4559 while (!notinname (*cp))
4560 cp++;
4561
4562 make_tag(name, cp -name, true,
4563 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4564 }
4565 }
4566}
4567
4535 4568
4536/* 4569/*
4537 * PHP support 4570 * PHP support