aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-08-03 11:02:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-08-03 11:02:57 +0000
commit16d4788cef7bb58fdc8820bdd5ecb511933f0d15 (patch)
treebf3311df1f25ef3a44bb86fa7d6dfb9b27370aba /regress
parent53d5687049e8bdb3b568febbdf4ed19da4e1a95f (diff)
downloadmandoc-16d4788cef7bb58fdc8820bdd5ecb511933f0d15.tar.gz
mandoc-16d4788cef7bb58fdc8820bdd5ecb511933f0d15.tar.zst
mandoc-16d4788cef7bb58fdc8820bdd5ecb511933f0d15.zip
Put the code handling \} into a new function roff_cond_checkend()
and call that function not only from both places where copies existed - when processing text lines and when processing request/macro lines in conditional block scope - but also when closing a macro definition request, such that this construction works: .if n \{.de macroname macro content .. \} ignored arguments .macroname This fixes a bug reported by John Gardner <gardnerjohng at gmail dot com>. While here, avoid a confusing decrement of the line scope counter in roffnode_cleanscope() for conditional blocks that do not have line scope in the first place (no functional change for this part). Also improve validation of an internal invariant in roff_cblock() and polish some comments.
Diffstat (limited to 'regress')
-rw-r--r--regress/roff/cond/Makefile6
-rw-r--r--regress/roff/cond/close.in39
-rw-r--r--regress/roff/cond/close.out_ascii17
-rw-r--r--regress/roff/cond/close.out_lint5
-rw-r--r--regress/roff/cond/de.in19
-rw-r--r--regress/roff/cond/de.out_ascii13
-rw-r--r--regress/roff/cond/de.out_lint2
7 files changed, 95 insertions, 6 deletions
diff --git a/regress/roff/cond/Makefile b/regress/roff/cond/Makefile
index 65d7be52..758049cf 100644
--- a/regress/roff/cond/Makefile
+++ b/regress/roff/cond/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.8 2015/05/31 23:12:17 schwarze Exp $
+# $OpenBSD: Makefile,v 1.10 2020/08/03 10:52:39 schwarze Exp $
-REGRESS_TARGETS = if ie close numeric register strcmp string before-Dd
-LINT_TARGETS = if close
+REGRESS_TARGETS = if ie close de numeric register strcmp string before-Dd
+LINT_TARGETS = if close de
.include <bsd.regress.mk>
diff --git a/regress/roff/cond/close.in b/regress/roff/cond/close.in
index 74b402c8..3702002d 100644
--- a/regress/roff/cond/close.in
+++ b/regress/roff/cond/close.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: close.in,v 1.3 2017/07/04 14:53:26 schwarze Exp $
+.\" $OpenBSD: close.in,v 1.5 2020/08/03 10:52:39 schwarze Exp $
.TH COND-CLOSE 1 "November 26, 2018"
.SH NAME
cond-close \- closing conditional macros
@@ -12,6 +12,22 @@ closing after an ignored macro
.if t \{text \}
closing after plain text
.PP
+.if t \{text
+\}
+text line contains closing brace only
+.PP
+.if t \{text
+\} plus something
+text line contains closing brace and additional words
+.PP
+.if t \{text
+.\}
+request line contains closing brace only
+.PP
+.if t \{text
+.\}with following args
+request line contains closing brace and additional args
+.PP
.if n \{conditional content \} following words with whitespace
.PP
.if n \{conditional content\}following words without whitespace
@@ -28,5 +44,26 @@ non-standard multi-line style
\}
following words
.PP
+preceding words
+.if n \{text line block end
+\} with additional words
+following words
+.PP
+.if n \{two
+.if n \{closes
+on\} the\} same
+text line
+.PP
+preceding words
+.if n \{close on request line
+.\}with following args
+following words
+.PP
+preceding words
+.if n \{two
+.if n \{closes
+.BR\}on\}the same
+macro line
+.PP
.if n \{
still open at the end of the file
diff --git a/regress/roff/cond/close.out_ascii b/regress/roff/cond/close.out_ascii
index d049154d..63484540 100644
--- a/regress/roff/cond/close.out_ascii
+++ b/regress/roff/cond/close.out_ascii
@@ -12,6 +12,14 @@ DDEESSCCRRIIPPTTIIOONN
closing after plain text
+ text line contains closing brace only
+
+ text line contains closing brace and additional words
+
+ request line contains closing brace only
+
+ request line contains closing brace and additional args
+
conditional content following words with whitespace
conditional contentfollowing words without whitespace
@@ -22,6 +30,15 @@ DDEESSCCRRIIPPTTIIOONN
non-standard multi-line style following words
+ preceding words text line block end with additional words following
+ words
+
+ two closes on the same text line
+
+ preceding words close on request line following words
+
+ preceding words two closes oonntthheesame macro line
+
still open at the end of the file
diff --git a/regress/roff/cond/close.out_lint b/regress/roff/cond/close.out_lint
index d6f52146..26262524 100644
--- a/regress/roff/cond/close.out_lint
+++ b/regress/roff/cond/close.out_lint
@@ -1,2 +1,3 @@
-mandoc: close.in:31:2: ERROR: appending missing end of block: if
-mandoc: close.in:31:9: WARNING: skipping paragraph macro: sp after PP
+mandoc: close.in:65:1: ERROR: escaped character not allowed in a name: BR\&
+mandoc: close.in:68:2: ERROR: appending missing end of block: if
+mandoc: close.in:68:9: WARNING: skipping paragraph macro: sp after PP
diff --git a/regress/roff/cond/de.in b/regress/roff/cond/de.in
new file mode 100644
index 00000000..eeaeb295
--- /dev/null
+++ b/regress/roff/cond/de.in
@@ -0,0 +1,19 @@
+.\" $OpenBSD: de.in,v 1.1 2020/08/03 10:52:39 schwarze Exp $
+.TH COND-DE 1 "August 3, 2020"
+.SH NAME
+cond-de \- close macro definition and conditional block on the same line
+.SH DESCRIPTION
+.if n \{.de m1
+first content
+.. \}
+.if n \{.de m2
+second content
+.. \}ignored
+.if t \{.de m3
+does not show up
+.. \}ignored
+initial text
+.m1
+.m2
+.m3
+final text
diff --git a/regress/roff/cond/de.out_ascii b/regress/roff/cond/de.out_ascii
new file mode 100644
index 00000000..89977786
--- /dev/null
+++ b/regress/roff/cond/de.out_ascii
@@ -0,0 +1,13 @@
+COND-DE(1) General Commands Manual COND-DE(1)
+
+
+
+NNAAMMEE
+ cond-de - close macro definition and conditional block on the same line
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text first content second content final text
+
+
+
+OpenBSD August 3, 2020 COND-DE(1)
diff --git a/regress/roff/cond/de.out_lint b/regress/roff/cond/de.out_lint
new file mode 100644
index 00000000..1c61d9d4
--- /dev/null
+++ b/regress/roff/cond/de.out_lint
@@ -0,0 +1,2 @@
+mandoc: de.in:11:4: ERROR: skipping all arguments: .. \&ignored
+mandoc: de.in:18:2: ERROR: skipping unknown macro: .m3