From 8b67872465026c8a36f46c94ab7c3c9cf281ba79 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 8 Jun 2022 13:23:57 +0000 Subject: Surprisingly, every escape sequence can also be used as an argument delimiter for an outer escape sequence, in which case the delimiting escape sequence retains its syntax but usually ignores its argument and loses its inherent effect. Add rudimentary support for this syntax quirk in order to improve parsing compatibility with groff. --- regress/char/C/Makefile | 6 +++++ regress/char/C/delim.in | 51 ++++++++++++++++++++++++++++++++++++++++++ regress/char/C/delim.out_ascii | 30 +++++++++++++++++++++++++ regress/char/C/delim.out_lint | 6 +++++ 4 files changed, 93 insertions(+) create mode 100644 regress/char/C/Makefile create mode 100644 regress/char/C/delim.in create mode 100644 regress/char/C/delim.out_ascii create mode 100644 regress/char/C/delim.out_lint (limited to 'regress/char/C') diff --git a/regress/char/C/Makefile b/regress/char/C/Makefile new file mode 100644 index 00000000..3d938fe7 --- /dev/null +++ b/regress/char/C/Makefile @@ -0,0 +1,6 @@ +# $OpenBSD: Makefile,v 1.1 2022/06/08 13:08:00 schwarze Exp $ + +REGRESS_TARGETS = delim +LINT_TARGETS = delim + +.include diff --git a/regress/char/C/delim.in b/regress/char/C/delim.in new file mode 100644 index 00000000..db010d22 --- /dev/null +++ b/regress/char/C/delim.in @@ -0,0 +1,51 @@ +.\" $OpenBSD: delim.in,v 1.1 2022/06/08 13:08:00 schwarze Exp $ +.Dd $Mdocdate$ +.Dt C-DELIM 1 +.Os +.Sh NAME +.Nm C-delim +.Nd argument delimiters for the C escape sequence +.Sh DESCRIPTION +empty: \C'' +.br +single byte: \C'_'\C'-' +.br +two bytes: \C'hy' +.br +multiple bytes: \C'integral' +.Ss Argument delimiters +unsupported \er: \C\rat\ru +.br +ignored \e&: \C\&at\&u +.br +useless \e.: \C\.at.u +.br +invalid \eG: \C\GatGu +.br +special \e-: \C\-at\-u +.br +break \ep: \C\pat\pu +.br +nospace \ec: \C\cat\cu +.\".br +.\"XXX skipchar \ec: \C\zat\zu +.br +.ds mystr xatxu +string expansion: \C\*[mystr] +.br +.nr myreg 1341 +register expansion: \C\n[myreg]u +.br +ignored \eON: \C\O1at\O2u +.br +special character: \C\(hyat\(hyu +.br +ignored \eZ\(aqstr\(aq: \C\Z'foo'at\Z'bar'u +.br +horizontal motion: \C\h'1'at\h'3'u +.br +horizontal line: \C\l'4'at\l'2'u +.br +overstrike: \C\o'ab'at\o'cd'u +.br +unterminated: \C'at diff --git a/regress/char/C/delim.out_ascii b/regress/char/C/delim.out_ascii new file mode 100644 index 00000000..7276d7c2 --- /dev/null +++ b/regress/char/C/delim.out_ascii @@ -0,0 +1,30 @@ +C-DELIM(1) General Commands Manual C-DELIM(1) + +NNAAMMEE + CC--ddeelliimm - argument delimiters for the C escape sequence + +DDEESSCCRRIIPPTTIIOONN + empty: + single byte: - + two bytes: - + multiple bytes: + + AArrgguummeenntt ddeelliimmiitteerrss + unsupported \r: @u + ignored \&: @u + useless \.: @u + invalid \G: @u + special \-: @u + break \p: @u + nospace \c: @u + string expansion: @u + register expansion: 3/4u + ignored \ON: @u + special character: @u + ignored \Z'str': @u + horizontal motion: @u + horizontal line: @u + overstrike: @u + unterminated: + +OpenBSD June 8, 2022 OpenBSD diff --git a/regress/char/C/delim.out_lint b/regress/char/C/delim.out_lint new file mode 100644 index 00000000..2dc23d44 --- /dev/null +++ b/regress/char/C/delim.out_lint @@ -0,0 +1,6 @@ +mandoc: delim.in:9:8: ERROR: invalid special character: \C'' +mandoc: delim.in:11:14: ERROR: invalid special character: \C'_' +mandoc: delim.in:17:20: UNSUPP: unsupported escape sequence: \r +mandoc: delim.in:17:24: UNSUPP: unsupported escape sequence: \r +mandoc: delim.in:23:16: WARNING: undefined escape, printing literally: \G +mandoc: delim.in:51:15: ERROR: incomplete escape sequence: \C'at -- cgit