diff options
| author | Helmut Eller | 2016-12-01 18:58:08 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-12-01 18:58:08 +0200 |
| commit | bb8e38273e701ad5c65e747e8eda3bd8f3aa4adb (patch) | |
| tree | 65d93db7be87b84dfe713f2af3b4fa25fb6ad380 /lib-src | |
| parent | 2f68cb3e0502a9dc69613e97a5a5079ebf9249fb (diff) | |
| download | emacs-bb8e38273e701ad5c65e747e8eda3bd8f3aa4adb.tar.gz emacs-bb8e38273e701ad5c65e747e8eda3bd8f3aa4adb.zip | |
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) | |||
| 5469 | do /* skip to ) or eol */ | 5469 | do /* skip to ) or eol */ |
| 5470 | bp++; | 5470 | bp++; |
| 5471 | while (*bp != ')' && *bp != '\0'); | 5471 | while (*bp != ')' && *bp != '\0'); |
| 5472 | else if ((bp[0] == ':' && c_isspace (bp[1]) && bp++) | 5472 | else if (((bp[0] == ':' && c_isspace (bp[1]) && bp++) |
| 5473 | || LOOKING_AT_NOCASE (bp, "constant") | 5473 | || LOOKING_AT_NOCASE (bp, "constant") |
| 5474 | || LOOKING_AT_NOCASE (bp, "code") | 5474 | || LOOKING_AT_NOCASE (bp, "2constant") |
| 5475 | || LOOKING_AT_NOCASE (bp, "create") | 5475 | || LOOKING_AT_NOCASE (bp, "fconstant") |
| 5476 | || LOOKING_AT_NOCASE (bp, "defer") | 5476 | || LOOKING_AT_NOCASE (bp, "code") |
| 5477 | || LOOKING_AT_NOCASE (bp, "value") | 5477 | || LOOKING_AT_NOCASE (bp, "create") |
| 5478 | || LOOKING_AT_NOCASE (bp, "variable") | 5478 | || LOOKING_AT_NOCASE (bp, "defer") |
| 5479 | || LOOKING_AT_NOCASE (bp, "buffer:") | 5479 | || LOOKING_AT_NOCASE (bp, "value") |
| 5480 | || LOOKING_AT_NOCASE (bp, "field")) | 5480 | || LOOKING_AT_NOCASE (bp, "2value") |
| 5481 | get_tag (skip_spaces (bp), NULL); /* Yay! A definition! */ | 5481 | || LOOKING_AT_NOCASE (bp, "fvalue") |
| 5482 | || LOOKING_AT_NOCASE (bp, "variable") | ||
| 5483 | || LOOKING_AT_NOCASE (bp, "2variable") | ||
| 5484 | || LOOKING_AT_NOCASE (bp, "fvariable") | ||
| 5485 | || LOOKING_AT_NOCASE (bp, "buffer:") | ||
| 5486 | || LOOKING_AT_NOCASE (bp, "field:") | ||
| 5487 | || LOOKING_AT_NOCASE (bp, "+field") | ||
| 5488 | || LOOKING_AT_NOCASE (bp, "field") /* not standard? */ | ||
| 5489 | || LOOKING_AT_NOCASE (bp, "begin-structure") | ||
| 5490 | || LOOKING_AT_NOCASE (bp, "synonym") | ||
| 5491 | ) | ||
| 5492 | && c_isspace (bp[0])) | ||
| 5493 | { | ||
| 5494 | /* Yay! A definition! */ | ||
| 5495 | char* name_start = skip_spaces (bp); | ||
| 5496 | char* name_end = skip_non_spaces (name_start); | ||
| 5497 | if (name_start < name_end) | ||
| 5498 | make_tag (name_start, name_end - name_start, | ||
| 5499 | true, lb.buffer, name_end - lb.buffer, | ||
| 5500 | lineno, linecharno); | ||
| 5501 | bp = name_end; | ||
| 5502 | } | ||
| 5482 | else | 5503 | else |
| 5483 | bp = skip_non_spaces (bp); | 5504 | bp = skip_non_spaces (bp); |
| 5484 | } | 5505 | } |