From 66dcb58e3397f627b870f3d66d6d1460bbb1b052 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Fri, 9 Jan 2009 15:15:31 +0000 Subject: *** empty log message *** --- validate.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/validate.c b/validate.c index 754e9d93..585bf357 100644 --- a/validate.c +++ b/validate.c @@ -1,4 +1,4 @@ -/* $Id: validate.c,v 1.22 2009/01/09 15:07:04 kristaps Exp $ */ +/* $Id: validate.c,v 1.23 2009/01/09 15:15:31 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -32,6 +32,7 @@ struct valids { }; +static int pre_display(struct mdoc *, struct mdoc_node *); static int pre_prologue(struct mdoc *, struct mdoc_node *); static int pre_prologue(struct mdoc *, struct mdoc_node *); static int pre_prologue(struct mdoc *, struct mdoc_node *); @@ -46,6 +47,7 @@ static v_post posts_sh[] = { post_headchild_err_ge1, static v_post posts_ss[] = { post_headchild_err_ge1, NULL }; static v_post posts_pp[] = { post_elemchild_warn_eq0, NULL }; static v_post posts_dd[] = { post_elemchild_err_ge1, NULL }; +static v_post posts_display[] = { post_headchild_err_ge1, NULL }; const struct valids mdoc_valids[MDOC_MAX] = { @@ -56,9 +58,9 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, posts_sh }, /* Sh */ /* FIXME: preceding Pp. */ { NULL, posts_ss }, /* Ss */ /* FIXME: preceding Pp. */ { NULL, posts_pp }, /* Pp */ /* FIXME: proceeding... */ - { NULL, NULL }, /* D1 */ - { NULL, NULL }, /* Dl */ - { NULL, NULL }, /* Bd */ /* FIXME: preceding Pp. */ + { pre_display, posts_display }, /* D1 */ + { pre_display, posts_display }, /* Dl */ + { pre_display, NULL }, /* Bd */ /* FIXME: preceding Pp. */ { NULL, NULL }, /* Ed */ { NULL, NULL }, /* Bl */ /* FIXME: preceding Pp. */ { NULL, NULL }, /* El */ @@ -205,6 +207,21 @@ post_headchild_err_ge1(struct mdoc *mdoc) } +static int +pre_display(struct mdoc *mdoc, struct mdoc_node *node) +{ + struct mdoc_node *n; + + for (n = mdoc->last; n; n = n->parent) + if (MDOC_BLOCK == n->type) + if (MDOC_Bd == n->data.block.tok) + break; + if (NULL == n) + return(1); + return(mdoc_verr(mdoc, node, ERR_SCOPE_NONEST)); +} + + static int pre_prologue(struct mdoc *mdoc, struct mdoc_node *node) { -- cgit v1.2.3-56-ge451