diff options
Diffstat (limited to 'mdoc.c')
-rw-r--r-- | mdoc.c | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.174 2011/01/01 10:51:30 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.175 2011/01/01 12:18:37 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -98,6 +98,8 @@ static int node_append(struct mdoc *, struct mdoc_node *); static int mdoc_ptext(struct mdoc *, int, char *, int); static int mdoc_pmacro(struct mdoc *, int, char *, int); +static int mdoc_span_alloc(struct mdoc *, + const struct tbl_span *); const struct mdoc_node * @@ -221,6 +223,24 @@ mdoc_endparse(struct mdoc *m) return(0); } +int +mdoc_addspan(struct mdoc *m, const struct tbl_span *sp) +{ + + if (MDOC_HALT & m->flags) + return(0); + + /* No text before an initial macro. */ + + if (SEC_NONE == m->lastnamed) { + /* FIXME: grab from span. */ + mdoc_pmsg(m, 0, 0, MANDOCERR_NOTEXT); + return(1); + } + + return(mdoc_span_alloc(m, sp)); +} + /* * Main parse routine. Parses a single line -- really just hands off to @@ -525,6 +545,22 @@ mdoc_elem_alloc(struct mdoc *m, int line, int pos, return(1); } +static int +mdoc_span_alloc(struct mdoc *m, const struct tbl_span *sp) +{ + struct mdoc_node *n; + + /* FIXME: grab from tbl_span. */ + n = node_alloc(m, 0, 0, MDOC_MAX, MDOC_TBL); + n->span = sp; + + if ( ! node_append(m, n)) + return(0); + + m->next = MDOC_NEXT_SIBLING; + return(1); +} + int mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p) |