=================================================================== RCS file: /cvs/mandoc/mdoc_macro.c,v retrieving revision 1.191 retrieving revision 1.196 diff -u -p -r1.191 -r1.196 --- mandoc/mdoc_macro.c 2015/04/19 14:00:19 1.191 +++ mandoc/mdoc_macro.c 2015/04/29 14:48:53 1.196 @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.191 2015/04/19 14:00:19 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.196 2015/04/29 14:48:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -210,7 +210,7 @@ const struct mdoc_macro * const mdoc_macros = __mdoc_m * are errors. */ void -mdoc_macroend(struct roff_man *mdoc) +mdoc_endparse(struct roff_man *mdoc) { struct roff_node *n; @@ -291,19 +291,22 @@ rew_pending(struct roff_man *mdoc, const struct roff_n for (;;) { rew_last(mdoc, n); - switch (n->type) { - case ROFFT_HEAD: - roff_body_alloc(mdoc, n->line, n->pos, n->tok); - return; - case ROFFT_BLOCK: - break; - default: - return; - } + if (mdoc->last == n) { + switch (n->type) { + case ROFFT_HEAD: + roff_body_alloc(mdoc, n->line, n->pos, + n->tok); + return; + case ROFFT_BLOCK: + break; + default: + return; + } + if ( ! (n->flags & MDOC_BROKEN)) + return; + } else + n = mdoc->last; - if ( ! (n->flags & MDOC_BROKEN)) - return; - for (;;) { if ((n = n->parent) == NULL) return; @@ -432,11 +435,11 @@ dword(struct roff_man *mdoc, int line, int col, const ! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) && d == DELIM_NONE && mdoc->last->type == ROFFT_TEXT && mdoc_isdelim(mdoc->last->string) == DELIM_NONE) { - mdoc_word_append(mdoc, p); + roff_word_append(mdoc, p); return; } - mdoc_word_alloc(mdoc, line, col, p); + roff_word_alloc(mdoc, line, col, p); /* * If the word consists of a bare delimiter, @@ -641,12 +644,14 @@ blk_exp_close(MACRO_PROT_ARGS) if (body == NULL) { mandoc_msg(MANDOCERR_BLK_NOTOPEN, mdoc->parse, line, ppos, mdoc_macronames[tok]); + if (later != NULL) + later->flags &= ~MDOC_BROKEN; if (maxargs && endbody == NULL) { /* * Stray .Ec without previous .Eo: * Break the output line, keep the arguments. */ - mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL); + roff_elem_alloc(mdoc, line, ppos, MDOC_br); rew_elem(mdoc, MDOC_br); } } else if (endbody == NULL) { @@ -990,7 +995,7 @@ blk_full(MACRO_PROT_ARGS) if (tok == MDOC_It && (n == NULL || n->tok != MDOC_Bl)) { mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse, line, ppos, "It %s", buf + *pos); - mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL); + roff_elem_alloc(mdoc, line, ppos, MDOC_br); rew_elem(mdoc, MDOC_br); return; } @@ -1223,7 +1228,7 @@ blk_part_exp(MACRO_PROT_ARGS) * case of `Eo'); and a body that may be empty. */ - mdoc_block_alloc(mdoc, line, ppos, tok, NULL); + roff_block_alloc(mdoc, line, ppos, tok); head = NULL; for (;;) { la = *pos;