summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-02 05:52:24 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-02 05:52:24 +0000
commit82b921ceb9411072fc74ac549038d20ec4b2dc2a (patch)
treee2b75775d1bc0f63e7c29fa50870bc570f854d0d /mdoc_validate.c
parent6953ebc600f2fbc755c081f62f54e09e92399d68 (diff)
downloadmandoc-82b921ceb9411072fc74ac549038d20ec4b2dc2a.tar.gz
Improve "skipping paragraph macro" messages,
showing which macro was skipped and before or after what.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 54257b29..a0dad19c 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1385,12 +1385,17 @@ post_bl_block(POST_ARGS)
continue;
}
if (NULL == ni->next) {
- mdoc_nmsg(mdoc, nc, MANDOCERR_MOVEPAR);
+ mandoc_msg(MANDOCERR_PAR_MOVE,
+ mdoc->parse, nc->line, nc->pos,
+ mdoc_macronames[nc->tok]);
if ( ! mdoc_node_relink(mdoc, nc))
return(0);
} else if (0 == n->norm->Bl.comp &&
LIST_column != n->norm->Bl.type) {
- mdoc_nmsg(mdoc, nc, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ mdoc->parse, nc->line, nc->pos,
+ "%s before It",
+ mdoc_macronames[nc->tok]);
mdoc_node_delete(mdoc, nc);
} else
break;
@@ -2078,13 +2083,19 @@ post_ignpar(POST_ARGS)
if (NULL != (np = mdoc->last->child))
if (MDOC_Pp == np->tok || MDOC_Lp == np->tok) {
- mdoc_nmsg(mdoc, np, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ mdoc->parse, np->line, np->pos,
+ "%s after %s", mdoc_macronames[np->tok],
+ mdoc_macronames[mdoc->last->tok]);
mdoc_node_delete(mdoc, np);
}
if (NULL != (np = mdoc->last->last))
if (MDOC_Pp == np->tok || MDOC_Lp == np->tok) {
- mdoc_nmsg(mdoc, np, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
+ np->line, np->pos, "%s at the end of %s",
+ mdoc_macronames[np->tok],
+ mdoc_macronames[mdoc->last->tok]);
mdoc_node_delete(mdoc, np);
}
@@ -2116,7 +2127,10 @@ pre_par(PRE_ARGS)
if (MDOC_It == n->tok && n->parent->norm->Bl.comp)
return(1);
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "%s before %s", mdoc_macronames[mdoc->last->tok],
+ mdoc_macronames[n->tok]);
mdoc_node_delete(mdoc, mdoc->last);
return(1);
}
@@ -2124,25 +2138,27 @@ pre_par(PRE_ARGS)
static int
post_par(POST_ARGS)
{
+ struct mdoc_node *np;
if (MDOC_ELEM != mdoc->last->type &&
MDOC_BLOCK != mdoc->last->type)
return(1);
- if (NULL == mdoc->last->prev) {
- if (MDOC_Sh != mdoc->last->parent->tok &&
- MDOC_Ss != mdoc->last->parent->tok)
+ if (NULL == (np = mdoc->last->prev)) {
+ np = mdoc->last->parent;
+ if (MDOC_Sh != np->tok && MDOC_Ss != np->tok)
return(1);
} else {
- if (MDOC_Pp != mdoc->last->prev->tok &&
- MDOC_Lp != mdoc->last->prev->tok &&
+ if (MDOC_Pp != np->tok && MDOC_Lp != np->tok &&
(MDOC_br != mdoc->last->tok ||
- (MDOC_sp != mdoc->last->prev->tok &&
- MDOC_br != mdoc->last->prev->tok)))
+ (MDOC_sp != np->tok && MDOC_br != np->tok)))
return(1);
}
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "%s after %s", mdoc_macronames[mdoc->last->tok],
+ mdoc_macronames[np->tok]);
mdoc_node_delete(mdoc, mdoc->last);
return(1);
}