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/cond/string.out_ascii | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'regress/roff/cond/string.out_ascii') diff --git a/regress/roff/cond/string.out_ascii b/regress/roff/cond/string.out_ascii index 2d80a903..c67c0c55 100644 --- a/regress/roff/cond/string.out_ascii +++ b/regress/roff/cond/string.out_ascii @@ -19,4 +19,10 @@ DDEESSCCRRIIPPTTIIOONN escape sequence after identifier: -mystr is defined -OpenBSD February 6, 2019 STRING(1) + backslash in name: \ is defined + + dot in name: . is defined \. is defined + + invalid escape in name: G is defined \G is defined + +OpenBSD June 3, 2022 STRING(1) -- cgit v1.2.3