diff options
| author | Eli Zaretskii | 2015-12-11 12:07:26 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-11 12:07:26 +0200 |
| commit | 3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52 (patch) | |
| tree | be175b403909d3207a4e2b97accd905796bda62c | |
| parent | 9d2b8e768f2015a89f7609dedf7b28ea5e8123b5 (diff) | |
| download | emacs-3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52.tar.gz emacs-3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52.zip | |
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.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lib-src/etags.c | 1 | ||||
| -rw-r--r-- | test/etags/CTAGS.good | 4 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_1 | 6 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_2 | 6 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_3 | 6 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_4 | 6 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_5 | 6 | ||||
| -rw-r--r-- | test/etags/ETAGS.good_6 | 6 | ||||
| -rw-r--r-- | test/etags/lua-src/test.lua | 21 |
10 files changed, 61 insertions, 6 deletions
| @@ -1466,6 +1466,11 @@ qualified names by hand. | |||
| 1466 | Names of modules, classes, methods, and functions are tagged. | 1466 | Names of modules, classes, methods, and functions are tagged. |
| 1467 | Overloaded operators are also tagged. | 1467 | Overloaded operators are also tagged. |
| 1468 | 1468 | ||
| 1469 | *** Improved support for Lua | ||
| 1470 | |||
| 1471 | Etags now tags functions even if the "function" keyword follows some | ||
| 1472 | whitespace at line beginning. | ||
| 1473 | |||
| 1469 | 1474 | ||
| 1470 | * Changes in Emacs 25.1 on Non-Free Operating Systems | 1475 | * Changes in Emacs 25.1 on Non-Free Operating Systems |
| 1471 | 1476 | ||
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) | |||
| 4985 | 4985 | ||
| 4986 | LOOP_ON_INPUT_LINES (inf, lb, bp) | 4986 | LOOP_ON_INPUT_LINES (inf, lb, bp) |
| 4987 | { | 4987 | { |
| 4988 | bp = skip_spaces (bp); | ||
| 4988 | if (bp[0] != 'f' && bp[0] != 'l') | 4989 | if (bp[0] != 'f' && bp[0] != 'l') |
| 4989 | continue; | 4990 | continue; |
| 4990 | 4991 | ||
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 | |||
| 3425 | mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/ | 3425 | mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/ |
| 3426 | mcheck_status c-src/emacs/src/gmalloc.c 283 | 3426 | mcheck_status c-src/emacs/src/gmalloc.c 283 |
| 3427 | mcheck_used c-src/emacs/src/gmalloc.c 2012 | 3427 | mcheck_used c-src/emacs/src/gmalloc.c 2012 |
| 3428 | me22b lua-src/test.lua /^ local function test.me22b (one)$/ | ||
| 3429 | me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/ | ||
| 3428 | memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/ | 3430 | memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/ |
| 3429 | member prol-src/natded.prolog /^member(X,[X|_]).$/ | 3431 | member prol-src/natded.prolog /^member(X,[X|_]).$/ |
| 3430 | memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/ | 3432 | 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 | |||
| 4209 | test cp-src/c.C 86 | 4211 | test cp-src/c.C 86 |
| 4210 | test erl-src/gs_dialog.erl /^test() ->$/ | 4212 | test erl-src/gs_dialog.erl /^test() ->$/ |
| 4211 | test php-src/ptest.php /^test $/ | 4213 | test php-src/ptest.php /^test $/ |
| 4214 | test.me22b lua-src/test.lua /^ local function test.me22b (one)$/ | ||
| 4215 | test.me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/ | ||
| 4212 | test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/ | 4216 | test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/ |
| 4213 | texttreelist prol-src/natded.prolog /^texttreelist([]).$/ | 4217 | texttreelist prol-src/natded.prolog /^texttreelist([]).$/ |
| 4214 | this c-src/a/b/b.c 1 | 4218 | 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 | |||
| 2336 | function MoveLayerBefore 236,5457 | 2336 | function MoveLayerBefore 236,5457 |
| 2337 | function MoveLayerAfter 258,6090 | 2337 | function MoveLayerAfter 258,6090 |
| 2338 | 2338 | ||
| 2339 | lua-src/test.lua,291 | 2339 | lua-src/test.lua,442 |
| 2340 | function Rectangle.getPos 2,15 | 2340 | function Rectangle.getPos 2,15 |
| 2341 | function Rectangle.getPos getPos2,15 | 2341 | function Rectangle.getPos getPos2,15 |
| 2342 | function Circle.getPos 6,61 | 2342 | function Circle.getPos 6,61 |
| @@ -2345,6 +2345,10 @@ function Cube.data.getFoo 10,102 | |||
| 2345 | function Cube.data.getFoo getFoo10,102 | 2345 | function Cube.data.getFoo getFoo10,102 |
| 2346 | function Square.something:Bar 14,148 | 2346 | function Square.something:Bar 14,148 |
| 2347 | function Square.something:Bar Bar14,148 | 2347 | function Square.something:Bar Bar14,148 |
| 2348 | function test.me_22a(22,241 | ||
| 2349 | function test.me_22a(me_22a22,241 | ||
| 2350 | local function test.me22b 25,297 | ||
| 2351 | local function test.me22b me22b25,297 | ||
| 2348 | 2352 | ||
| 2349 | make-src/Makefile,1133 | 2353 | make-src/Makefile,1133 |
| 2350 | LATEST=1,0 | 2354 | 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 | |||
| 2905 | function MoveLayerBefore 236,5457 | 2905 | function MoveLayerBefore 236,5457 |
| 2906 | function MoveLayerAfter 258,6090 | 2906 | function MoveLayerAfter 258,6090 |
| 2907 | 2907 | ||
| 2908 | lua-src/test.lua,291 | 2908 | lua-src/test.lua,442 |
| 2909 | function Rectangle.getPos 2,15 | 2909 | function Rectangle.getPos 2,15 |
| 2910 | function Rectangle.getPos getPos2,15 | 2910 | function Rectangle.getPos getPos2,15 |
| 2911 | function Circle.getPos 6,61 | 2911 | function Circle.getPos 6,61 |
| @@ -2914,6 +2914,10 @@ function Cube.data.getFoo 10,102 | |||
| 2914 | function Cube.data.getFoo getFoo10,102 | 2914 | function Cube.data.getFoo getFoo10,102 |
| 2915 | function Square.something:Bar 14,148 | 2915 | function Square.something:Bar 14,148 |
| 2916 | function Square.something:Bar Bar14,148 | 2916 | function Square.something:Bar Bar14,148 |
| 2917 | function test.me_22a(22,241 | ||
| 2918 | function test.me_22a(me_22a22,241 | ||
| 2919 | local function test.me22b 25,297 | ||
| 2920 | local function test.me22b me22b25,297 | ||
| 2917 | 2921 | ||
| 2918 | make-src/Makefile,1156 | 2922 | make-src/Makefile,1156 |
| 2919 | LATEST=1,0 | 2923 | 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 | |||
| 2653 | function MoveLayerBefore 236,5457 | 2653 | function MoveLayerBefore 236,5457 |
| 2654 | function MoveLayerAfter 258,6090 | 2654 | function MoveLayerAfter 258,6090 |
| 2655 | 2655 | ||
| 2656 | lua-src/test.lua,291 | 2656 | lua-src/test.lua,442 |
| 2657 | function Rectangle.getPos 2,15 | 2657 | function Rectangle.getPos 2,15 |
| 2658 | function Rectangle.getPos getPos2,15 | 2658 | function Rectangle.getPos getPos2,15 |
| 2659 | function Circle.getPos 6,61 | 2659 | function Circle.getPos 6,61 |
| @@ -2662,6 +2662,10 @@ function Cube.data.getFoo 10,102 | |||
| 2662 | function Cube.data.getFoo getFoo10,102 | 2662 | function Cube.data.getFoo getFoo10,102 |
| 2663 | function Square.something:Bar 14,148 | 2663 | function Square.something:Bar 14,148 |
| 2664 | function Square.something:Bar Bar14,148 | 2664 | function Square.something:Bar Bar14,148 |
| 2665 | function test.me_22a(22,241 | ||
| 2666 | function test.me_22a(me_22a22,241 | ||
| 2667 | local function test.me22b 25,297 | ||
| 2668 | local function test.me22b me22b25,297 | ||
| 2665 | 2669 | ||
| 2666 | make-src/Makefile,1133 | 2670 | make-src/Makefile,1133 |
| 2667 | LATEST=1,0 | 2671 | 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 | |||
| 2500 | function MoveLayerBefore 236,5457 | 2500 | function MoveLayerBefore 236,5457 |
| 2501 | function MoveLayerAfter 258,6090 | 2501 | function MoveLayerAfter 258,6090 |
| 2502 | 2502 | ||
| 2503 | lua-src/test.lua,291 | 2503 | lua-src/test.lua,442 |
| 2504 | function Rectangle.getPos 2,15 | 2504 | function Rectangle.getPos 2,15 |
| 2505 | function Rectangle.getPos getPos2,15 | 2505 | function Rectangle.getPos getPos2,15 |
| 2506 | function Circle.getPos 6,61 | 2506 | function Circle.getPos 6,61 |
| @@ -2509,6 +2509,10 @@ function Cube.data.getFoo 10,102 | |||
| 2509 | function Cube.data.getFoo getFoo10,102 | 2509 | function Cube.data.getFoo getFoo10,102 |
| 2510 | function Square.something:Bar 14,148 | 2510 | function Square.something:Bar 14,148 |
| 2511 | function Square.something:Bar Bar14,148 | 2511 | function Square.something:Bar Bar14,148 |
| 2512 | function test.me_22a(22,241 | ||
| 2513 | function test.me_22a(me_22a22,241 | ||
| 2514 | local function test.me22b 25,297 | ||
| 2515 | local function test.me22b me22b25,297 | ||
| 2512 | 2516 | ||
| 2513 | make-src/Makefile,1133 | 2517 | make-src/Makefile,1133 |
| 2514 | LATEST=1,0 | 2518 | 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 | |||
| 3386 | function MoveLayerBefore 236,5457 | 3386 | function MoveLayerBefore 236,5457 |
| 3387 | function MoveLayerAfter 258,6090 | 3387 | function MoveLayerAfter 258,6090 |
| 3388 | 3388 | ||
| 3389 | lua-src/test.lua,291 | 3389 | lua-src/test.lua,442 |
| 3390 | function Rectangle.getPos 2,15 | 3390 | function Rectangle.getPos 2,15 |
| 3391 | function Rectangle.getPos getPos2,15 | 3391 | function Rectangle.getPos getPos2,15 |
| 3392 | function Circle.getPos 6,61 | 3392 | function Circle.getPos 6,61 |
| @@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102 | |||
| 3395 | function Cube.data.getFoo getFoo10,102 | 3395 | function Cube.data.getFoo getFoo10,102 |
| 3396 | function Square.something:Bar 14,148 | 3396 | function Square.something:Bar 14,148 |
| 3397 | function Square.something:Bar Bar14,148 | 3397 | function Square.something:Bar Bar14,148 |
| 3398 | function test.me_22a(22,241 | ||
| 3399 | function test.me_22a(me_22a22,241 | ||
| 3400 | local function test.me22b 25,297 | ||
| 3401 | local function test.me22b me22b25,297 | ||
| 3398 | 3402 | ||
| 3399 | make-src/Makefile,1156 | 3403 | make-src/Makefile,1156 |
| 3400 | LATEST=1,0 | 3404 | 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 | |||
| 3386 | function MoveLayerBefore 236,5457 | 3386 | function MoveLayerBefore 236,5457 |
| 3387 | function MoveLayerAfter 258,6090 | 3387 | function MoveLayerAfter 258,6090 |
| 3388 | 3388 | ||
| 3389 | lua-src/test.lua,291 | 3389 | lua-src/test.lua,442 |
| 3390 | function Rectangle.getPos 2,15 | 3390 | function Rectangle.getPos 2,15 |
| 3391 | function Rectangle.getPos getPos2,15 | 3391 | function Rectangle.getPos getPos2,15 |
| 3392 | function Circle.getPos 6,61 | 3392 | function Circle.getPos 6,61 |
| @@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102 | |||
| 3395 | function Cube.data.getFoo getFoo10,102 | 3395 | function Cube.data.getFoo getFoo10,102 |
| 3396 | function Square.something:Bar 14,148 | 3396 | function Square.something:Bar 14,148 |
| 3397 | function Square.something:Bar Bar14,148 | 3397 | function Square.something:Bar Bar14,148 |
| 3398 | function test.me_22a(22,241 | ||
| 3399 | function test.me_22a(me_22a22,241 | ||
| 3400 | local function test.me22b 25,297 | ||
| 3401 | local function test.me22b me22b25,297 | ||
| 3398 | 3402 | ||
| 3399 | make-src/Makefile,1156 | 3403 | make-src/Makefile,1156 |
| 3400 | LATEST=1,0 | 3404 | 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 | |||
| 13 | Square = {} | 13 | Square = {} |
| 14 | function Square.something:Bar () | 14 | function Square.something:Bar () |
| 15 | end | 15 | end |
| 16 | |||
| 17 | -- Comment line | ||
| 18 | -- Indented comment line | ||
| 19 | |||
| 20 | test = {} | ||
| 21 | |||
| 22 | function test.me_22a(one, two) | ||
| 23 | print"me_22a" | ||
| 24 | end | ||
| 25 | local function test.me22b (one) | ||
| 26 | print"me_22b" | ||
| 27 | end | ||
| 28 | |||
| 29 | |||
| 30 | test.i_123 = function (x) | ||
| 31 | print"i_123" | ||
| 32 | end | ||
| 33 | |||
| 34 | |||
| 35 | test.me_12a(1,2) | ||
| 36 | test.i_123(1) | ||