From f1a1415f2ac83d7454ab33bab918fe77f90664bd 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/string/name.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'regress/roff/string/name.in') diff --git a/regress/roff/string/name.in b/regress/roff/string/name.in index 8e872529..3f412534 100644 --- a/regress/roff/string/name.in +++ b/regress/roff/string/name.in @@ -1,4 +1,4 @@ -.\" $OpenBSD: name.in,v 1.4 2017/07/04 14:53:27 schwarze Exp $ +.\" $OpenBSD: name.in,v 1.5 2022/06/03 11:50:25 schwarze Exp $ .Dd $Mdocdate$ .Dt STRING-NAME 1 .Os @@ -10,7 +10,9 @@ .ds "quot" value of "quot" .ds bs\e value of bs\ee .ds bs\\e value of bs\e\ee +.ds dot. value of dot. .ds bl\ e value of bl\e e +.ds inval\\G value of inval\eG norm: \*[norm] .br norm without closing brace: \*[norm @@ -26,6 +28,10 @@ bs\e\ee: \*[bs\\e] bse: \*[bse] .br bs: \*[bs] +.br +dot.: \*[dot.] +.br +dot\e.: \*[dot\.] .\".br .\"bl\e e: \*[bl\ e] .br @@ -34,3 +40,7 @@ bl e: \*[bl e] ble: \*[ble] .br bl: \*[bl] +.br +inval\e\eG: \*[inval\\G] +.br +inval\eG: \*[inval\G] -- cgit