+ man_unscope(man, man->last->parent);
+ man_body_alloc(man, ln, ppos, man->last->tok);
+ return(1);
+}
+
+void
+man_breakscope(struct man *man, enum mant tok)
+{
+ struct man_node *n;
+
+ /*
+ * An element next line scope is open,
+ * and the new macro is not allowed inside elements.
+ * Delete the element that is being broken.
+ */
+
+ if (man->flags & MAN_ELINE && (tok == MAN_MAX ||
+ ! (man_macros[tok].flags & MAN_NSCOPED))) {
+ n = man->last;
+ assert(n->type != MAN_TEXT);
+ if (man_macros[n->tok].flags & MAN_NSCOPED)
+ n = n->parent;
+
+ mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
+ n->line, n->pos, "%s breaks %s",
+ tok == MAN_MAX ? "TS" : man_macronames[tok],
+ man_macronames[n->tok]);
+
+ man_node_delete(man, n);
+ man->flags &= ~MAN_ELINE;
+ }
+
+ /*
+ * A block header next line scope is open,
+ * and the new macro is not allowed inside block headers.
+ * Delete the block that is being broken.
+ */
+
+ if (man->flags & MAN_BLINE && (tok == MAN_MAX ||
+ man_macros[tok].flags & MAN_BSCOPE)) {
+ n = man->last;
+ if (n->type == MAN_TEXT)
+ n = n->parent;
+ if ( ! (man_macros[n->tok].flags & MAN_BSCOPE))
+ n = n->parent;
+
+ assert(n->type == MAN_HEAD);
+ n = n->parent;
+ assert(n->type == MAN_BLOCK);
+ assert(man_macros[n->tok].flags & MAN_SCOPED);
+
+ mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
+ n->line, n->pos, "%s breaks %s",
+ tok == MAN_MAX ? "TS" : man_macronames[tok],
+ man_macronames[n->tok]);
+
+ man_node_delete(man, n);
+ man->flags &= ~MAN_BLINE;
+ }