diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-06 11:54:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-06 11:54:36 +0000 |
commit | daf2e16fdc43b128212a4ed878eda6db14c08074 (patch) | |
tree | 226a418cbf3ee1510fde9bad6d26f52b7dabeb9b /man_macro.c | |
parent | a2da7908b98806106e371a1ff27e835194407859 (diff) | |
download | mandoc-daf2e16fdc43b128212a4ed878eda6db14c08074.tar.gz |
better error reporting regarding .OP .RS .UR .TH arguments
Diffstat (limited to 'man_macro.c')
-rw-r--r-- | man_macro.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/man_macro.c b/man_macro.c index 88f1f431..dcfd2dc3 100644 --- a/man_macro.c +++ b/man_macro.c @@ -337,31 +337,25 @@ blk_close(MACRO_PROT_ARGS) void blk_exp(MACRO_PROT_ARGS) { - struct man_node *n; - int la; + struct man_node *head; char *p; + int la; rew_scope(MAN_BLOCK, man, tok); man_block_alloc(man, line, ppos, tok); man_head_alloc(man, line, ppos, tok); + head = man->last; - for (;;) { - la = *pos; - if ( ! man_args(man, line, pos, buf, &p)) - break; + la = *pos; + if (man_args(man, line, pos, buf, &p)) man_word_alloc(man, line, la, p); - } - - assert(man); - assert(tok != MAN_MAX); - for (n = man->last; n; n = n->parent) - if (n->tok == tok) { - assert(n->type == MAN_HEAD); - man_unscope(man, n); - break; - } + if (buf[*pos] != '\0') + mandoc_vmsg(MANDOCERR_ARG_EXCESS, + man->parse, line, *pos, "%s ... %s", + man_macronames[tok], buf + *pos); + man_unscope(man, head); man_body_alloc(man, line, ppos, tok); } |