summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-04 19:20:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-04 19:20:12 +0000
commit58bcb2f42259b0f030965cd8437c90e4704edb0e (patch)
tree27db2d9620c03dcaaf948a5ff5a2b9b86af10f3f /mdoc_validate.c
parente8b6c8a8ee532ff2305958026287532e9746a3f0 (diff)
downloadmandoc-58bcb2f42259b0f030965cd8437c90e4704edb0e.tar.gz
improve diagnostics regarding arguments of .An .Pp .Lp .br .sp
in particular, get rid of check_count(..., CHECK_EQ, 0)
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 3b1afdf5..f7d0538c 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1174,14 +1174,15 @@ post_at(POST_ARGS)
static void
post_an(POST_ARGS)
{
- struct mdoc_node *np;
+ struct mdoc_node *np, *nch;
np = mdoc->last;
if (AUTH__NONE == np->norm->An.auth) {
if (0 == np->child)
check_count(mdoc, MDOC_ELEM, CHECK_GT, 0);
- } else if (np->child)
- check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+ } else if ((nch = np->child) != NULL)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ nch->line, nch->pos, "An ... %s", nch->string);
}
static void
@@ -2134,14 +2135,17 @@ post_par(POST_ARGS)
{
struct mdoc_node *np;
- if (mdoc->last->tok == MDOC_sp)
- check_count(mdoc, MDOC_ELEM, CHECK_LT, 2);
- else
- check_count(mdoc, MDOC_ELEM, CHECK_EQ, 0);
+ np = mdoc->last;
- if (MDOC_ELEM != mdoc->last->type &&
- MDOC_BLOCK != mdoc->last->type)
- return;
+ if (np->tok == MDOC_sp) {
+ if (np->nchild > 1)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ np->child->next->line, np->child->next->pos,
+ "sp ... %s", np->child->next->string);
+ } else if (np->child != NULL)
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, np->line, np->pos, "%s %s",
+ mdoc_macronames[np->tok], np->child->string);
if (NULL == (np = mdoc->last->prev)) {
np = mdoc->last->parent;