summaryrefslogtreecommitdiffstats
path: root/validate.c
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
commit9a5b4bcb2e33907e5840f6a576a7cac39f080343 (patch)
treeb049e8f51e58a7249604882fb9d4d065fc5a29ea /validate.c
parent769d4e324aa3e88fcd0dddab649abc5c15298d11 (diff)
downloadmandoc-9a5b4bcb2e33907e5840f6a576a7cac39f080343.tar.gz
*** empty log message ***
Diffstat (limited to 'validate.c')
-rw-r--r--validate.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/validate.c b/validate.c
index b9882b97..e028aadc 100644
--- a/validate.c
+++ b/validate.c
@@ -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)
{