version 1.172, 2015/02/03 18:22:05 |
version 1.180, 2015/02/07 16:42:33 |
Line 262 rew_last(struct mdoc *mdoc, const struct mdoc_node *to |
|
Line 262 rew_last(struct mdoc *mdoc, const struct mdoc_node *to |
|
assert(to); |
assert(to); |
mdoc->next = MDOC_NEXT_SIBLING; |
mdoc->next = MDOC_NEXT_SIBLING; |
while (mdoc->last != to) { |
while (mdoc->last != to) { |
if ( ! (mdoc->last->flags & MDOC_VALID)) |
|
mdoc->last->lastline = to->lastline - |
|
(mdoc->flags & MDOC_NEWLINE ? 1 : 0); |
|
/* |
/* |
* Save the parent here, because we may delete the |
* Save the parent here, because we may delete the |
* mdoc->last node in the post-validation phase and reset |
* mdoc->last node in the post-validation phase and reset |
Line 578 blk_exp_close(MACRO_PROT_ARGS) |
|
Line 575 blk_exp_close(MACRO_PROT_ARGS) |
|
/* Remember the start of our own body. */ |
/* Remember the start of our own body. */ |
|
|
if (n->type == MDOC_BODY && atok == n->tok) { |
if (n->type == MDOC_BODY && atok == n->tok) { |
if (n->end == ENDBODY_NOT) { |
if (n->end == ENDBODY_NOT) |
body = n; |
body = n; |
n->lastline = line; |
|
} |
|
continue; |
continue; |
} |
} |
|
|
Line 594 blk_exp_close(MACRO_PROT_ARGS) |
|
Line 589 blk_exp_close(MACRO_PROT_ARGS) |
|
} |
} |
|
|
if (atok == n->tok) { |
if (atok == n->tok) { |
n->lastline = line; |
|
assert(body); |
assert(body); |
|
|
/* |
/* |
Line 778 in_line(MACRO_PROT_ARGS) |
|
Line 772 in_line(MACRO_PROT_ARGS) |
|
*/ |
*/ |
|
|
if (ac == ARGS_PUNCT) { |
if (ac == ARGS_PUNCT) { |
if (cnt == 0 && nc == 0) |
if (cnt == 0 && (nc == 0 || tok == MDOC_An)) |
mdoc->flags |= MDOC_NODELIMC; |
mdoc->flags |= MDOC_NODELIMC; |
break; |
break; |
} |
} |
Line 910 blk_full(MACRO_PROT_ARGS) |
|
Line 904 blk_full(MACRO_PROT_ARGS) |
|
|
|
nl = MDOC_NEWLINE & mdoc->flags; |
nl = MDOC_NEWLINE & mdoc->flags; |
|
|
|
if (buf[*pos] == '\0' && (tok == MDOC_Sh || tok == MDOC_Ss)) { |
|
mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, |
|
line, ppos, mdoc_macronames[tok]); |
|
return; |
|
} |
|
|
if ( ! (mdoc_macros[tok].flags & MDOC_EXPLICIT)) { |
if ( ! (mdoc_macros[tok].flags & MDOC_EXPLICIT)) { |
|
|
/* Here, tok is one of Sh Ss Nm Nd It. */ |
/* Here, tok is one of Sh Ss Nm Nd It. */ |
Line 941 blk_full(MACRO_PROT_ARGS) |
|
Line 941 blk_full(MACRO_PROT_ARGS) |
|
mdoc_macronames[tok], |
mdoc_macronames[tok], |
mdoc_macronames[n->tok]); |
mdoc_macronames[n->tok]); |
rew_pending(mdoc, n); |
rew_pending(mdoc, n); |
|
n = mdoc->last; |
continue; |
continue; |
case MDOC_It: |
case MDOC_It: |
/* Delay in case it's astray. */ |
/* Delay in case it's astray. */ |
Line 1027 blk_full(MACRO_PROT_ARGS) |
|
Line 1028 blk_full(MACRO_PROT_ARGS) |
|
la = *pos; |
la = *pos; |
lac = ac; |
lac = ac; |
ac = mdoc_args(mdoc, line, pos, buf, tok, &p); |
ac = mdoc_args(mdoc, line, pos, buf, tok, &p); |
if (ac == ARGS_PUNCT) |
|
break; |
|
if (ac == ARGS_EOLN) { |
if (ac == ARGS_EOLN) { |
if (lac != ARGS_PPHRASE && lac != ARGS_PHRASE) |
if (lac != ARGS_PPHRASE && lac != ARGS_PHRASE) |
break; |
break; |
Line 1044 blk_full(MACRO_PROT_ARGS) |
|
Line 1043 blk_full(MACRO_PROT_ARGS) |
|
body = mdoc_body_alloc(mdoc, line, ppos, tok); |
body = mdoc_body_alloc(mdoc, line, ppos, tok); |
break; |
break; |
} |
} |
|
if (tok == MDOC_Bd || tok == MDOC_Bk) { |
|
mandoc_vmsg(MANDOCERR_ARG_EXCESS, |
|
mdoc->parse, line, la, "%s ... %s", |
|
mdoc_macronames[tok], buf + la); |
|
break; |
|
} |
|
if (tok == MDOC_Rs) { |
|
mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse, |
|
line, la, "Rs %s", buf + la); |
|
break; |
|
} |
|
if (ac == ARGS_PUNCT) |
|
break; |
|
|
/* |
/* |
* Emit leading punctuation (i.e., punctuation before |
* Emit leading punctuation (i.e., punctuation before |
Line 1100 blk_full(MACRO_PROT_ARGS) |
|
Line 1112 blk_full(MACRO_PROT_ARGS) |
|
return; |
return; |
if (head == NULL) |
if (head == NULL) |
head = mdoc_head_alloc(mdoc, line, ppos, tok); |
head = mdoc_head_alloc(mdoc, line, ppos, tok); |
if (nl) |
if (nl && tok != MDOC_Bd && tok != MDOC_Bl && tok != MDOC_Rs) |
append_delims(mdoc, line, pos, buf); |
append_delims(mdoc, line, pos, buf); |
if (body != NULL) |
if (body != NULL) |
goto out; |
goto out; |
Line 1362 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1374 in_line_argn(MACRO_PROT_ARGS) |
|
} |
} |
|
|
if (j == 0) { |
if (j == 0) { |
|
if (tok == MDOC_In || tok == MDOC_St || tok == MDOC_Xr) { |
|
mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, |
|
line, ppos, mdoc_macronames[tok]); |
|
return; |
|
} |
mdoc_elem_alloc(mdoc, line, ppos, tok, arg); |
mdoc_elem_alloc(mdoc, line, ppos, tok, arg); |
if (ac == ARGS_PUNCT && tok == MDOC_Pf) |
if (ac == ARGS_PUNCT && tok == MDOC_Pf) |
append_delims(mdoc, line, pos, buf); |
append_delims(mdoc, line, pos, buf); |
Line 1385 in_line_eoln(MACRO_PROT_ARGS) |
|
Line 1402 in_line_eoln(MACRO_PROT_ARGS) |
|
n = n->parent; |
n = n->parent; |
if (n->tok == MDOC_Nm) |
if (n->tok == MDOC_Nm) |
rew_last(mdoc, mdoc->last->parent); |
rew_last(mdoc, mdoc->last->parent); |
|
} |
|
|
|
if (buf[*pos] == '\0' && |
|
(tok == MDOC_Fd || mdoc_macronames[tok][0] == '%')) { |
|
mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, |
|
line, ppos, mdoc_macronames[tok]); |
|
return; |
} |
} |
|
|
mdoc_argv(mdoc, line, tok, &arg, pos, buf); |
mdoc_argv(mdoc, line, tok, &arg, pos, buf); |