From 690ccf0f0d9c609b809ff3d10475f259748e4773 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Nov 2015 12:29:18 +0200 Subject: Fix Lua tags when a function name includes '.' or ':' * lib-src/etags.c (Lua_functions): Add a tag for the last element of a function name after a dot or a colon. (Bug#21934) --- lib-src/etags.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib-src') diff --git a/lib-src/etags.c b/lib-src/etags.c index 8b980d365ef..5f985b027b2 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -4954,7 +4954,22 @@ Lua_functions (FILE *inf) (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ if (LOOKING_AT (bp, "function")) - get_tag (bp, NULL); + { + char *tag_name, *tp_dot, *tp_colon; + + get_tag (bp, &tag_name); + /* If the tag ends with ".foo" or ":foo", make an additional tag for + "foo". */ + tp_dot = strrchr (tag_name, '.'); + tp_colon = strrchr (tag_name, ':'); + if (tp_dot || tp_colon) + { + char *p = tp_dot > tp_colon ? tp_dot : tp_colon; + int len_add = p - tag_name + 1; + + get_tag (bp + len_add, NULL); + } + } } } -- cgit v1.2.1 From 95b6e13c13e4de9cdd0c3659d4864b17bafd040e Mon Sep 17 00:00:00 2001 From: Xi Lu Date: Fri, 11 Dec 2015 10:52:08 +0200 Subject: Initial support for Ruby in 'etags' * lib-src/etags.c : New variable. (lang_names): Add an entry for Ruby. (Ruby_functions): New function. (Bug#22116) --- lib-src/etags.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'lib-src') 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 *); static void PS_functions (FILE *); static void Prolog_functions (FILE *); static void Python_functions (FILE *); +static void Ruby_functions (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -722,6 +723,12 @@ static const char Python_help [] = "In Python code, 'def' or 'class' at the beginning of a line\n\ generate a tag."; +static const char *Ruby_suffixes [] = + { "rb", NULL }; +static const char Ruby_help [] = + "In Ruby code, 'def' or 'class' at the beginning of a line\n\ +generate a tag."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -800,6 +807,7 @@ static language lang_names [] = { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, { "python", Python_help, Python_functions, Python_suffixes }, + { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -4532,6 +4540,31 @@ Python_functions (FILE *inf) } } +/* + * Ruby support + * Original code by Xi Lu (2015) + */ +static void +Ruby_functions (FILE *inf) +{ + char *cp = NULL; + + LOOP_ON_INPUT_LINES (inf, lb, cp) + { + cp = skip_spaces (cp); + if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) + { + char *name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag(name, cp -name, true, + lb.buffer, cp - lb.buffer + 1, lineno, linecharno); + } + } +} + /* * PHP support -- cgit v1.2.1 From cabe9044380df45c1d5d57243955b49de721861a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 11 Dec 2015 11:17:31 +0200 Subject: 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. --- lib-src/etags.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib-src') 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); } } } -- cgit v1.2.1 From 3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 11 Dec 2015 12:07:26 +0200 Subject: Improve Lua support in etags * lib-src/etags.c (Lua_functions): Skip spaces before looking for "function". * etc/NEWS: Mention improved Lua support by 'etags'. * test/etags/lua-src/test.lua (test): Add tests for indented function definitions. * 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 modified Lua tests. --- lib-src/etags.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib-src') diff --git a/lib-src/etags.c b/lib-src/etags.c index cd49f7199ba..3cb39689b8d 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -4985,6 +4985,7 @@ Lua_functions (FILE *inf) LOOP_ON_INPUT_LINES (inf, lb, bp) { + bp = skip_spaces (bp); if (bp[0] != 'f' && bp[0] != 'l') continue; -- cgit v1.2.1 From 7d7e742fe358f300019c50568d05e58543e0f898 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Dec 2015 17:10:50 -0800 Subject: Remove SunOS 4.x cruft Support for SunOS 4.x was removed in Emacs 23 but some cruft was left behind. * lib-src/pop.c [sun]: Remove no-longer-needed include. * lwlib/xlwmenu.c (SUNSO41): Remove. --- lib-src/pop.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib-src') diff --git a/lib-src/pop.c b/lib-src/pop.c index c6deaf73a2c..42d302026ff 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -42,10 +42,6 @@ along with GNU Emacs. If not, see . */ #endif #include -#ifdef sun -#include -#endif /* sun */ - #ifdef HESIOD #include /* -- cgit v1.2.1