From 77721094d0f27b24f94bdf4d2625404abba6875b Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 11 Jun 2020 22:26:42 +0900 Subject: [PATCH 1/2] docs(man): write about anonymous extra tag Signed-off-by: Masatake YAMATO --- docs/man/ctags.1.rst | 28 ++++++++++++++++++++++++++++ man/ctags.1.rst.in | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/docs/man/ctags.1.rst b/docs/man/ctags.1.rst index caeb2e106e..3ae4a24d14 100644 --- a/docs/man/ctags.1.rst +++ b/docs/man/ctags.1.rst @@ -477,6 +477,34 @@ are not listed here. They are experimental or for debugging purpose. The meaning of major extras is as follows (one-letter flag/long-name flag): + /anonymous + Include an entry for the language object that has no name like lambda + function. This extra has no one-letter flag and is enabled by + default. The extra tag is useful as a placeholder to fill scope fields + for language objects defined in a language object with no name. + + .. code-block:: C + + struct { + double x, y; + } p = { .x = 0.0, .y = 0.0 }; + + "x" and "y" are the members of a structure. When filling the scope + fields for them, ctags gets trouble because the struct + where "x" and "y" belong to has no name. For overcoming the truble, + ctags generates an anonymous extra tag for the struct + and fills the scope fields with the name of the extra tag. + + .. code-block:: + + __anon9f26d2460108 input.c /^struct {$/;" s + p input.c /^} p = { .x = 0.0, .y = 0.0 };$/;" v typeref:struct:__anon9f26d2460108 + x input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 + y input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 + + The above tag output has "__anon9f26d2460108" as an anonymous extra tag. + The typeref field of "p" also receives the benefit of it. + F/fileScope Indicates whether tags scoped only for a single file (i.e. tags which cannot be seen outside of the file in which they are defined, such as diff --git a/man/ctags.1.rst.in b/man/ctags.1.rst.in index 289ae88b5d..14d4f1b094 100644 --- a/man/ctags.1.rst.in +++ b/man/ctags.1.rst.in @@ -477,6 +477,34 @@ are not listed here. They are experimental or for debugging purpose. The meaning of major extras is as follows (one-letter flag/long-name flag): + /anonymous + Include an entry for the language object that has no name like lambda + function. This extra has no one-letter flag and is enabled by + default. The extra tag is useful as a placeholder to fill scope fields + for language objects defined in a language object with no name. + + .. code-block:: C + + struct { + double x, y; + } p = { .x = 0.0, .y = 0.0 }; + + "x" and "y" are the members of a structure. When filling the scope + fields for them, @CTAGS_NAME_EXECUTABLE@ gets trouble because the struct + where "x" and "y" belong to has no name. For overcoming the truble, + @CTAGS_NAME_EXECUTABLE@ generates an anonymous extra tag for the struct + and fills the scope fields with the name of the extra tag. + + .. code-block:: + + __anon9f26d2460108 input.c /^struct {$/;" s + p input.c /^} p = { .x = 0.0, .y = 0.0 };$/;" v typeref:struct:__anon9f26d2460108 + x input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 + y input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 + + The above tag output has "__anon9f26d2460108" as an anonymous extra tag. + The typeref field of "p" also receives the benefit of it. + F/fileScope Indicates whether tags scoped only for a single file (i.e. tags which cannot be seen outside of the file in which they are defined, such as From c23089c6396295f82ea266d574a41853f75cffb8 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 14 Jun 2020 00:31:01 +0900 Subject: [PATCH 2/2] docs(man): apply suggestions from code review Suggested by @polyzen. Co-authored-by: Daniel M. Capella Signed-off-by: Masatake YAMATO --- docs/man/ctags.1.rst | 4 ++-- man/ctags.1.rst.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/man/ctags.1.rst b/docs/man/ctags.1.rst index 3ae4a24d14..0bbece7f24 100644 --- a/docs/man/ctags.1.rst +++ b/docs/man/ctags.1.rst @@ -490,8 +490,8 @@ are not listed here. They are experimental or for debugging purpose. } p = { .x = 0.0, .y = 0.0 }; "x" and "y" are the members of a structure. When filling the scope - fields for them, ctags gets trouble because the struct - where "x" and "y" belong to has no name. For overcoming the truble, + fields for them, ctags has trouble because the struct + where "x" and "y" belong to has no name. For overcoming the trouble, ctags generates an anonymous extra tag for the struct and fills the scope fields with the name of the extra tag. diff --git a/man/ctags.1.rst.in b/man/ctags.1.rst.in index 14d4f1b094..15ebd58122 100644 --- a/man/ctags.1.rst.in +++ b/man/ctags.1.rst.in @@ -490,8 +490,8 @@ are not listed here. They are experimental or for debugging purpose. } p = { .x = 0.0, .y = 0.0 }; "x" and "y" are the members of a structure. When filling the scope - fields for them, @CTAGS_NAME_EXECUTABLE@ gets trouble because the struct - where "x" and "y" belong to has no name. For overcoming the truble, + fields for them, @CTAGS_NAME_EXECUTABLE@ has trouble because the struct + where "x" and "y" belong to has no name. For overcoming the trouble, @CTAGS_NAME_EXECUTABLE@ generates an anonymous extra tag for the struct and fills the scope fields with the name of the extra tag.