I just noticed while working on Emacs's whitespace.el that Emacs’s syntax
coloring does not color the sequence “\\{” specially in a string, though it
recognises other regexp metacharacters such as “\\(”.

I looked in the Emacs manuals, and found no mention of braces as a special
character, despite the fact that they’re already used in
whitespace-space-after-tab-regexp, for example; and of course, when I
looked in the source code, I found the support there, as one would
expect, in src/regex.c.

The definitive documentation for the GNU regex implementation, as far as I
know, is in gnulib’s doc/regex.texi, but as that file says:

  We wrote this chapter with programmers in mind, not users of
  programs---such as Emacs---that use Regex.  We describe the Regex
  library in its entirety, not how to write regular expressions that a
  particular program understands.

Since the regexp code is widely used, with mechanically-defined syntax
variants, in GNU grep, GNU sed etc., it would seem possible to have a
mechanically-generated manual, which takes a set of GNU regexp syntax
flags, as taken by re_set_syntax, and spits out suitably-configured
documentation.

This could be either incorporated into other programs' manuals, or, perhaps
better, supplied as standalone info files and man pages, suitable for
cross-referencing from other programs' manuals, rather like a user-level
version of the current gnulib/regex.texi.

In principle it would be possible to compile a manual for every possible
syntax variant, but in practice I imagine one would want to supply one for
POSIX BREs and EREs, GNU-extended EREs (i.e. GNU egrep syntax) and Emacs.

-- 
http://rrt.sc3d.org

Reply via email to