diff options
author | Helmut Eller <eller.helmut@gmail.com> | 2016-12-01 18:58:08 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-12-01 18:58:08 +0200 |
commit | bb8e38273e701ad5c65e747e8eda3bd8f3aa4adb (patch) | |
tree | 65d93db7be87b84dfe713f2af3b4fa25fb6ad380 /lib-src | |
parent | 2f68cb3e0502a9dc69613e97a5a5079ebf9249fb (diff) |
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.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/etags.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 6a722e0641c..7baa2a3e39f 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); } |