From: Eli Zaretskii Date: Fri, 11 Dec 2015 10:07:26 +0000 (+0200) Subject: Improve Lua support in etags X-Git-Tag: emacs-25.0.90~496 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52;p=emacs.git 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. --- diff --git a/etc/NEWS b/etc/NEWS index 0c9296acab4..c6b3374ded8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1466,6 +1466,11 @@ qualified names by hand. Names of modules, classes, methods, and functions are tagged. Overloaded operators are also tagged. +*** Improved support for Lua + +Etags now tags functions even if the "function" keyword follows some +whitespace at line beginning. + * Changes in Emacs 25.1 on Non-Free Operating Systems 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; diff --git a/test/etags/CTAGS.good b/test/etags/CTAGS.good index 3186ff667e2..245f6703adf 100644 --- a/test/etags/CTAGS.good +++ b/test/etags/CTAGS.good @@ -3425,6 +3425,8 @@ mcCSC cp-src/c.C 6 mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/ mcheck_status c-src/emacs/src/gmalloc.c 283 mcheck_used c-src/emacs/src/gmalloc.c 2012 +me22b lua-src/test.lua /^ local function test.me22b (one)$/ +me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/ memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/ member prol-src/natded.prolog /^member(X,[X|_]).$/ memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/ @@ -4209,6 +4211,8 @@ test c-src/emacs/src/lisp.h 1871 test cp-src/c.C 86 test erl-src/gs_dialog.erl /^test() ->$/ test php-src/ptest.php /^test $/ +test.me22b lua-src/test.lua /^ local function test.me22b (one)$/ +test.me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/ test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/ texttreelist prol-src/natded.prolog /^texttreelist([]).$/ this c-src/a/b/b.c 1 diff --git a/test/etags/ETAGS.good_1 b/test/etags/ETAGS.good_1 index 1c4664d47a8..2ae4ec41256 100644 --- a/test/etags/ETAGS.good_1 +++ b/test/etags/ETAGS.good_1 @@ -2336,7 +2336,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -2345,6 +2345,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1133 LATEST=1,0 diff --git a/test/etags/ETAGS.good_2 b/test/etags/ETAGS.good_2 index 5f82e8c6b1c..3ec5b21d384 100644 --- a/test/etags/ETAGS.good_2 +++ b/test/etags/ETAGS.good_2 @@ -2905,7 +2905,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -2914,6 +2914,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1156 LATEST=1,0 diff --git a/test/etags/ETAGS.good_3 b/test/etags/ETAGS.good_3 index 8ab9dc37482..43b84eed5d2 100644 --- a/test/etags/ETAGS.good_3 +++ b/test/etags/ETAGS.good_3 @@ -2653,7 +2653,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -2662,6 +2662,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1133 LATEST=1,0 diff --git a/test/etags/ETAGS.good_4 b/test/etags/ETAGS.good_4 index 39a2f6efe74..434fe13cbd4 100644 --- a/test/etags/ETAGS.good_4 +++ b/test/etags/ETAGS.good_4 @@ -2500,7 +2500,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -2509,6 +2509,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1133 LATEST=1,0 diff --git a/test/etags/ETAGS.good_5 b/test/etags/ETAGS.good_5 index a820d81208a..425e2526f35 100644 --- a/test/etags/ETAGS.good_5 +++ b/test/etags/ETAGS.good_5 @@ -3386,7 +3386,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1156 LATEST=1,0 diff --git a/test/etags/ETAGS.good_6 b/test/etags/ETAGS.good_6 index c3051470441..39522dbdb9b 100644 --- a/test/etags/ETAGS.good_6 +++ b/test/etags/ETAGS.good_6 @@ -3386,7 +3386,7 @@ function MoveLayerBottom 223,5079 function MoveLayerBefore 236,5457 function MoveLayerAfter 258,6090 -lua-src/test.lua,291 +lua-src/test.lua,442 function Rectangle.getPos 2,15 function Rectangle.getPos getPos2,15 function Circle.getPos 6,61 @@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102 function Cube.data.getFoo getFoo10,102 function Square.something:Bar 14,148 function Square.something:Bar Bar14,148 + function test.me_22a(22,241 + function test.me_22a(me_22a22,241 + local function test.me22b 25,297 + local function test.me22b me22b25,297 make-src/Makefile,1156 LATEST=1,0 diff --git a/test/etags/lua-src/test.lua b/test/etags/lua-src/test.lua index 3bfa49c4f5d..405eb5f1de0 100644 --- a/test/etags/lua-src/test.lua +++ b/test/etags/lua-src/test.lua @@ -13,3 +13,24 @@ end Square = {} function Square.something:Bar () end + +-- Comment line + -- Indented comment line + +test = {} + + function test.me_22a(one, two) + print"me_22a" + end + local function test.me22b (one) + print"me_22b" + end + + + test.i_123 = function (x) + print"i_123" +end + + +test.me_12a(1,2) +test.i_123(1)