diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-01-11 18:35:12 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-01-11 18:35:12 +0200 |
commit | 7ba75b96373024f1f6c9b249f2337d7a58e8094c (patch) | |
tree | 3d36198f38c8bcc79b5a8d79cf7d1cc450d6c057 /lib-src | |
parent | 1f7f03742de79b143efdbc8c005c31adfe0600db (diff) | |
download | emacs-7ba75b96373024f1f6c9b249f2337d7a58e8094c.tar.gz |
Teach etags new interpreters for some languages
* lib-src/etags.c (Erlang_interpreters, Lua_interpreters)
(Prolog_interpreters, Python_interpreters, Ruby_interpreters): New
static variables.
(lang_names): Use them to set interpreters for Erlang, Lua,
Prolog, Python, and Ruby.
(find_entries): Support "/usr/bin/env FOO" form of specifying an
interpreter.
* test/manual/etags/perl-src/htlmify-cystic: Modify the has-bang
line to test the "env FOO" interpreter spec. (Bug#30075)
* test/manual/etags/ETAGS.good_1:
* test/manual/etags/ETAGS.good_2:
* test/manual/etags/ETAGS.good_3:
* test/manual/etags/ETAGS.good_4:
* test/manual/etags/ETAGS.good_5:
* test/manual/etags/ETAGS.good_6: Adapt to latest changes in test
files.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/etags.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index eb6d31a6607..588921bc700 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -630,6 +630,8 @@ static const char *Erlang_suffixes [] = static const char Erlang_help [] = "In Erlang code, the tags are the functions, records and macros\n\ defined in the file."; +static const char *Erlang_interpreters [] = + { "escript", NULL }; const char *Forth_suffixes [] = { "fth", "tok", NULL }; @@ -666,6 +668,8 @@ static const char *Lua_suffixes [] = { "lua", "LUA", NULL }; static const char Lua_help [] = "In Lua scripts, all functions are tags."; +static const char *Lua_interpreters [] = + { "lua", NULL }; static const char *Makefile_filenames [] = { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; @@ -721,12 +725,16 @@ static const char *Prolog_suffixes [] = static const char Prolog_help [] = "In Prolog code, tags are predicates and rules at the beginning of\n\ line."; +static const char *Prolog_interpreters [] = + { "gprolog", "pl", "yap", "swipl", "prolog", NULL }; static const char *Python_suffixes [] = { "py", NULL }; static const char Python_help [] = "In Python code, 'def' or 'class' at the beginning of a line\n\ generate a tag."; +static const char *Python_interpreters [] = + { "python", NULL }; static const char *Ruby_suffixes [] = { "rb", "ru", "rbw", NULL }; @@ -735,6 +743,8 @@ static const char *Ruby_filenames [] = static const char Ruby_help [] = "In Ruby code, 'def' or 'class' or 'module' at the beginning of\n\ a line generate a tag. Constants also generate a tag."; +static const char *Ruby_interpreters [] = + { "ruby", NULL }; /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = @@ -798,14 +808,15 @@ static language lang_names [] = { "c++", Cplusplus_help, Cplusplus_entries, Cplusplus_suffixes }, { "c*", no_lang_help, Cstar_entries, Cstar_suffixes }, { "cobol", Cobol_help, Cobol_paragraphs, Cobol_suffixes }, - { "erlang", Erlang_help, Erlang_functions, Erlang_suffixes }, + { "erlang", Erlang_help, Erlang_functions, Erlang_suffixes, + NULL, Erlang_interpreters }, { "forth", Forth_help, Forth_words, Forth_suffixes }, { "fortran", Fortran_help, Fortran_functions, Fortran_suffixes }, { "go", Go_help, Go_functions, Go_suffixes }, { "html", HTML_help, HTML_labels, HTML_suffixes }, { "java", Cjava_help, Cjava_entries, Cjava_suffixes }, { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes }, - { "lua", Lua_help, Lua_functions, Lua_suffixes }, + { "lua", Lua_help,Lua_functions,Lua_suffixes,NULL,Lua_interpreters}, { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames}, { "objc", Objc_help, plain_C_entries, Objc_suffixes }, { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes }, @@ -813,9 +824,12 @@ static language lang_names [] = { "php", PHP_help, PHP_functions, PHP_suffixes }, { "postscript",PS_help, PS_functions, PS_suffixes }, { "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,Ruby_filenames }, + { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes, + NULL, Prolog_interpreters }, + { "python", Python_help, Python_functions, Python_suffixes, + NULL, Python_interpreters }, + { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes, + Ruby_filenames, Ruby_interpreters }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -1796,6 +1810,13 @@ find_entries (FILE *inf) else lp = skip_spaces (lb.buffer + 2); cp = skip_non_spaces (lp); + /* If the "interpreter" turns out to be "env", the real interpreter is + the next word. */ + if (cp > lp && strneq (lp, "env", cp - lp)) + { + lp = skip_spaces (cp); + cp = skip_non_spaces (lp); + } *cp = '\0'; if (strlen (lp) > 0) |