]> git.cameronkatri.com Git - mandoc.git/commit
During identifier parsing, handle undefined escape sequences
authorIngo Schwarze <schwarze@openbsd.org>
Fri, 3 Jun 2022 12:15:55 +0000 (12:15 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Fri, 3 Jun 2022 12:15:55 +0000 (12:15 +0000)
commitccdf39d9cb63bb341dbb5c88c9090ac8e05b350c
tree8205e38fed18628857329eecdbd4fda63c7ae21d
parent3b52bb8d03ff61274832867c905a80a2761859aa
During identifier parsing, handle undefined escape sequences
in the same way as groff:
* \\ is always reduced to \
* \. is always reduced to .
* other undefined escape sequences are usually reduced to the escape name,
for example \G to G, except during the expansion of expanding escape
sequences having the standard argument form (in particular \* and \n),
in which case the backslash is preserved literally.

Yes, this is confusing indeed.
For example, the following have the same meaning:
* .ds \.   and   .ds .     which is not the same as   .ds \\.
* \*[\.]   and   \*[.]     which is not the same as   \*[\\.]
* .ds \G   and   .ds G     which is not the same as   .ds \\G
* \*[\G]   and   \*[\\G]   which is not the same as   \*[G]   <- sic!

To feel less dirty, have a leaning toothpick, if you are so inclined.

This patch also slightly improves the string shown by the "escaped
character not allowed in a name" error message.
18 files changed:
regress/roff/args/man.out_lint
regress/roff/args/mdoc.out_lint
regress/roff/cond/register.in
regress/roff/cond/register.out_ascii
regress/roff/cond/string.in
regress/roff/cond/string.out_ascii
regress/roff/de/escname.in
regress/roff/de/escname.out_ascii
regress/roff/de/escname.out_lint
regress/roff/ds/Makefile
regress/roff/nr/escname.in
regress/roff/nr/escname.out_ascii
regress/roff/nr/escname.out_lint
regress/roff/string/Makefile
regress/roff/string/name.in
regress/roff/string/name.out_ascii
regress/roff/string/name.out_lint
roff.c