From c13027734e9d36c96b4fd039e21c3112330c80c1 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 30 May 2010 22:56:02 +0000 Subject: Migrate `Bl -column' phrases to be MDOC_BODY instead of MDOC_HEAD. This will make it easy for re-entrant parsing of `Ta' macros to fit in with standard closure rules. Added some more regressions for `Bl -column'. Note that one should fail, as documented in the TODO file. Recorded change of AST BNF in mdoc.3. --- mdoc_validate.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index 5dbfc6a8..6aed3c92 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.86 2010/05/30 11:47:44 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.87 2010/05/30 22:56:02 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -928,6 +928,7 @@ post_an(POST_ARGS) static int post_it(POST_ARGS) { + /* FIXME: use mdoc_list! */ int type, i, cols; struct mdoc_node *n, *c; @@ -1017,15 +1018,16 @@ post_it(POST_ARGS) return(0); break; case (MDOC_Column): - if (NULL == mdoc->last->head->child) - if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS)) - return(0); - if (mdoc->last->body->child) - if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BODYLOST)) + assert(NULL == mdoc->last->head->child); + if (NULL == mdoc->last->body->child) + if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY)) return(0); + + /* Count up the number of columns. */ c = mdoc->last->child; - for (i = 0; c && MDOC_HEAD == c->type; c = c->next) - i++; + for (i = 0; c; c = c->next) + if (MDOC_BODY == c->type) + i++; if (i < cols) { if ( ! mdoc_vmsg(mdoc, MANDOCERR_ARGCOUNT, -- cgit v1.2.3