=================================================================== RCS file: /cvs/mandoc/tbl_data.c,v retrieving revision 1.16 retrieving revision 1.19 diff -u -p -r1.16 -r1.19 --- mandoc/tbl_data.c 2011/01/10 14:40:30 1.16 +++ mandoc/tbl_data.c 2011/01/11 14:12:01 1.19 @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.16 2011/01/10 14:40:30 kristaps Exp $ */ +/* $Id: tbl_data.c,v 1.19 2011/01/11 14:12:01 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons * @@ -122,7 +122,8 @@ data(struct tbl_node *tbl, struct tbl_span *dp, dat->pos = TBL_DATA_DATA; if (TBL_CELL_HORIZ == dat->layout->pos || - TBL_CELL_DHORIZ == dat->layout->pos) + TBL_CELL_DHORIZ == dat->layout->pos || + TBL_CELL_DOWN == dat->layout->pos) if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string) TBL_MSG(tbl, MANDOCERR_TBLIGNDATA, ln, sv); @@ -140,7 +141,6 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) pos = 0; dat = tbl->last_span->last; - dat->pos = TBL_DATA_DATA; if (p[pos] == 'T' && p[pos + 1] == '}') { pos += 2; @@ -156,6 +156,8 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) /* Fallthrough: T} is part of a word. */ } + dat->pos = TBL_DATA_DATA; + if (dat->string) { sz = strlen(p) + strlen(dat->string) + 2; dat->string = mandoc_realloc(dat->string, sz); @@ -164,6 +166,9 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) } else dat->string = mandoc_strdup(p); + if (TBL_CELL_DOWN == dat->layout->pos) + TBL_MSG(tbl, MANDOCERR_TBLIGNDATA, ln, pos); + return(0); } @@ -187,8 +192,6 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p) * If there's no last parsed span, use the first row. Lastly, * if the last span was a horizontal line, use the same layout * (it doesn't "consume" the layout). - * - * In the end, this can be NULL! */ if (tbl->last_span) { @@ -197,10 +200,13 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p) rp = tbl->last_span->layout->next; else rp = tbl->last_span->layout; + if (NULL == rp) rp = tbl->last_span->layout; } else rp = tbl->first_row; + + assert(rp); dp = mandoc_calloc(1, sizeof(struct tbl_span)); dp->tbl = &tbl->opts;