+ /*
+ * If a block closing macro taking arguments
+ * breaks another block, put the arguments
+ * into the end marker and remeber the
+ * end marker in order to close it out.
+ */
+
+ if (maxargs) {
+ endbody = mdoc->last;
+ mdoc->next = MDOC_NEXT_CHILD;
+ }
+ break;
+ }
+
+ /*
+ * When finding an open sub block, remember the last
+ * open explicit block, or, in case there are only
+ * implicit ones, the first open implicit block.
+ */
+
+ if (later == NULL ||
+ ! (mdoc_macros[later->tok].flags & MDOC_EXPLICIT))
+ later = n;
+ }
+ rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
+
+ if ( ! (mdoc_macros[tok].flags & MDOC_PARSED)) {
+ if (buf[*pos] != '\0')
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, line, ppos,
+ "%s %s", mdoc_macronames[tok],
+ buf + *pos);
+ rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
+ return;
+ }
+
+ if (maxargs && endbody == NULL) {
+ if (n == NULL) {
+ /*
+ * Stray .Ec without previous .Eo:
+ * Break the output line, ignore any arguments.
+ */
+ mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
+ rew_elem(mdoc, MDOC_br);
+ } else
+ mdoc_tail_alloc(mdoc, line, ppos, atok);
+ }
+
+ flushed = n == NULL;
+ for (j = 0; ; j++) {
+ lastarg = *pos;
+
+ if (j == maxargs && ! flushed) {
+ if (endbody == NULL)
+ rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
+ else
+ rew_last(mdoc, endbody);
+ flushed = 1;
+ }
+
+ ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
+ if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
+ break;
+
+ ntok = ac == ARGS_QWORD ? MDOC_MAX :
+ lookup(mdoc, tok, line, lastarg, p);
+
+ if (ntok == MDOC_MAX) {
+ dword(mdoc, line, lastarg, p, DELIM_MAX,
+ MDOC_JOIN & mdoc_macros[tok].flags);
+ continue;
+ }
+
+ if ( ! flushed) {
+ if (endbody == NULL)
+ rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
+ else
+ rew_last(mdoc, endbody);
+ flushed = 1;
+ }
+ mdoc->flags &= ~MDOC_NEWLINE;
+ mdoc_macro(mdoc, ntok, line, lastarg, pos, buf);
+ break;
+ }
+
+ if ( ! flushed) {
+ if (endbody == NULL)
+ rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
+ else
+ rew_last(mdoc, endbody);
+ }
+ if (nl)
+ append_delims(mdoc, line, pos, buf);
+}
+
+static void
+in_line(MACRO_PROT_ARGS)
+{
+ int la, scope, cnt, firstarg, mayopen, nc, nl;
+ enum mdoct ntok;
+ enum margserr ac;
+ enum mdelim d;
+ struct mdoc_arg *arg;
+ char *p;
+
+ nl = MDOC_NEWLINE & mdoc->flags;