summaryrefslogtreecommitdiffstats
path: root/regress/char/N
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-06-08 13:23:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-06-08 13:23:57 +0000
commit8b67872465026c8a36f46c94ab7c3c9cf281ba79 (patch)
tree23a341c363e8430f41e73eaa3f7b2faed547674a /regress/char/N
parenta20dce04f17b9130249adc2db887746a87808270 (diff)
downloadmandoc-8b67872465026c8a36f46c94ab7c3c9cf281ba79.tar.gz
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.
Diffstat (limited to 'regress/char/N')
-rw-r--r--regress/char/N/Makefile5
-rw-r--r--regress/char/N/basic.out_lint1
-rw-r--r--regress/char/N/delim.in101
-rw-r--r--regress/char/N/delim.out_ascii52
-rw-r--r--regress/char/N/delim.out_lint29
5 files changed, 186 insertions, 2 deletions
diff --git a/regress/char/N/Makefile b/regress/char/N/Makefile
index 3630b154..30b19147 100644
--- a/regress/char/N/Makefile
+++ b/regress/char/N/Makefile
@@ -1,5 +1,6 @@
-# $OpenBSD: Makefile,v 1.2 2011/11/17 16:28:45 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2022/06/08 13:08:00 schwarze Exp $
-REGRESS_TARGETS=basic
+REGRESS_TARGETS = basic delim
+LINT_TARGETS = basic delim
.include <bsd.regress.mk>
diff --git a/regress/char/N/basic.out_lint b/regress/char/N/basic.out_lint
new file mode 100644
index 00000000..2dd8bb90
--- /dev/null
+++ b/regress/char/N/basic.out_lint
@@ -0,0 +1 @@
+mandoc: basic.in:23:14: ERROR: invalid escape argument delimiter: \N6
diff --git a/regress/char/N/delim.in b/regress/char/N/delim.in
new file mode 100644
index 00000000..b72dd4c7
--- /dev/null
+++ b/regress/char/N/delim.in
@@ -0,0 +1,101 @@
+.\" $OpenBSD: delim.in,v 1.1 2022/06/08 13:08:00 schwarze Exp $
+.Dd $Mdocdate$
+.Dt N-DELIM 1
+.Os
+.Sh NAME
+.Nm N-delim
+.Nd argument delimiters for the N escape sequence
+.Sh DESCRIPTION
+unsupported \e!: \N\!42\!u
+.br
+unsupported \er: \N\r42u
+.br
+ignored \e%: \N\%42\%u
+.br
+ignored \e&: \N\&42\&u
+.br
+ignored \e): \N\)42\)u
+.br
+ignored \e,: \N\,42\,u
+.br
+ignored \e/: \N\/42\/u
+.br
+ignored \e^: \N\^42\^u
+.br
+ignored \ea: \N\a42\au
+.br
+ignored \ed: \N\d42\du
+.br
+ignored \et: \N\t42\tu
+.br
+ignored \eu: \N\u42\uu
+.br
+ignored \e{: \N\{42\{u
+.br
+ignored \e|: \N\|42\|u
+.br
+ignored \e}: \N\}42\}u
+.br
+useless \e.: \N\.42.u
+.\".br
+.\"XXX useless \e\e: \N\\42\\u
+.br
+invalid \eG: \N\G42Gu
+.br
+special \e\ : \N\ 42\ u
+.br
+special \e\(aq: \N\'42\'u
+.br
+special \e-: \N\-42\-u
+.br
+special \e0: \N\042\0u
+.br
+special \e:: \N\:42\:u
+.br
+special \e_: \N\_42\_u
+.br
+special \e\(ga: \N\`42\`u
+.br
+special \ee: \N\e42\eu
+.br
+special \e~: \N\~42\~u
+.br
+break \ep: \N\p42\pu
+.br
+nospace \ec: \N\c42\cu
+.\".br
+.\"XXX skipchar \ez: \N\z42\zu
+.br
+.ds mystr x42xu
+string expansion: \N\*[mystr]
+.br
+.nr myreg 23
+register expansion: \N\n[myreg]u
+.br
+ignored \eO: \N\O142\O2u
+.br
+ignored \eY: \N\Y[mystr]42\Y[mystr]u
+.br
+ignored \ek: \N\k[myreg]42\k[myreg]u
+.br
+special character: \N\(hy42\(hyu
+.br
+ignored \eD: \N\D't 1'42\D't 2'u
+.br
+ignored \eL: \N\L'2'42u
+.br
+ignored \eX: \N\X'foo'42\X'bar'u
+.br
+ignored \eZ: \N\Z'foo'42\Z''u
+.br
+ignored \eb: \N\b'2'42\b''u
+.br
+ignored \ev: \N\v'2'42\v'0'u
+.br
+ignored \ex: \N\x'2'42\v'0'u
+.br
+horizontal motion: \N\h'1'42\h'3'u
+.br
+horizontal line: \N\l'4'42\l'2'u
+.br
+overstrike: \N\o'ab'42\o'cd'u
diff --git a/regress/char/N/delim.out_ascii b/regress/char/N/delim.out_ascii
new file mode 100644
index 00000000..4e7cb1c2
--- /dev/null
+++ b/regress/char/N/delim.out_ascii
@@ -0,0 +1,52 @@
+N-DELIM(1) General Commands Manual N-DELIM(1)
+
+NNAAMMEE
+ NN--ddeelliimm - argument delimiters for the N escape sequence
+
+DDEESSCCRRIIPPTTIIOONN
+ unsupported \!: *u
+ unsupported \r: 42u
+ ignored \%: *u
+ ignored \&: *u
+ ignored \): *u
+ ignored \,: 42u
+ ignored \/: *u
+ ignored \^: 42u
+ ignored \a: 42u
+ ignored \d: 42u
+ ignored \t: 42u
+ ignored \u: 42u
+ ignored \{: *u
+ ignored \|: 42u
+ ignored \}: *u
+ useless \.: 42.u
+ invalid \G: *u
+ special \ : 42 u
+ special \': *u
+ special \-: *u
+ special \0: 42 u
+ special \:: *u
+ special \_: *u
+ special \`: *u
+ special \e: *u
+ special \~: 42 u
+ break \p: *u
+ nospace \c: *u
+ string expansion: *u
+ register expansion: 3u
+ ignored \O: 42u
+ ignored \Y: 42u
+ ignored \k: *u
+ special character: *u
+ ignored \D: 42u
+ ignored \L: 42u
+ ignored \X: 42u
+ ignored \Z: 42u
+ ignored \b: 42u
+ ignored \v: 42u
+ ignored \x: 42u
+ horizontal motion: 42 u
+ horizontal line: 42__u
+ overstrike: 42cdu
+
+OpenBSD June 8, 2022 OpenBSD
diff --git a/regress/char/N/delim.out_lint b/regress/char/N/delim.out_lint
new file mode 100644
index 00000000..698c58c3
--- /dev/null
+++ b/regress/char/N/delim.out_lint
@@ -0,0 +1,29 @@
+mandoc: delim.in:9:20: UNSUPP: unsupported escape sequence: \!
+mandoc: delim.in:9:24: UNSUPP: unsupported escape sequence: \!
+mandoc: delim.in:11:20: UNSUPP: unsupported escape sequence: \r
+mandoc: delim.in:11:18: ERROR: invalid escape argument delimiter: \N\r
+mandoc: delim.in:19:14: ERROR: invalid escape argument delimiter: \N\,
+mandoc: delim.in:23:14: ERROR: invalid escape argument delimiter: \N\^
+mandoc: delim.in:25:14: ERROR: invalid escape argument delimiter: \N\a
+mandoc: delim.in:27:14: ERROR: invalid escape argument delimiter: \N\d
+mandoc: delim.in:29:14: ERROR: invalid escape argument delimiter: \N\t
+mandoc: delim.in:31:14: ERROR: invalid escape argument delimiter: \N\u
+mandoc: delim.in:35:14: ERROR: invalid escape argument delimiter: \N\|
+mandoc: delim.in:39:14: ERROR: invalid escape argument delimiter: \N\.
+mandoc: delim.in:43:16: WARNING: undefined escape, printing literally: \G
+mandoc: delim.in:45:15: ERROR: invalid escape argument delimiter: \N\
+mandoc: delim.in:51:14: ERROR: invalid escape argument delimiter: \N\0
+mandoc: delim.in:61:14: ERROR: invalid escape argument delimiter: \N\~
+mandoc: delim.in:73:21: ERROR: invalid escape argument delimiter: \N2
+mandoc: delim.in:75:14: ERROR: invalid escape argument delimiter: \N\O1
+mandoc: delim.in:77:14: ERROR: invalid escape argument delimiter: \N\Y[mystr]
+mandoc: delim.in:83:14: ERROR: invalid escape argument delimiter: \N\D't 1'
+mandoc: delim.in:85:14: ERROR: invalid escape argument delimiter: \N\L'2'
+mandoc: delim.in:87:14: ERROR: invalid escape argument delimiter: \N\X'foo'
+mandoc: delim.in:89:14: ERROR: invalid escape argument delimiter: \N\Z'foo'
+mandoc: delim.in:91:14: ERROR: invalid escape argument delimiter: \N\b'2'
+mandoc: delim.in:93:14: ERROR: invalid escape argument delimiter: \N\v'2'
+mandoc: delim.in:95:14: ERROR: invalid escape argument delimiter: \N\x'2'
+mandoc: delim.in:97:20: ERROR: invalid escape argument delimiter: \N\h'1'
+mandoc: delim.in:99:18: ERROR: invalid escape argument delimiter: \N\l'4'
+mandoc: delim.in:101:13: ERROR: invalid escape argument delimiter: \N\o'ab'