Lines Matching refs:mdoc
1 /* Id: mdoc.c,v 1.275 2020/04/06 10:16:17 schwarze Exp */
18 * Top level and utility functions of the mdoc(7) parser for mandoc(1).
35 #include "mdoc.h"
62 mdoc_parseln(struct roff_man *mdoc, int ln, char *buf, int offs)
65 if (mdoc->last->type != ROFFT_EQN || ln > mdoc->last->line)
66 mdoc->flags |= MDOC_NEWLINE;
74 if (roff_getreg(mdoc->roff, "nS"))
75 mdoc->flags |= MDOC_SYNOPSIS;
77 mdoc->flags &= ~MDOC_SYNOPSIS;
79 return roff_getcontrol(mdoc->roff, buf, &offs) ?
80 mdoc_pmacro(mdoc, ln, buf, offs) :
81 mdoc_ptext(mdoc, ln, buf, offs);
85 mdoc_tail_alloc(struct roff_man *mdoc, int line, int pos, enum roff_tok tok)
89 p = roff_node_alloc(mdoc, line, pos, ROFFT_TAIL, tok);
90 roff_node_append(mdoc, p);
91 mdoc->next = ROFF_NEXT_CHILD;
95 mdoc_endbody_alloc(struct roff_man *mdoc, int line, int pos,
102 p = roff_node_alloc(mdoc, line, pos, ROFFT_BODY, tok);
106 roff_node_append(mdoc, p);
107 mdoc->next = ROFF_NEXT_SIBLING;
112 mdoc_block_alloc(struct roff_man *mdoc, int line, int pos,
117 p = roff_node_alloc(mdoc, line, pos, ROFFT_BLOCK, tok);
133 roff_node_append(mdoc, p);
134 mdoc->next = ROFF_NEXT_CHILD;
139 mdoc_elem_alloc(struct roff_man *mdoc, int line, int pos,
144 p = roff_node_alloc(mdoc, line, pos, ROFFT_ELEM, tok);
156 roff_node_append(mdoc, p);
157 mdoc->next = ROFF_NEXT_CHILD;
165 mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
171 n = mdoc->last;
176 * of such a list, intermixed with non-It mdoc macros and with
184 mdoc->flags |= MDOC_FREECOL;
185 (*mdoc_macro(MDOC_It)->fp)(mdoc, MDOC_It,
215 if (mdoc->flags & ROFF_NOFILL)
240 if (buf[offs] == '\0' && (mdoc->flags & ROFF_NOFILL) == 0) {
241 switch (mdoc->last->type) {
243 sp = mdoc->last->string;
257 roff_elem_alloc(mdoc, line, offs, ROFF_sp);
258 mdoc->last->flags |= NODE_VALID | NODE_ENDED;
259 mdoc->next = ROFF_NEXT_SIBLING;
263 roff_word_alloc(mdoc, line, offs, buf+offs);
265 if (mdoc->flags & ROFF_NOFILL)
277 mdoc->last->flags |= NODE_EOS;
307 mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
322 tok = roffhash_find(mdoc->mdocmac, buf + sv, sz);
361 n = mdoc->last;
364 (*mdoc_macro(tok)->fp)(mdoc, tok, ln, sv, &offs, buf);
379 mdoc->flags |= MDOC_FREECOL;
380 (*mdoc_macro(MDOC_It)->fp)(mdoc, MDOC_It, ln, sv, &sv, buf);
386 (*mdoc_macro(tok)->fp)(mdoc, tok, ln, sv, &offs, buf);
390 if (mdoc->quick && MDOC_Sh == tok &&
391 SEC_NAME != mdoc->last->sec)