summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-01-09 15:15:31 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-01-09 15:15:31 +0000
commit66dcb58e3397f627b870f3d66d6d1460bbb1b052 (patch)
treeb266bd4f5f1c7f582232989a6f48da9e7173fed6
parent218db5ce001eefed06c3063fd537a533b0f51046 (diff)
downloadmandoc-66dcb58e3397f627b870f3d66d6d1460bbb1b052.tar.gz
mandoc-66dcb58e3397f627b870f3d66d6d1460bbb1b052.tar.zst
mandoc-66dcb58e3397f627b870f3d66d6d1460bbb1b052.zip
*** empty log message ***
-rw-r--r--validate.c25
1 files 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 <kristaps@kth.se>
*
@@ -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 */
@@ -206,6 +208,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)
{