Lines Matching refs:mdoc

54 static	int		dword(struct mdoc *, int, int, const char *,
56 static int append_delims(struct mdoc *,
61 struct mdoc *, int, int);
62 static int phrase(struct mdoc *, int, int, char *);
66 static int rew_elem(struct mdoc *, enum mdoct);
67 static int rew_last(struct mdoc *,
69 static int rew_sub(enum mdoc_type, struct mdoc *,
225 mdoc_macroend(struct mdoc *mdoc) in mdoc_macroend() argument
231 n = MDOC_VALID & mdoc->last->flags ? in mdoc_macroend()
232 mdoc->last->parent : mdoc->last; in mdoc_macroend()
237 mdoc_nmsg(mdoc, n, MANDOCERR_SCOPEEXIT); in mdoc_macroend()
241 return(rew_last(mdoc, mdoc->first)); in mdoc_macroend()
275 rew_last(struct mdoc *mdoc, const struct mdoc_node *to) in rew_last() argument
280 mdoc->next = MDOC_NEXT_SIBLING; in rew_last()
283 while (mdoc->last != to) { in rew_last()
290 np = mdoc->last->parent; in rew_last()
291 if ( ! mdoc_valid_post(mdoc)) in rew_last()
293 n = mdoc->last; in rew_last()
294 mdoc->last = np; in rew_last()
295 assert(mdoc->last); in rew_last()
296 mdoc->last->last = n; in rew_last()
299 return(mdoc_valid_post(mdoc)); in rew_last()
461 rew_elem(struct mdoc *mdoc, enum mdoct tok) in rew_elem() argument
465 n = mdoc->last; in rew_elem()
471 return(rew_last(mdoc, n)); in rew_elem()
483 struct mdoc *mdoc, int line, int ppos) in make_pending() argument
538 mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos, in make_pending()
553 rew_sub(enum mdoc_type t, struct mdoc *mdoc, in rew_sub() argument
558 n = mdoc->last; in rew_sub()
565 (MDOC_NEWLINE & mdoc->flags && in rew_sub()
569 mandoc_vmsg(MANDOCERR_SCOPEBROKEN, mdoc->parse, in rew_sub()
576 (MDOC_NEWLINE & mdoc->flags ? 1 : 0); in rew_sub()
580 if (make_pending(n, tok, mdoc, line, ppos) || in rew_sub()
585 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_NOSCOPE); in rew_sub()
592 if ( ! rew_last(mdoc, n)) in rew_sub()
600 if ( ! rew_last(mdoc, n)) in rew_sub()
603 ! mdoc_body_alloc(mdoc, n->line, n->pos, n->tok)) in rew_sub()
615 dword(struct mdoc *mdoc, int line, int col, const char *p, in dword() argument
623 ! ((MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF) & mdoc->flags) && in dword()
624 DELIM_NONE == d && MDOC_TEXT == mdoc->last->type && in dword()
625 DELIM_NONE == mdoc_isdelim(mdoc->last->string)) { in dword()
626 mdoc_word_append(mdoc, p); in dword()
630 if ( ! mdoc_word_alloc(mdoc, line, col, p)) in dword()
634 mdoc->last->flags |= MDOC_DELIMO; in dword()
646 else if (DELIM_CLOSE == d && mdoc->last->prev && in dword()
647 mdoc->last->prev->tok != MDOC_No && in dword()
648 mdoc->last->parent->tok != MDOC_Fd) in dword()
649 mdoc->last->flags |= MDOC_DELIMC; in dword()
655 append_delims(struct mdoc *mdoc, int line, int *pos, char *buf) in append_delims() argument
666 ac = mdoc_zargs(mdoc, line, pos, buf, &p); in append_delims()
673 dword(mdoc, line, la, p, DELIM_MAX, 1); in append_delims()
687 mdoc->last->flags |= MDOC_EOS; in append_delims()
709 nl = MDOC_NEWLINE & mdoc->flags; in blk_exp_close()
716 mdoc->flags &= ~MDOC_KEEP; in blk_exp_close()
728 for (n = mdoc->last; n; n = n->parent) { in blk_exp_close()
757 make_pending(later, tok, mdoc, line, ppos); in blk_exp_close()
763 if ( ! mdoc_endbody_alloc(mdoc, line, ppos, in blk_exp_close()
784 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_ARGSLOST); in blk_exp_close()
786 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_exp_close()
788 return(rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)); in blk_exp_close()
791 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_exp_close()
795 if ( ! mdoc_tail_alloc(mdoc, line, ppos, rew_alt(tok))) in blk_exp_close()
802 if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_exp_close()
807 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in blk_exp_close()
819 if ( ! dword(mdoc, line, lastarg, p, DELIM_MAX, in blk_exp_close()
826 if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_exp_close()
831 mdoc->flags &= ~MDOC_NEWLINE; in blk_exp_close()
833 if ( ! mdoc_macro(mdoc, ntok, line, lastarg, pos, buf)) in blk_exp_close()
838 if ( ! flushed && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_exp_close()
843 return(append_delims(mdoc, line, pos, buf)); in blk_exp_close()
858 nl = MDOC_NEWLINE & mdoc->flags; in in_line()
886 av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); in in_line()
903 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in in_line()
922 if (scope && ! rew_elem(mdoc, tok)) in in_line()
925 if ( ! mdoc_elem_alloc(mdoc, line, in in_line()
928 if ( ! rew_last(mdoc, mdoc->last)) in in_line()
932 mdoc_pmsg(mdoc, line, ppos, in in_line()
936 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in in_line()
940 return(append_delims(mdoc, line, pos, buf)); in in_line()
962 if ( ! mdoc_elem_alloc(mdoc, line, in in_line()
974 if (scope && ! rew_elem(mdoc, tok)) in in_line()
978 if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg)) in in_line()
986 if ( ! dword(mdoc, line, la, p, d, in in_line()
996 if ( ! rew_elem(mdoc, tok)) in in_line()
1002 if (scope && ! rew_elem(mdoc, tok)) in in_line()
1012 if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg)) in in_line()
1014 if ( ! rew_last(mdoc, mdoc->last)) in in_line()
1018 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROEMPTY); in in_line()
1023 return(append_delims(mdoc, line, pos, buf)); in in_line()
1041 nl = MDOC_NEWLINE & mdoc->flags; in blk_full()
1046 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_full()
1048 if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_full()
1063 av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); in blk_full()
1079 if ( ! mdoc_block_alloc(mdoc, line, ppos, tok, arg)) in blk_full()
1089 MDOC_Bl == mdoc->last->parent->tok && in blk_full()
1090 LIST_diag == mdoc->last->parent->norm->Bl.type; in blk_full()
1098 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_full()
1100 head = mdoc->last; in blk_full()
1101 if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) in blk_full()
1103 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_full()
1105 body = mdoc->last; in blk_full()
1109 mdoc->flags |= MDOC_KEEP; in blk_full()
1117 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in blk_full()
1135 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_full()
1137 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_full()
1139 body = mdoc->last; in blk_full()
1154 if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) in blk_full()
1162 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_full()
1164 head = mdoc->last; in blk_full()
1176 if ( ! rew_sub(mtt, mdoc, tok, line, ppos)) in blk_full()
1181 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_full()
1183 body = mdoc->last; in blk_full()
1192 mdoc->flags |= MDOC_PPHRASE; in blk_full()
1194 mdoc->flags |= MDOC_PPHRASE; in blk_full()
1196 if ( ! phrase(mdoc, line, la, buf)) in blk_full()
1199 mdoc->flags &= ~MDOC_PPHRASE; in blk_full()
1207 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in blk_full()
1213 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in blk_full()
1219 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_full()
1221 head = mdoc->last; in blk_full()
1224 if (nl && ! append_delims(mdoc, line, pos, buf)) in blk_full()
1238 for (n = mdoc->last; n && n != head; n = n->parent) { in blk_full()
1249 if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) in blk_full()
1251 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_full()
1255 if ( ! (MDOC_FREECOL & mdoc->flags)) in blk_full()
1258 if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_full()
1260 if ( ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_full()
1263 mdoc->flags &= ~MDOC_FREECOL; in blk_full()
1279 nl = MDOC_NEWLINE & mdoc->flags; in blk_part_imp()
1290 if ( ! mdoc_block_alloc(mdoc, line, ppos, tok, NULL)) in blk_part_imp()
1293 blk = mdoc->last; in blk_part_imp()
1295 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_part_imp()
1297 if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) in blk_part_imp()
1308 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in blk_part_imp()
1319 if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) in blk_part_imp()
1325 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_part_imp()
1327 body = mdoc->last; in blk_part_imp()
1333 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in blk_part_imp()
1339 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in blk_part_imp()
1347 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_part_imp()
1349 body = mdoc->last; in blk_part_imp()
1376 for (n = mdoc->last; n && n != body && n != blk->parent; in blk_part_imp()
1381 make_pending(n, tok, mdoc, line, ppos); in blk_part_imp()
1382 if ( ! mdoc_endbody_alloc(mdoc, line, ppos, in blk_part_imp()
1396 mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos, in blk_part_imp()
1399 if (n && ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos)) in blk_part_imp()
1404 if (nl && ! append_delims(mdoc, line, pos, buf)) in blk_part_imp()
1409 if (n && ! rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos)) in blk_part_imp()
1417 mdoc_node_relink(mdoc, n); in blk_part_imp()
1433 nl = MDOC_NEWLINE & mdoc->flags; in blk_part_exp()
1441 if ( ! mdoc_block_alloc(mdoc, line, ppos, tok, NULL)) in blk_part_exp()
1446 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in blk_part_exp()
1460 if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) in blk_part_exp()
1467 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_part_exp()
1469 head = mdoc->last; in blk_part_exp()
1481 if ( ! dword(mdoc, line, la, p, DELIM_MAX, 0)) in blk_part_exp()
1484 if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) in blk_part_exp()
1486 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_part_exp()
1488 body = mdoc->last; in blk_part_exp()
1499 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in blk_part_exp()
1505 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in blk_part_exp()
1513 if ( ! mdoc_head_alloc(mdoc, line, ppos, tok)) in blk_part_exp()
1517 if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) in blk_part_exp()
1519 if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) in blk_part_exp()
1527 return(append_delims(mdoc, line, pos, buf)); in blk_part_exp()
1542 nl = MDOC_NEWLINE & mdoc->flags; in in_line_argn()
1574 av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); in in_line_argn()
1592 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in in_line_argn()
1604 if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) in in_line_argn()
1608 if ( ! mdoc_elem_alloc(mdoc, line, la, tok, arg)) in in_line_argn()
1612 if ( ! rew_elem(mdoc, tok)) in in_line_argn()
1620 if ( ! flushed && ! rew_elem(mdoc, tok)) in in_line_argn()
1623 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in in_line_argn()
1633 if ( ! rew_elem(mdoc, tok)) in in_line_argn()
1638 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in in_line_argn()
1644 if (0 == j && ! mdoc_elem_alloc(mdoc, line, la, tok, arg)) in in_line_argn()
1649 if ( ! flushed && ! rew_elem(mdoc, tok)) in in_line_argn()
1653 return(append_delims(mdoc, line, pos, buf)); in in_line_argn()
1670 rew_sub(MDOC_BLOCK, mdoc, MDOC_Nm, line, ppos); in in_line_eoln()
1676 av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); in in_line_eoln()
1693 if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg)) in in_line_eoln()
1700 ac = mdoc_args(mdoc, line, pos, buf, tok, &p); in in_line_eoln()
1710 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in in_line_eoln()
1716 if ( ! rew_elem(mdoc, tok)) in in_line_eoln()
1718 return(mdoc_macro(mdoc, ntok, line, la, pos, buf)); in in_line_eoln()
1723 return(rew_elem(mdoc, tok)); in in_line_eoln()
1733 nl = MDOC_NEWLINE & mdoc->flags; in ctx_synopsis()
1736 if ( ! (MDOC_SYNOPSIS & mdoc->flags)) in ctx_synopsis()
1737 return(in_line(mdoc, tok, line, ppos, pos, buf)); in ctx_synopsis()
1741 return(in_line(mdoc, tok, line, ppos, pos, buf)); in ctx_synopsis()
1749 return(blk_full(mdoc, tok, line, ppos, pos, buf)); in ctx_synopsis()
1751 return(blk_part_imp(mdoc, tok, line, ppos, pos, buf)); in ctx_synopsis()
1760 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROOBS); in obsolete()
1771 phrase(struct mdoc *mdoc, int line, int ppos, char *buf) in phrase() argument
1781 ac = mdoc_zargs(mdoc, line, &pos, buf, &p); in phrase()
1791 if ( ! dword(mdoc, line, la, p, DELIM_MAX, 1)) in phrase()
1796 if ( ! mdoc_macro(mdoc, ntok, line, la, &pos, buf)) in phrase()
1798 return(append_delims(mdoc, line, &pos, buf)); in phrase()
1816 n = mdoc->last; in phrase_ta()
1820 mdoc_pmsg(mdoc, line, ppos, MANDOCERR_STRAYTA); in phrase_ta()
1825 if ( ! rew_sub(MDOC_BODY, mdoc, MDOC_It, line, ppos)) in phrase_ta()
1827 if ( ! mdoc_body_alloc(mdoc, line, ppos, MDOC_It)) in phrase_ta()
1832 ac = mdoc_zargs(mdoc, line, pos, buf, &p); in phrase_ta()
1842 if ( ! dword(mdoc, line, la, p, DELIM_MAX, in phrase_ta()
1848 if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf)) in phrase_ta()
1850 return(append_delims(mdoc, line, pos, buf)); in phrase_ta()