diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2010-09-26 20:22:28 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2010-09-26 20:22:28 +0000 |
commit | 389f5118946dcf577077edf76a37430600443199 (patch) | |
tree | 8a389ad2dcdc39962c3e80e7cc5c8cdef001895a | |
parent | 01d35e790dc8582cde8876ab1ef1aac18d909d4c (diff) | |
download | mandoc-389f5118946dcf577077edf76a37430600443199.tar.gz |
If an explicit scope is still open at the end of an input file,
report an ERROR: We can still render the page by just closing
the open scope, but it is likely that information will be missing
or document structure mangled.
Before, man(7) only reported a WARNING (which is dangerous because
we cannot be sure rendering is correct) and mdoc(7) ran into FATAL
(which is too drastic, there is no reason not to show what we have).
"looks good" kristaps@
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | mandoc.h | 3 | ||||
-rw-r--r-- | mdoc_macro.c | 12 |
3 files changed, 6 insertions, 12 deletions
@@ -139,7 +139,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "section not in conventional manual section", "end of line whitespace", "blocks badly nested", - "scope open on exit", "generic error", @@ -165,6 +164,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "argument count wrong", "request scope close w/none open", "scope already open", + "scope open on exit", "macro requires line argument(s)", "macro requires body argument(s)", "macro requires argument(s)", @@ -182,7 +182,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "unsupported display type", "blocks badly nested", "no such block is open", - "scope broken, syntax violated", "line scope broken, syntax violated", "argument count wrong, violates syntax", "child violates parent syntax", @@ -63,7 +63,6 @@ enum mandocerr { MANDOCERR_SECMSEC, /* section not in conventional manual section */ MANDOCERR_EOLNSPACE, /* end of line whitespace */ MANDOCERR_SCOPENEST, /* blocks badly nested */ - MANDOCERR_SCOPEEXIT, /* scope open on exit */ MANDOCERR_ERROR, /* ===== end of errors ===== */ @@ -89,6 +88,7 @@ enum mandocerr { MANDOCERR_ARGCOUNT, /* argument count wrong */ MANDOCERR_NOSCOPE, /* no such block is open */ MANDOCERR_SCOPEREP, /* scope already open */ + MANDOCERR_SCOPEEXIT, /* scope open on exit */ /* FIXME: merge following with MANDOCERR_ARGCOUNT */ MANDOCERR_NOARGS, /* macro requires line argument(s) */ MANDOCERR_NOBODY, /* macro requires body argument(s) */ @@ -108,7 +108,6 @@ enum mandocerr { MANDOCERR_BADDISP, /* unsupported display type */ MANDOCERR_SCOPEFATAL, /* blocks badly nested */ MANDOCERR_SYNTNOSCOPE, /* no scope to rewind: syntax violated */ - MANDOCERR_SYNTSCOPE, /* scope broken, syntax violated */ MANDOCERR_SYNTLINESCOPE, /* line scope broken, syntax violated */ MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */ MANDOCERR_SYNTCHILD, /* child violates parent syntax */ diff --git a/mdoc_macro.c b/mdoc_macro.c index d5e946cb..757c6359 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -207,14 +207,10 @@ mdoc_macroend(struct mdoc *m) n = MDOC_VALID & m->last->flags ? m->last->parent : m->last; - for ( ; n; n = n->parent) { - if (MDOC_BLOCK != n->type) - continue; - if ( ! (MDOC_EXPLICIT & mdoc_macros[n->tok].flags)) - continue; - mdoc_nmsg(m, n, MANDOCERR_SYNTSCOPE); - return(0); - } + for ( ; n; n = n->parent) + if (MDOC_BLOCK == n->type && + MDOC_EXPLICIT & mdoc_macros[n->tok].flags) + mdoc_nmsg(m, n, MANDOCERR_SCOPEEXIT); /* Rewind to the first. */ |