Skip to content

Commit ac0c751

Browse files
committed
docs: document regex specification
- describe the change made in universal-ctags#3034 - a regex engine may be imported from gnulib (see universal-ctags#3054) - describe how regex engine is chosen - describe the GNU extensions and discourages its use.
1 parent 184dbdf commit ac0c751

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/optlib.rst

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,29 @@ thus easily become a built-in parser. See ":ref:`optlib2c`" for details.
3333
Regular expression (regex) engine
3434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3535

36-
Universal Ctags currently uses the same regex engine as Exuberant Ctags:
37-
the POSIX.2 regex engine in GNU glibc-2.10.1. By default it uses the Extended
38-
Regular Expressions (ERE) syntax, as used by most engines today; however it does
36+
Universal Ctags currently uses `the POSIX.1 Extended Regular Expressions (ERE)
37+
<https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html>`_
38+
syntax as same as Exuberant Ctags.
39+
40+
During building Universal Ctags the ``configure`` script runs compatibility
41+
tests of the regex engine in the system library. If tests pass the engine is
42+
used, otherwise the regex engine imported from `the GNU Gnulib library
43+
<https://www.gnu.org/software/gnulib/manual/gnulib.html#Regular-expressions>`_
44+
is used. In the latter case, ``ctags --list-features`` will contain
45+
``gnulib_regex``.
46+
47+
See ``regex(7)`` or `the GNU Gnulib Manual
48+
<https://www.gnu.org/software/gnulib/manual/gnulib.html#Regular-expressions>`_
49+
for the details of the regular expression syntax.
50+
51+
.. note::
52+
53+
The GNU regex engine supports some GNU extensions described `here
54+
<https://www.gnu.org/software/gnulib/manual/gnulib.html#posix_002dextended-regular-expression-syntax>`_.
55+
Note that an optlib parser using the extensions may not work with Universal
56+
Ctags on some other systems.
57+
58+
The POSIX.1 Extended Regular Expressions (ERE) does
3959
*not* support many of the "modern" extensions such as lazy captures,
4060
non-capturing grouping, atomic grouping, possessive quantifiers, look-ahead/behind,
4161
etc. It is also notoriously slow when backtracking, and has some known "quirks"

0 commit comments

Comments
 (0)