* mdocml: Improve "skipping paragraph macro" messages, showing which macro
@ 2014-07-02 5:52 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-07-02 5:52 UTC (permalink / raw)
To: source
Log Message:
-----------
Improve "skipping paragraph macro" messages,
showing which macro was skipped and before or after what.
Modified Files:
--------------
mdocml:
man_validate.c
mandoc.h
mdoc_validate.c
Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.218 -r1.219
--- mdoc_validate.c
+++ 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);
}
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -Lmandoc.h -Lmandoc.h -u -p -r1.126 -r1.127
--- mandoc.h
+++ mandoc.h
@@ -72,8 +72,8 @@ enum mandocerr {
/* related to macros and nesting */
MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
- MANDOCERR_IGNPAR, /* skipping paragraph macro */
- MANDOCERR_MOVEPAR, /* moving paragraph macro out of list */
+ MANDOCERR_PAR_SKIP, /* skipping paragraph macro: macro ... */
+ MANDOCERR_PAR_MOVE, /* moving paragraph macro out of list: macro */
MANDOCERR_IGNNS, /* skipping no-space macro */
MANDOCERR_SCOPENEST, /* blocks badly nested */
MANDOCERR_CHILD, /* child violates parent syntax */
Index: man_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -Lman_validate.c -Lman_validate.c -u -p -r1.94 -r1.95
--- man_validate.c
+++ man_validate.c
@@ -357,7 +357,9 @@ check_par(CHKARGS)
break;
case MAN_BODY:
if (0 == n->nchild)
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
break;
case MAN_HEAD:
if (n->nchild)
@@ -381,7 +383,9 @@ post_IP(CHKARGS)
break;
case MAN_BODY:
if (0 == n->parent->head->nchild && 0 == n->nchild)
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
break;
default:
break;
@@ -579,7 +583,9 @@ post_vs(CHKARGS)
case MAN_SH:
/* FALLTHROUGH */
case MAN_SS:
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
+ "%s after %s", man_macronames[n->tok],
+ man_macronames[n->parent->tok]);
/* FALLTHROUGH */
case MAN_MAX:
/*
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-07-02 5:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-02 5:52 mdocml: Improve "skipping paragraph macro" messages, showing which macro schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).