summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 22:56:02 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 22:56:02 +0000
commitc13027734e9d36c96b4fd039e21c3112330c80c1 (patch)
tree68a38c78005cc5fa2efaaa78bb7dcfe23b7de716 /mdoc_validate.c
parentb8ca66ed11088edca84601f2bbe21a94cd5392ef (diff)
downloadmandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.tar.gz
mandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.tar.zst
mandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.zip
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.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c18
1 files changed, 10 insertions, 8 deletions
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 <kristaps@bsd.lv>
*
@@ -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,