aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-12-11 12:07:26 +0200
committerEli Zaretskii2015-12-11 12:07:26 +0200
commit3e08f784d1cb8ebd0bd4ff53c1948a65c4924d52 (patch)
treebe175b403909d3207a4e2b97accd905796bda62c
parent9d2b8e768f2015a89f7609dedf7b28ea5e8123b5 (diff)
downloademacs-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/NEWS5
-rw-r--r--lib-src/etags.c1
-rw-r--r--test/etags/CTAGS.good4
-rw-r--r--test/etags/ETAGS.good_16
-rw-r--r--test/etags/ETAGS.good_26
-rw-r--r--test/etags/ETAGS.good_36
-rw-r--r--test/etags/ETAGS.good_46
-rw-r--r--test/etags/ETAGS.good_56
-rw-r--r--test/etags/ETAGS.good_66
-rw-r--r--test/etags/lua-src/test.lua21
10 files changed, 61 insertions, 6 deletions
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.
1466Names of modules, classes, methods, and functions are tagged. 1466Names of modules, classes, methods, and functions are tagged.
1467Overloaded operators are also tagged. 1467Overloaded operators are also tagged.
1468 1468
1469*** Improved support for Lua
1470
1471Etags now tags functions even if the "function" keyword follows some
1472whitespace 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
3425mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/ 3425mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/
3426mcheck_status c-src/emacs/src/gmalloc.c 283 3426mcheck_status c-src/emacs/src/gmalloc.c 283
3427mcheck_used c-src/emacs/src/gmalloc.c 2012 3427mcheck_used c-src/emacs/src/gmalloc.c 2012
3428me22b lua-src/test.lua /^ local function test.me22b (one)$/
3429me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
3428memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/ 3430memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/
3429member prol-src/natded.prolog /^member(X,[X|_]).$/ 3431member prol-src/natded.prolog /^member(X,[X|_]).$/
3430memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/ 3432memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/
@@ -4209,6 +4211,8 @@ test c-src/emacs/src/lisp.h 1871
4209test cp-src/c.C 86 4211test cp-src/c.C 86
4210test erl-src/gs_dialog.erl /^test() ->$/ 4212test erl-src/gs_dialog.erl /^test() ->$/
4211test php-src/ptest.php /^test $/ 4213test php-src/ptest.php /^test $/
4214test.me22b lua-src/test.lua /^ local function test.me22b (one)$/
4215test.me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
4212test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/ 4216test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/
4213texttreelist prol-src/natded.prolog /^texttreelist([]).$/ 4217texttreelist prol-src/natded.prolog /^texttreelist([]).$/
4214this c-src/a/b/b.c 1 4218this 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
2336function MoveLayerBefore 236,5457 2336function MoveLayerBefore 236,5457
2337function MoveLayerAfter 258,6090 2337function MoveLayerAfter 258,6090
2338 2338
2339lua-src/test.lua,291 2339lua-src/test.lua,442
2340function Rectangle.getPos 2,15 2340function Rectangle.getPos 2,15
2341function Rectangle.getPos getPos2,15 2341function Rectangle.getPos getPos2,15
2342function Circle.getPos 6,61 2342function Circle.getPos 6,61
@@ -2345,6 +2345,10 @@ function Cube.data.getFoo 10,102
2345function Cube.data.getFoo getFoo10,102 2345function Cube.data.getFoo getFoo10,102
2346function Square.something:Bar 14,148 2346function Square.something:Bar 14,148
2347function Square.something:Bar Bar14,148 2347function 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
2349make-src/Makefile,1133 2353make-src/Makefile,1133
2350LATEST=1,0 2354LATEST=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
2905function MoveLayerBefore 236,5457 2905function MoveLayerBefore 236,5457
2906function MoveLayerAfter 258,6090 2906function MoveLayerAfter 258,6090
2907 2907
2908lua-src/test.lua,291 2908lua-src/test.lua,442
2909function Rectangle.getPos 2,15 2909function Rectangle.getPos 2,15
2910function Rectangle.getPos getPos2,15 2910function Rectangle.getPos getPos2,15
2911function Circle.getPos 6,61 2911function Circle.getPos 6,61
@@ -2914,6 +2914,10 @@ function Cube.data.getFoo 10,102
2914function Cube.data.getFoo getFoo10,102 2914function Cube.data.getFoo getFoo10,102
2915function Square.something:Bar 14,148 2915function Square.something:Bar 14,148
2916function Square.something:Bar Bar14,148 2916function 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
2918make-src/Makefile,1156 2922make-src/Makefile,1156
2919LATEST=1,0 2923LATEST=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
2653function MoveLayerBefore 236,5457 2653function MoveLayerBefore 236,5457
2654function MoveLayerAfter 258,6090 2654function MoveLayerAfter 258,6090
2655 2655
2656lua-src/test.lua,291 2656lua-src/test.lua,442
2657function Rectangle.getPos 2,15 2657function Rectangle.getPos 2,15
2658function Rectangle.getPos getPos2,15 2658function Rectangle.getPos getPos2,15
2659function Circle.getPos 6,61 2659function Circle.getPos 6,61
@@ -2662,6 +2662,10 @@ function Cube.data.getFoo 10,102
2662function Cube.data.getFoo getFoo10,102 2662function Cube.data.getFoo getFoo10,102
2663function Square.something:Bar 14,148 2663function Square.something:Bar 14,148
2664function Square.something:Bar Bar14,148 2664function 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
2666make-src/Makefile,1133 2670make-src/Makefile,1133
2667LATEST=1,0 2671LATEST=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
2500function MoveLayerBefore 236,5457 2500function MoveLayerBefore 236,5457
2501function MoveLayerAfter 258,6090 2501function MoveLayerAfter 258,6090
2502 2502
2503lua-src/test.lua,291 2503lua-src/test.lua,442
2504function Rectangle.getPos 2,15 2504function Rectangle.getPos 2,15
2505function Rectangle.getPos getPos2,15 2505function Rectangle.getPos getPos2,15
2506function Circle.getPos 6,61 2506function Circle.getPos 6,61
@@ -2509,6 +2509,10 @@ function Cube.data.getFoo 10,102
2509function Cube.data.getFoo getFoo10,102 2509function Cube.data.getFoo getFoo10,102
2510function Square.something:Bar 14,148 2510function Square.something:Bar 14,148
2511function Square.something:Bar Bar14,148 2511function 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
2513make-src/Makefile,1133 2517make-src/Makefile,1133
2514LATEST=1,0 2518LATEST=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
3386function MoveLayerBefore 236,5457 3386function MoveLayerBefore 236,5457
3387function MoveLayerAfter 258,6090 3387function MoveLayerAfter 258,6090
3388 3388
3389lua-src/test.lua,291 3389lua-src/test.lua,442
3390function Rectangle.getPos 2,15 3390function Rectangle.getPos 2,15
3391function Rectangle.getPos getPos2,15 3391function Rectangle.getPos getPos2,15
3392function Circle.getPos 6,61 3392function Circle.getPos 6,61
@@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102
3395function Cube.data.getFoo getFoo10,102 3395function Cube.data.getFoo getFoo10,102
3396function Square.something:Bar 14,148 3396function Square.something:Bar 14,148
3397function Square.something:Bar Bar14,148 3397function 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
3399make-src/Makefile,1156 3403make-src/Makefile,1156
3400LATEST=1,0 3404LATEST=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
3386function MoveLayerBefore 236,5457 3386function MoveLayerBefore 236,5457
3387function MoveLayerAfter 258,6090 3387function MoveLayerAfter 258,6090
3388 3388
3389lua-src/test.lua,291 3389lua-src/test.lua,442
3390function Rectangle.getPos 2,15 3390function Rectangle.getPos 2,15
3391function Rectangle.getPos getPos2,15 3391function Rectangle.getPos getPos2,15
3392function Circle.getPos 6,61 3392function Circle.getPos 6,61
@@ -3395,6 +3395,10 @@ function Cube.data.getFoo 10,102
3395function Cube.data.getFoo getFoo10,102 3395function Cube.data.getFoo getFoo10,102
3396function Square.something:Bar 14,148 3396function Square.something:Bar 14,148
3397function Square.something:Bar Bar14,148 3397function 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
3399make-src/Makefile,1156 3403make-src/Makefile,1156
3400LATEST=1,0 3404LATEST=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
13Square = {} 13Square = {}
14function Square.something:Bar () 14function Square.something:Bar ()
15end 15end
16
17-- Comment line
18 -- Indented comment line
19
20test = {}
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"
32end
33
34
35test.me_12a(1,2)
36test.i_123(1)