Skip to content

Commit

Permalink
Merge pull request #3591 from masatake/parser-versioning-prep
Browse files Browse the repository at this point in the history
*: parser versioning preparations
  • Loading branch information
masatake authored Dec 8, 2022
2 parents 0b050ca + 63fffd8 commit 1a9f953
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
22 changes: 13 additions & 9 deletions docs/man/ctags-client-tools.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ An example of a pseudo tag::

!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/

The value, "2", associated with the pseudo tag "TAG_PROGRAM_NAME", is
The value, "Universal Ctags", associated with the pseudo tag ``TAG_PROGRAM_NAME``, is
used in the field for input file. The description, "Derived from
Exuberant Ctags", is used in the field for pattern.

Expand All @@ -63,7 +63,7 @@ This pseudo-tag says "the function kind of C language is enabled
when generating this tags file." ``--pseudo-tags`` is the option for
enabling/disabling individual pseudo-tags. When enabling/disabling a
pseudo tag with the option, specify the tag name only
"TAG_KIND_DESCRIPTION", without the prefix ("!_") or the suffix ("!C").
``TAG_KIND_DESCRIPTION``, without the prefix ("!_") or the suffix ("!C").


Options for Pseudo-tags
Expand Down Expand Up @@ -245,7 +245,10 @@ for using notable ones.
``TAG_PROC_CWD`` gives the tool a hint; "input.c" may be at "/tmp".

``TAG_PROGRAM_NAME``
TBW
Indicates the name of program generating this tags file.

``TAG_PROGRAM_VERSION``
Indicates the version of program generating this tags file.

``TAG_ROLE_DESCRIPTION`` (new in Universal Ctags)
Indicates the names and descriptions of enabled roles::
Expand Down Expand Up @@ -367,11 +370,11 @@ Client tools could split the line using the following steps:
* If a ``?`` follows, then the pattern delimiter is ``?``.
* If a number follows, then:

* If a ``;/`` follows the number, then the delimiter is ``/``.
* If a ``;?`` follows the number, then the delimiter is ``?``.
* If a ``;"`` follows the number, then the field uses only line number, and
there's no pattern delimiter (since there's no regex pattern). In this
case the pattern field ends at the 3rd tab.
* If a ``;/`` follows the number, then the delimiter is ``/``.
* If a ``;?`` follows the number, then the delimiter is ``?``.
* If a ``;"`` follows the number, then the field uses only line number, and
there's no pattern delimiter (since there's no regex pattern). In this
case the pattern field ends at the 3rd tab.

* After the opening delimiter, find the next unescaped pattern delimiter, and
that's the closing delimiter. It will be followed by ``;"`` and then a tab.
Expand Down Expand Up @@ -477,7 +480,8 @@ CHANGES

Version 6.0
~~~~~~~~~~~
* ctags enables TAG_{KIND,EXTRA,FIELD,ROLE}_DESCRIPTION pseudo tags by default.
* ctags enables ``TAG_KIND_DESCRIPTION``, ``TAG_ROLE_DESCRIPTION``,
``TAG_FIELD_DESCRIPTION``, and ``TAG_EXTRA_DESCRIPTION`` pseudo tags by default.

SEE ALSO
--------
Expand Down
18 changes: 14 additions & 4 deletions main/writer-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@
#ifdef HAVE_JANSSON
#include <jansson.h>

#define JSON_WRITER_MAJOR 0
#define JSON_WRITER_MINOR 0
/* The concept of CURRENT and AGE is taken from libtool.
* However, we delete REVISION.
* We will update more CURRENT frequently than the assumption
* in libtool.
*
* If KEYS have been added, removed or changed since last release,
* increment CURRENT.
* If they have been added since last release, increment AGE.
* If they have been removed since last release, set AGE to 0
*/
#define JSON_WRITER_CURRENT 0
#define JSON_WRITER_AGE 0

#ifndef json_boolean /* compat with jansson < 2.4 */
#define json_boolean(val) ((val) ? json_true() : json_false())
Expand Down Expand Up @@ -243,7 +253,7 @@ static int writeJsonPtagEntry (tagWriter *writer CTAGS_ATTR_UNUSED,
json_t *response;
char *parserName0 = NULL;

const char *rest = ((JSON_WRITER_MAJOR > 0) && parserName && desc->jsonObjectKey)
const char *rest = ((JSON_WRITER_CURRENT > 0) && parserName && desc->jsonObjectKey)
? strchr(parserName, '!')
: NULL;
if (rest)
Expand Down Expand Up @@ -290,7 +300,7 @@ extern bool ptagMakeJsonOutputVersion (ptagDesc *desc, langType language CTAGS_A
const void *data CTAGS_ATTR_UNUSED)
{
return writePseudoTag (desc,
STRINGIFY(JSON_WRITER_MAJOR) "." STRINGIFY(JSON_WRITER_MINOR),
STRINGIFY(JSON_WRITER_CURRENT) "." STRINGIFY(JSON_WRITER_AGE),
"in development",
NULL);
}
Expand Down
22 changes: 13 additions & 9 deletions man/ctags-client-tools.7.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ An example of a pseudo tag::

!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/

The value, "2", associated with the pseudo tag "TAG_PROGRAM_NAME", is
The value, "Universal Ctags", associated with the pseudo tag ``TAG_PROGRAM_NAME``, is
used in the field for input file. The description, "Derived from
Exuberant Ctags", is used in the field for pattern.

Expand All @@ -63,7 +63,7 @@ This pseudo-tag says "the function kind of C language is enabled
when generating this tags file." ``--pseudo-tags`` is the option for
enabling/disabling individual pseudo-tags. When enabling/disabling a
pseudo tag with the option, specify the tag name only
"TAG_KIND_DESCRIPTION", without the prefix ("!_") or the suffix ("!C").
``TAG_KIND_DESCRIPTION``, without the prefix ("!_") or the suffix ("!C").


Options for Pseudo-tags
Expand Down Expand Up @@ -245,7 +245,10 @@ for using notable ones.
``TAG_PROC_CWD`` gives the tool a hint; "input.c" may be at "/tmp".

``TAG_PROGRAM_NAME``
TBW
Indicates the name of program generating this tags file.

``TAG_PROGRAM_VERSION``
Indicates the version of program generating this tags file.

``TAG_ROLE_DESCRIPTION`` (new in Universal Ctags)
Indicates the names and descriptions of enabled roles::
Expand Down Expand Up @@ -367,11 +370,11 @@ Client tools could split the line using the following steps:
* If a ``?`` follows, then the pattern delimiter is ``?``.
* If a number follows, then:

* If a ``;/`` follows the number, then the delimiter is ``/``.
* If a ``;?`` follows the number, then the delimiter is ``?``.
* If a ``;"`` follows the number, then the field uses only line number, and
there's no pattern delimiter (since there's no regex pattern). In this
case the pattern field ends at the 3rd tab.
* If a ``;/`` follows the number, then the delimiter is ``/``.
* If a ``;?`` follows the number, then the delimiter is ``?``.
* If a ``;"`` follows the number, then the field uses only line number, and
there's no pattern delimiter (since there's no regex pattern). In this
case the pattern field ends at the 3rd tab.

* After the opening delimiter, find the next unescaped pattern delimiter, and
that's the closing delimiter. It will be followed by ``;"`` and then a tab.
Expand Down Expand Up @@ -477,7 +480,8 @@ CHANGES

Version 6.0
~~~~~~~~~~~
* ctags enables TAG_{KIND,EXTRA,FIELD,ROLE}_DESCRIPTION pseudo tags by default.
* ctags enables ``TAG_KIND_DESCRIPTION``, ``TAG_ROLE_DESCRIPTION``,
``TAG_FIELD_DESCRIPTION``, and ``TAG_EXTRA_DESCRIPTION`` pseudo tags by default.

SEE ALSO
--------
Expand Down

0 comments on commit 1a9f953

Please sign in to comment.