From ccdf39d9cb63bb341dbb5c88c9090ac8e05b350c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 3 Jun 2022 12:15:55 +0000 Subject: 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. --- regress/roff/nr/escname.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'regress/roff/nr/escname.in') diff --git a/regress/roff/nr/escname.in b/regress/roff/nr/escname.in index f81627e1..d4625552 100644 --- a/regress/roff/nr/escname.in +++ b/regress/roff/nr/escname.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: escname.in,v 1.3 2017/07/04 14:53:27 schwarze Exp $ -.TH NR-ESCNAME 1 "June 29, 2014" +.\" $OpenBSD: escname.in,v 1.4 2022/06/03 11:50:25 schwarze Exp $ +.TH NR-ESCNAME 1 "June 3, 2022" .SH NAME nr-escname \- escape sequences in register names .SH DESCRIPTION @@ -7,7 +7,9 @@ nr-escname \- escape sequences in register names .nr second 2 .nr first\\second 3 .nr first\esecond 4 -\n[first] \n[second] \n[first\\second] +.nr first\.second 5 +.nr first\Gsecond 6 +\n[first] \n[second] \n[first\\second] \n[first.second] \n[firstGsecond] .PP .rr first\esecond \n[first] \n[second] \n[first\\second] -- cgit v1.2.3-56-ge451