unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25071: 26.0.50; Various Forth related improvements for etags
@ 2016-11-30 11:29 Helmut Eller
  2016-11-30 15:21 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Helmut Eller @ 2016-11-30 11:29 UTC (permalink / raw)
  To: 25071

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

I'd like to propose a patch to etags for better Forth support.

With the patch, etags creates explicit tag names.  That works better in
combination with tag-exact-match-p.

It also adds supports for some keywords from the (relatively new)
Forth-2012 Standard.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Various-Forth-related-improvements-for-etags.patch --]
[-- Type: text/x-diff, Size: 19141 bytes --]

From 17dc260dd2a609e69d303cdbe1e81375d8d25519 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Wed, 30 Nov 2016 12:20:34 +0100
Subject: [PATCH] Various Forth related improvements for etags

Create explicit tag names for Forth files, so that names like "(foo)"
can be found.  Previously only "(foo" was found due to C-isms.

Fix a bug where a tag for "-bar" was created when encountering things
like "create-bar".

Recognize more words from the Forth-2012 Standard.

* lib-src/etags.c (Forth_words): Check for whitespace after defining
words.  Create explict tag name with pfnote.

* test/manual/etags/forth-src/test-forth.fth: Add some test cases.

* 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 changes in etags.c and new test cases.
---
 lib-src/etags.c                            | 40 ++++++++++++++++++++++--------
 test/manual/etags/CTAGS.good               | 15 ++++++++++-
 test/manual/etags/ETAGS.good_1             | 37 ++++++++++++++++++---------
 test/manual/etags/ETAGS.good_2             | 37 ++++++++++++++++++---------
 test/manual/etags/ETAGS.good_3             | 37 ++++++++++++++++++---------
 test/manual/etags/ETAGS.good_4             | 37 ++++++++++++++++++---------
 test/manual/etags/ETAGS.good_5             | 37 ++++++++++++++++++---------
 test/manual/etags/ETAGS.good_6             | 37 ++++++++++++++++++---------
 test/manual/etags/forth-src/test-forth.fth | 21 ++++++++++++++++
 9 files changed, 215 insertions(+), 83 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 6a722e0..f680d20 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -5469,16 +5469,36 @@ Forth_words (FILE *inf)
 	do			/* skip to ) or eol */
 	  bp++;
 	while (*bp != ')' && *bp != '\0');
-      else if ((bp[0] == ':' && c_isspace (bp[1]) && bp++)
-	       || LOOKING_AT_NOCASE (bp, "constant")
-	       || LOOKING_AT_NOCASE (bp, "code")
-	       || LOOKING_AT_NOCASE (bp, "create")
-	       || LOOKING_AT_NOCASE (bp, "defer")
-	       || LOOKING_AT_NOCASE (bp, "value")
-	       || LOOKING_AT_NOCASE (bp, "variable")
-	       || LOOKING_AT_NOCASE (bp, "buffer:")
-	       || LOOKING_AT_NOCASE (bp, "field"))
-	get_tag (skip_spaces (bp), NULL); /* Yay!  A definition! */
+      else if (((bp[0] == ':' && c_isspace (bp[1]) && bp++)
+		|| LOOKING_AT_NOCASE (bp, "constant")
+		|| LOOKING_AT_NOCASE (bp, "2constant")
+		|| LOOKING_AT_NOCASE (bp, "fconstant")
+		|| LOOKING_AT_NOCASE (bp, "code")
+		|| LOOKING_AT_NOCASE (bp, "create")
+		|| LOOKING_AT_NOCASE (bp, "defer")
+		|| LOOKING_AT_NOCASE (bp, "value")
+		|| LOOKING_AT_NOCASE (bp, "2value")
+		|| LOOKING_AT_NOCASE (bp, "fvalue")
+		|| LOOKING_AT_NOCASE (bp, "variable")
+		|| LOOKING_AT_NOCASE (bp, "2variable")
+		|| LOOKING_AT_NOCASE (bp, "fvariable")
+		|| LOOKING_AT_NOCASE (bp, "buffer:")
+		|| LOOKING_AT_NOCASE (bp, "field:")
+		|| LOOKING_AT_NOCASE (bp, "+field")
+		|| LOOKING_AT_NOCASE (bp, "field") /* not standard? */
+		|| LOOKING_AT_NOCASE (bp, "begin-structure")
+		|| LOOKING_AT_NOCASE (bp, "synonym")
+		)
+	       && c_isspace (bp[0]))
+	{
+	  /* Yay!  A definition! */
+	  char* name_start = skip_spaces (bp);
+	  char* name_end = skip_non_spaces (name_start);
+	  char* name = savenstr (name_start, name_end - name_start);
+	  pfnote (name, true, lb.buffer, name_end - lb.buffer,
+		  lineno, linecharno);
+	  bp = name_end;
+	}
       else
 	bp = skip_non_spaces (bp);
 }
diff --git a/test/manual/etags/CTAGS.good b/test/manual/etags/CTAGS.good
index e652989..6f9df19 100644
--- a/test/manual/etags/CTAGS.good
+++ b/test/manual/etags/CTAGS.good
@@ -36,7 +36,8 @@ ${CHECKOBJS}	make-src/Makefile	/^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
 ($prog,$_,@list	perl-src/yagrip.pl	39
 ($string,$flag,@string,@temp,@last	perl-src/yagrip.pl	40
 (a-forth-constant	forth-src/test-forth.fth	/^constant (a-forth-constant$/
-(another-forth-word	forth-src/test-forth.fth	/^: (another-forth-word) ( -- )$/
+(another-forth-word)	forth-src/test-forth.fth	/^: (another-forth-word) ( -- )$/
+(foo)	forth-src/test-forth.fth	/^: (foo) 1 ;$/
 +	ruby-src/test.rb	/^        def +(y)$/
 +	tex-src/texinfo.tex	/^\\def+{{\\tt \\char 43}}$/
 .PRECIOUS	make-src/Makefile	/^.PRECIOUS: ETAGS CTAGS ETAGS16 CTAGS16 ETAGS17 CTA/
@@ -170,6 +171,9 @@ ${CHECKOBJS}	make-src/Makefile	/^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
 /wbytes	ps-src/rfc1245.ps	/^\/wbytes { $/
 /wh	ps-src/rfc1245.ps	/^\/wh { $/
 /yen	ps-src/rfc1245.ps	/^\/yen \/.notdef \/.notdef \/.notdef \/.notdef \/.notdef /
+2const	forth-src/test-forth.fth	/^3 4 2constant 2const$/
+2val	forth-src/test-forth.fth	/^2const 2value 2val$/
+2var	forth-src/test-forth.fth	/^2variable 2var$/
 :a-forth-dictionary-entry	forth-src/test-forth.fth	/^create :a-forth-dictionary-entry$/
 <	tex-src/texinfo.tex	/^\\def<{{\\tt \\less}}$/
 <<	ruby-src/test.rb	/^        def <<(y)$/
@@ -2725,6 +2729,7 @@ counter	cp-src/c.C	36
 cow	cp-src/c.C	127
 cow	cp-src/c.C	131
 cplpl	c-src/etags.c	2935
+create-bar	forth-src/test-forth.fth	/^: create-bar foo ;$/
 createPOEntries	php-src/lce_functions.php	/^      function createPOEntries()$/
 createWidgets	pyt-src/server.py	/^    def createWidgets(self, host):$/
 createWidgets	pyt-src/server.py	/^    def createWidgets(self):$/
@@ -2944,6 +2949,7 @@ fastmap	c-src/emacs/src/regex.h	355
 fastmap_accurate	c-src/emacs/src/regex.h	383
 fatal	c-src/etags.c	/^fatal (const char *s1, const char *s2)$/
 fatala	c.c	/^void fatala () __attribute__ ((noreturn));$/
+fconst	forth-src/test-forth.fth	/^3.1415e fconstant fconst$/
 fdHandler	objc-src/Subprocess.m	/^- fdHandler:(int)theFd$/
 fdHandler	objc-src/Subprocess.m	/^fdHandler (int theFd, id self)$/
 fdefunkey	c-src/etags.c	2409
@@ -3015,6 +3021,7 @@ foo	cp-src/x.cc	/^XX::foo()$/
 foo	f-src/entry.for	/^       character*(*) function foo()$/
 foo	f-src/entry.strange_suffix	/^       character*(*) function foo()$/
 foo	f-src/entry.strange	/^       character*(*) function foo()$/
+foo	forth-src/test-forth.fth	/^: foo (foo) ;$/
 foo	php-src/ptest.php	/^foo()$/
 foo	ruby-src/test1.ru	/^    attr_reader :foo$/
 foo!	ruby-src/test1.ru	/^    def foo!$/
@@ -3057,6 +3064,8 @@ function	c-src/emacs/src/lisp.h	694
 function	c-src/emacs/src/lisp.h	1685
 function	c-src/emacs/src/lisp.h	2197
 functionp	c-src/emacs/src/lisp.h	/^functionp (Lisp_Object object)$/
+fval	forth-src/test-forth.fth	/^fconst fvalue fval$/
+fvar	forth-src/test-forth.fth	/^fvariable fvar$/
 fvdef	c-src/etags.c	2418
 fvextern	c-src/etags.c	2420
 fvnameseen	c-src/etags.c	2412
@@ -3515,6 +3524,7 @@ my_struct	c.c	226
 my_struct	c-src/h.h	91
 my_typedef	c.c	228
 my_typedef	c-src/h.h	93
+mypi	forth-src/test-forth.fth	/^synonym mypi fconst$/
 n	c-src/exit.c	28
 n	c-src/exit.strange_suffix	28
 name	c-src/getopt.h	76
@@ -3719,6 +3729,8 @@ outputtable	html-src/algrthms.html	/^Output$/
 outsyn	prol-src/natded.prolog	/^outsyn(['Any'],_).$/
 p	c-src/emacs/src/lisp.h	4673
 p	c-src/emacs/src/lisp.h	4679
+p.x	forth-src/test-forth.fth	/^  1 CELLS +FIELD p.x    \\ A single cell filed name/
+p.y	forth-src/test-forth.fth	/^  1 CELLS +FIELD p.y    \\ A single cell field name/
 p/f	ada-src/etags-test-for.ada	/^   function p pragma Import (C,$/
 p/f	ada-src/etags-test-for.ada	/^function p ("p");$/
 pD	c-src/emacs/src/lisp.h	165
@@ -3767,6 +3779,7 @@ plist	c-src/emacs/src/lisp.h	697
 plus	cp-src/functions.cpp	/^void Date::plus ( int days , int month , int year /
 plus	go-src/test1.go	5
 plusvalseq	prol-src/natded.prolog	/^plusvalseq([]) --> [].$/
+point	forth-src/test-forth.fth	/^BEGIN-STRUCTURE point \\ create the named structure/
 pointer	c-src/emacs/src/lisp.h	2125
 poll_for_input	c-src/emacs/src/keyboard.c	/^poll_for_input (struct atimer *timer)$/
 poll_for_input_1	c-src/emacs/src/keyboard.c	/^poll_for_input_1 (void)$/
diff --git a/test/manual/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1
index 374692c..4067a80 100644
--- a/test/manual/etags/ETAGS.good_1
+++ b/test/manual/etags/ETAGS.good_1
@@ -2311,19 +2311,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_2 b/test/manual/etags/ETAGS.good_2
index a21717a..71634d4 100644
--- a/test/manual/etags/ETAGS.good_2
+++ b/test/manual/etags/ETAGS.good_2
@@ -2880,19 +2880,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_3 b/test/manual/etags/ETAGS.good_3
index 33bf110..9b56bb2 100644
--- a/test/manual/etags/ETAGS.good_3
+++ b/test/manual/etags/ETAGS.good_3
@@ -2628,19 +2628,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_4 b/test/manual/etags/ETAGS.good_4
index 3d9d626..8629294 100644
--- a/test/manual/etags/ETAGS.good_4
+++ b/test/manual/etags/ETAGS.good_4
@@ -2475,19 +2475,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_5 b/test/manual/etags/ETAGS.good_5
index 1dff768..8e246c1 100644
--- a/test/manual/etags/ETAGS.good_5
+++ b/test/manual/etags/ETAGS.good_5
@@ -3361,19 +3361,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_6 b/test/manual/etags/ETAGS.good_6
index fdcbd57..37294aa 100644
--- a/test/manual/etags/ETAGS.good_6
+++ b/test/manual/etags/ETAGS.good_6
@@ -3361,19 +3361,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
-99 constant a-forth-constant!\x7f22,343
-55 value a-forth-value?\x7f23,373
-create :a-forth-dictionary-entry\x7f24,397
-defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
-   9   field   >field1\x7f36,582
-   5   field   >field2\x7f37,605
+forth-src/test-forth.fth,948
+: a-forth-word\x7fa-forth-word\x0120,301
+99 constant a-forth-constant!\x7fa-forth-constant!\x0122,343
+55 value a-forth-value?\x7fa-forth-value?\x0123,373
+create :a-forth-dictionary-entry\x7f:a-forth-dictionary-entry\x0124,397
+defer #a-defer-word\x7f#a-defer-word\x0127,460
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
+   9   field   >field1\x7f>field1\x0136,582
+   5   field   >field2\x7f>field2\x0137,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
-2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+2000 buffer: #some-storage\x7f#some-storage\x0141,657
+code assemby-code-word\x7fassemby-code-word\x0143,685
+: a-forth-word\x7fa-forth-word\x0150,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7ffoo\x0156,1000
+: create-bar\x7fcreate-bar\x0158,1015
+3 4 2constant 2const\x7f2const\x0161,1074
+2const 2value 2val\x7f2val\x0162,1095
+2variable 2var\x7f2var\x0163,1114
+3.1415e fconstant fconst\x7ffconst\x0165,1130
+fconst fvalue fval\x7ffval\x0166,1155
+fvariable fvar\x7ffvar\x0167,1174
+synonym mypi\x7fmypi\x0169,1190
+BEGIN-STRUCTURE point\x7fpoint\x0171,1211
+  1 CELLS +FIELD p.x\x7fp.x\x0172,1262
+  1 CELLS +FIELD p.y\x7fp.y\x0173,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/forth-src/test-forth.fth b/test/manual/etags/forth-src/test-forth.fth
index ce4069d..4521d32 100644
--- a/test/manual/etags/forth-src/test-forth.fth
+++ b/test/manual/etags/forth-src/test-forth.fth
@@ -51,3 +51,24 @@ c;
     a-forth-word dup 200 > abort" Eek.  The number is too big"
     ." Result is " . cr
 ;
+
+: (foo) 1 ;
+: foo (foo) ;
+
+: create-bar foo ;
+create-bar  \ Do NOT create a tag here
+
+3 4 2constant 2const
+2const 2value 2val
+2variable 2var
+
+3.1415e fconstant fconst
+fconst fvalue fval
+fvariable fvar
+
+synonym mypi fconst
+
+BEGIN-STRUCTURE point \ create the named structure
+  1 CELLS +FIELD p.x    \ A single cell filed named p.x
+  1 CELLS +FIELD p.y    \ A single cell field named p.y
+END-STRUCTURE
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#25071: 26.0.50; Various Forth related improvements for etags
  2016-11-30 11:29 bug#25071: 26.0.50; Various Forth related improvements for etags Helmut Eller
@ 2016-11-30 15:21 ` Eli Zaretskii
  2016-11-30 16:55   ` Helmut Eller
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-11-30 15:21 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 25071

> From: Helmut Eller <eller.helmut@gmail.com>
> Date: Wed, 30 Nov 2016 12:29:40 +0100
> 
> I'd like to propose a patch to etags for better Forth support.

Thanks!

> With the patch, etags creates explicit tag names.  That works better in
> combination with tag-exact-match-p.

Can you explain more about this?  Explicit tag names bloat the TAGS
files, so other languages don't use that by default, except where
really needed.  Could it be that only some tags need to be written as
explicit, e.g. because they contain some special characters?

Also, it sounds like you send a patch wrt emacs-25 branch; if so,
please rebase on master, since that is where the patch will be pushed
eventually.  The test files are in a different place on master.

Thanks again for working on this.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25071: 26.0.50; Various Forth related improvements for etags
  2016-11-30 15:21 ` Eli Zaretskii
@ 2016-11-30 16:55   ` Helmut Eller
  2016-11-30 17:47     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Helmut Eller @ 2016-11-30 16:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25071

On Wed, Nov 30 2016, Eli Zaretskii wrote:

>> With the patch, etags creates explicit tag names.  That works better in
>> combination with tag-exact-match-p.
>
> Can you explain more about this?  Explicit tag names bloat the TAGS
> files, so other languages don't use that by default, except where
> really needed.

Yes, the TAGS file becomes at most twice as big.  That's a minor
disadvantage that I'm happy to trade for even tiny improvements in
precision.

I also note that, Gforth (the GNU Forth implementation) ships a TAGS
file for the built-in definitions with explicit tag names (usually
installed in /usr/share/gforth/<version>/TAGS).  They use the Gforth
compiler, not etags, to create this TAGS file.  Obviously they aren't
bothered by the bloat either.

> Could it be that only some tags need to be written as
> explicit, e.g. because they contain some special characters?

Yes, that's the main reason.  E.g. with the old version a source file
test.fth with this content:

: (foo) 123 ;

produced this TAGS file:
\f
test.fth,17
: (foo)\x7f(foo.1,0

Hmm, it already created explicit tag names before.  But with "(foo" as
name, which is wrong.  The name should be "(foo)".

In case your are not familiar with Forth syntax: names in Forth are
separated by whitespace and can contain "(", ")", "," or other
non-whitespace characters.  A word in parentheses like "(foo)" is a
widely used naming convention for internal/auxiliary definitions.

The old version of etags.c used get_tag which uses notinname to find the
end of the name, but that excludes ")", which is wrong for Forth.

> Also, it sounds like you send a patch wrt emacs-25 branch; if so,
> please rebase on master, since that is where the patch will be pushed
> eventually.  The test files are in a different place on master.

The patch is against master, but I wrote the wrong filenames in the
changelog, because I copied part of it from an old commit message.

Helmut





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25071: 26.0.50; Various Forth related improvements for etags
  2016-11-30 16:55   ` Helmut Eller
@ 2016-11-30 17:47     ` Eli Zaretskii
  2016-11-30 19:32       ` Helmut Eller
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-11-30 17:47 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 25071

> From: Helmut Eller <eller.helmut@gmail.com>
> Cc: 25071@debbugs.gnu.org
> Date: Wed, 30 Nov 2016 17:55:02 +0100
> 
> On Wed, Nov 30 2016, Eli Zaretskii wrote:
> 
> >> With the patch, etags creates explicit tag names.  That works better in
> >> combination with tag-exact-match-p.
> >
> > Can you explain more about this?  Explicit tag names bloat the TAGS
> > files, so other languages don't use that by default, except where
> > really needed.
> 
> Yes, the TAGS file becomes at most twice as big.  That's a minor
> disadvantage that I'm happy to trade for even tiny improvements in
> precision.

It clearly isn't a catastrophe, if doing that is necessary.  I just
want to be sure that all Forth tags need to be explicit.  Is there
perhaps some reasonably easy way to make only those tags explicit
which actually use the special characters that require it?

> > Also, it sounds like you send a patch wrt emacs-25 branch; if so,
> > please rebase on master, since that is where the patch will be pushed
> > eventually.  The test files are in a different place on master.
> 
> The patch is against master, but I wrote the wrong filenames in the
> changelog, because I copied part of it from an old commit message.

OK, thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25071: 26.0.50; Various Forth related improvements for etags
  2016-11-30 17:47     ` Eli Zaretskii
@ 2016-11-30 19:32       ` Helmut Eller
  2016-12-01 16:59         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Helmut Eller @ 2016-11-30 19:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25071

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

On Wed, Nov 30 2016, Eli Zaretskii wrote:

>> Yes, the TAGS file becomes at most twice as big.  That's a minor
>> disadvantage that I'm happy to trade for even tiny improvements in
>> precision.
>
> It clearly isn't a catastrophe, if doing that is necessary.  I just
> want to be sure that all Forth tags need to be explicit.  Is there
> perhaps some reasonably easy way to make only those tags explicit
> which actually use the special characters that require it?

OK.  Here's an updated patch.  It calls make_tag instead of pfnote.
make_tag tries to use implicit names if possible.  If it's not possible,
it creates an explicit name.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Various-Forth-related-improvements-for-etags.patch --]
[-- Type: text/x-diff, Size: 16444 bytes --]

From 3403c19bdae76e4bb33b25108383c8cbf6bf30d8 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Wed, 30 Nov 2016 20:25:26 +0100
Subject: [PATCH] Various Forth related improvements for etags

Generate correct tags names for things like "(foo)".
Previously "(foo" created.

Fix a bug where a tag for "-bar" was created when encountering things
like "create-bar".

Recognize more words from the Forth-2012 Standard.

* lib-src/etags.c (Forth_words): Check for whitespace after defining
words.  Create tag with make_tag instead of get_tag to avoid notiname
which isn't appropriate for Forth.

* test/manual/etags/forth-src/test-forth.fth: Add some test cases.

* 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:
* test/manual/etags/CTAGS.good: Adapt to the changes in etags.c and
new test cases.
---
 lib-src/etags.c                            | 41 ++++++++++++++++++++++--------
 test/manual/etags/CTAGS.good               | 15 ++++++++++-
 test/manual/etags/ETAGS.good_1             | 23 +++++++++++++----
 test/manual/etags/ETAGS.good_2             | 23 +++++++++++++----
 test/manual/etags/ETAGS.good_3             | 23 +++++++++++++----
 test/manual/etags/ETAGS.good_4             | 23 +++++++++++++----
 test/manual/etags/ETAGS.good_5             | 23 +++++++++++++----
 test/manual/etags/ETAGS.good_6             | 23 +++++++++++++----
 test/manual/etags/forth-src/test-forth.fth | 21 +++++++++++++++
 9 files changed, 174 insertions(+), 41 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 6a722e0..7baa2a3 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -5469,16 +5469,37 @@ Forth_words (FILE *inf)
 	do			/* skip to ) or eol */
 	  bp++;
 	while (*bp != ')' && *bp != '\0');
-      else if ((bp[0] == ':' && c_isspace (bp[1]) && bp++)
-	       || LOOKING_AT_NOCASE (bp, "constant")
-	       || LOOKING_AT_NOCASE (bp, "code")
-	       || LOOKING_AT_NOCASE (bp, "create")
-	       || LOOKING_AT_NOCASE (bp, "defer")
-	       || LOOKING_AT_NOCASE (bp, "value")
-	       || LOOKING_AT_NOCASE (bp, "variable")
-	       || LOOKING_AT_NOCASE (bp, "buffer:")
-	       || LOOKING_AT_NOCASE (bp, "field"))
-	get_tag (skip_spaces (bp), NULL); /* Yay!  A definition! */
+      else if (((bp[0] == ':' && c_isspace (bp[1]) && bp++)
+		|| LOOKING_AT_NOCASE (bp, "constant")
+		|| LOOKING_AT_NOCASE (bp, "2constant")
+		|| LOOKING_AT_NOCASE (bp, "fconstant")
+		|| LOOKING_AT_NOCASE (bp, "code")
+		|| LOOKING_AT_NOCASE (bp, "create")
+		|| LOOKING_AT_NOCASE (bp, "defer")
+		|| LOOKING_AT_NOCASE (bp, "value")
+		|| LOOKING_AT_NOCASE (bp, "2value")
+		|| LOOKING_AT_NOCASE (bp, "fvalue")
+		|| LOOKING_AT_NOCASE (bp, "variable")
+		|| LOOKING_AT_NOCASE (bp, "2variable")
+		|| LOOKING_AT_NOCASE (bp, "fvariable")
+		|| LOOKING_AT_NOCASE (bp, "buffer:")
+		|| LOOKING_AT_NOCASE (bp, "field:")
+		|| LOOKING_AT_NOCASE (bp, "+field")
+		|| LOOKING_AT_NOCASE (bp, "field") /* not standard? */
+		|| LOOKING_AT_NOCASE (bp, "begin-structure")
+		|| LOOKING_AT_NOCASE (bp, "synonym")
+		)
+	       && c_isspace (bp[0]))
+	{
+	  /* Yay!  A definition! */
+	  char* name_start = skip_spaces (bp);
+	  char* name_end = skip_non_spaces (name_start);
+	  if (name_start < name_end)
+	    make_tag (name_start, name_end - name_start,
+		      true, lb.buffer, name_end - lb.buffer,
+		      lineno, linecharno);
+	  bp = name_end;
+	}
       else
 	bp = skip_non_spaces (bp);
 }
diff --git a/test/manual/etags/CTAGS.good b/test/manual/etags/CTAGS.good
index e652989..6f9df19 100644
--- a/test/manual/etags/CTAGS.good
+++ b/test/manual/etags/CTAGS.good
@@ -36,7 +36,8 @@ ${CHECKOBJS}	make-src/Makefile	/^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
 ($prog,$_,@list	perl-src/yagrip.pl	39
 ($string,$flag,@string,@temp,@last	perl-src/yagrip.pl	40
 (a-forth-constant	forth-src/test-forth.fth	/^constant (a-forth-constant$/
-(another-forth-word	forth-src/test-forth.fth	/^: (another-forth-word) ( -- )$/
+(another-forth-word)	forth-src/test-forth.fth	/^: (another-forth-word) ( -- )$/
+(foo)	forth-src/test-forth.fth	/^: (foo) 1 ;$/
 +	ruby-src/test.rb	/^        def +(y)$/
 +	tex-src/texinfo.tex	/^\\def+{{\\tt \\char 43}}$/
 .PRECIOUS	make-src/Makefile	/^.PRECIOUS: ETAGS CTAGS ETAGS16 CTAGS16 ETAGS17 CTA/
@@ -170,6 +171,9 @@ ${CHECKOBJS}	make-src/Makefile	/^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
 /wbytes	ps-src/rfc1245.ps	/^\/wbytes { $/
 /wh	ps-src/rfc1245.ps	/^\/wh { $/
 /yen	ps-src/rfc1245.ps	/^\/yen \/.notdef \/.notdef \/.notdef \/.notdef \/.notdef /
+2const	forth-src/test-forth.fth	/^3 4 2constant 2const$/
+2val	forth-src/test-forth.fth	/^2const 2value 2val$/
+2var	forth-src/test-forth.fth	/^2variable 2var$/
 :a-forth-dictionary-entry	forth-src/test-forth.fth	/^create :a-forth-dictionary-entry$/
 <	tex-src/texinfo.tex	/^\\def<{{\\tt \\less}}$/
 <<	ruby-src/test.rb	/^        def <<(y)$/
@@ -2725,6 +2729,7 @@ counter	cp-src/c.C	36
 cow	cp-src/c.C	127
 cow	cp-src/c.C	131
 cplpl	c-src/etags.c	2935
+create-bar	forth-src/test-forth.fth	/^: create-bar foo ;$/
 createPOEntries	php-src/lce_functions.php	/^      function createPOEntries()$/
 createWidgets	pyt-src/server.py	/^    def createWidgets(self, host):$/
 createWidgets	pyt-src/server.py	/^    def createWidgets(self):$/
@@ -2944,6 +2949,7 @@ fastmap	c-src/emacs/src/regex.h	355
 fastmap_accurate	c-src/emacs/src/regex.h	383
 fatal	c-src/etags.c	/^fatal (const char *s1, const char *s2)$/
 fatala	c.c	/^void fatala () __attribute__ ((noreturn));$/
+fconst	forth-src/test-forth.fth	/^3.1415e fconstant fconst$/
 fdHandler	objc-src/Subprocess.m	/^- fdHandler:(int)theFd$/
 fdHandler	objc-src/Subprocess.m	/^fdHandler (int theFd, id self)$/
 fdefunkey	c-src/etags.c	2409
@@ -3015,6 +3021,7 @@ foo	cp-src/x.cc	/^XX::foo()$/
 foo	f-src/entry.for	/^       character*(*) function foo()$/
 foo	f-src/entry.strange_suffix	/^       character*(*) function foo()$/
 foo	f-src/entry.strange	/^       character*(*) function foo()$/
+foo	forth-src/test-forth.fth	/^: foo (foo) ;$/
 foo	php-src/ptest.php	/^foo()$/
 foo	ruby-src/test1.ru	/^    attr_reader :foo$/
 foo!	ruby-src/test1.ru	/^    def foo!$/
@@ -3057,6 +3064,8 @@ function	c-src/emacs/src/lisp.h	694
 function	c-src/emacs/src/lisp.h	1685
 function	c-src/emacs/src/lisp.h	2197
 functionp	c-src/emacs/src/lisp.h	/^functionp (Lisp_Object object)$/
+fval	forth-src/test-forth.fth	/^fconst fvalue fval$/
+fvar	forth-src/test-forth.fth	/^fvariable fvar$/
 fvdef	c-src/etags.c	2418
 fvextern	c-src/etags.c	2420
 fvnameseen	c-src/etags.c	2412
@@ -3515,6 +3524,7 @@ my_struct	c.c	226
 my_struct	c-src/h.h	91
 my_typedef	c.c	228
 my_typedef	c-src/h.h	93
+mypi	forth-src/test-forth.fth	/^synonym mypi fconst$/
 n	c-src/exit.c	28
 n	c-src/exit.strange_suffix	28
 name	c-src/getopt.h	76
@@ -3719,6 +3729,8 @@ outputtable	html-src/algrthms.html	/^Output$/
 outsyn	prol-src/natded.prolog	/^outsyn(['Any'],_).$/
 p	c-src/emacs/src/lisp.h	4673
 p	c-src/emacs/src/lisp.h	4679
+p.x	forth-src/test-forth.fth	/^  1 CELLS +FIELD p.x    \\ A single cell filed name/
+p.y	forth-src/test-forth.fth	/^  1 CELLS +FIELD p.y    \\ A single cell field name/
 p/f	ada-src/etags-test-for.ada	/^   function p pragma Import (C,$/
 p/f	ada-src/etags-test-for.ada	/^function p ("p");$/
 pD	c-src/emacs/src/lisp.h	165
@@ -3767,6 +3779,7 @@ plist	c-src/emacs/src/lisp.h	697
 plus	cp-src/functions.cpp	/^void Date::plus ( int days , int month , int year /
 plus	go-src/test1.go	5
 plusvalseq	prol-src/natded.prolog	/^plusvalseq([]) --> [].$/
+point	forth-src/test-forth.fth	/^BEGIN-STRUCTURE point \\ create the named structure/
 pointer	c-src/emacs/src/lisp.h	2125
 poll_for_input	c-src/emacs/src/keyboard.c	/^poll_for_input (struct atimer *timer)$/
 poll_for_input_1	c-src/emacs/src/keyboard.c	/^poll_for_input_1 (void)$/
diff --git a/test/manual/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1
index 374692c..b3bd241 100644
--- a/test/manual/etags/ETAGS.good_1
+++ b/test/manual/etags/ETAGS.good_1
@@ -2311,19 +2311,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_2 b/test/manual/etags/ETAGS.good_2
index a21717a..170d845 100644
--- a/test/manual/etags/ETAGS.good_2
+++ b/test/manual/etags/ETAGS.good_2
@@ -2880,19 +2880,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_3 b/test/manual/etags/ETAGS.good_3
index 33bf110..1d75314 100644
--- a/test/manual/etags/ETAGS.good_3
+++ b/test/manual/etags/ETAGS.good_3
@@ -2628,19 +2628,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_4 b/test/manual/etags/ETAGS.good_4
index 3d9d626..e74db28 100644
--- a/test/manual/etags/ETAGS.good_4
+++ b/test/manual/etags/ETAGS.good_4
@@ -2475,19 +2475,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_5 b/test/manual/etags/ETAGS.good_5
index 1dff768..e278678 100644
--- a/test/manual/etags/ETAGS.good_5
+++ b/test/manual/etags/ETAGS.good_5
@@ -3361,19 +3361,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/ETAGS.good_6 b/test/manual/etags/ETAGS.good_6
index fdcbd57..68e474d 100644
--- a/test/manual/etags/ETAGS.good_6
+++ b/test/manual/etags/ETAGS.good_6
@@ -3361,19 +3361,32 @@ f-src/entry.strange,172
      & intensity1(\x7f577,12231
        character*(*) function foo(\x7f579,12307
 \f
-forth-src/test-forth.fth,408
-: a-forth-word \x7f20,301
+forth-src/test-forth.fth,733
+: a-forth-word\x7f20,301
 99 constant a-forth-constant!\x7f22,343
 55 value a-forth-value?\x7f23,373
 create :a-forth-dictionary-entry\x7f24,397
 defer #a-defer-word\x7f27,460
-: (another-forth-word)\x7f(another-forth-word\x0129,481
+: (another-forth-word)\x7f(another-forth-word)\x0129,481
    9   field   >field1\x7f36,582
    5   field   >field2\x7f37,605
 constant (a-forth-constant\x7f(a-forth-constant\x0138,628
 2000 buffer: #some-storage\x7f41,657
-code assemby-code-word \x7f43,685
-: a-forth-word \x7f50,870
+code assemby-code-word\x7f43,685
+: a-forth-word\x7f50,870
+: (foo)\x7f(foo)\x0155,988
+: foo\x7f56,1000
+: create-bar\x7f58,1015
+3 4 2constant 2const\x7f61,1074
+2const 2value 2val\x7f62,1095
+2variable 2var\x7f63,1114
+3.1415e fconstant fconst\x7f65,1130
+fconst fvalue fval\x7f66,1155
+fvariable fvar\x7f67,1174
+synonym mypi\x7f69,1190
+BEGIN-STRUCTURE point\x7f71,1211
+  1 CELLS +FIELD p.x\x7f72,1262
+  1 CELLS +FIELD p.y\x7f73,1318
 \f
 go-src/test.go,48
 package main\x7f1,0
diff --git a/test/manual/etags/forth-src/test-forth.fth b/test/manual/etags/forth-src/test-forth.fth
index ce4069d..4521d32 100644
--- a/test/manual/etags/forth-src/test-forth.fth
+++ b/test/manual/etags/forth-src/test-forth.fth
@@ -51,3 +51,24 @@ c;
     a-forth-word dup 200 > abort" Eek.  The number is too big"
     ." Result is " . cr
 ;
+
+: (foo) 1 ;
+: foo (foo) ;
+
+: create-bar foo ;
+create-bar  \ Do NOT create a tag here
+
+3 4 2constant 2const
+2const 2value 2val
+2variable 2var
+
+3.1415e fconstant fconst
+fconst fvalue fval
+fvariable fvar
+
+synonym mypi fconst
+
+BEGIN-STRUCTURE point \ create the named structure
+  1 CELLS +FIELD p.x    \ A single cell filed named p.x
+  1 CELLS +FIELD p.y    \ A single cell field named p.y
+END-STRUCTURE
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#25071: 26.0.50; Various Forth related improvements for etags
  2016-11-30 19:32       ` Helmut Eller
@ 2016-12-01 16:59         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-12-01 16:59 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 25071-done

> From: Helmut Eller <eller.helmut@gmail.com>
> Cc: 25071@debbugs.gnu.org
> Date: Wed, 30 Nov 2016 20:32:21 +0100
> 
> On Wed, Nov 30 2016, Eli Zaretskii wrote:
> 
> >> Yes, the TAGS file becomes at most twice as big.  That's a minor
> >> disadvantage that I'm happy to trade for even tiny improvements in
> >> precision.
> >
> > It clearly isn't a catastrophe, if doing that is necessary.  I just
> > want to be sure that all Forth tags need to be explicit.  Is there
> > perhaps some reasonably easy way to make only those tags explicit
> > which actually use the special characters that require it?
> 
> OK.  Here's an updated patch.  It calls make_tag instead of pfnote.
> make_tag tries to use implicit names if possible.  If it's not possible,
> it creates an explicit name.

Thanks, pushed to master.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-01 16:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 11:29 bug#25071: 26.0.50; Various Forth related improvements for etags Helmut Eller
2016-11-30 15:21 ` Eli Zaretskii
2016-11-30 16:55   ` Helmut Eller
2016-11-30 17:47     ` Eli Zaretskii
2016-11-30 19:32       ` Helmut Eller
2016-12-01 16:59         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).