diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-09 15:15:31 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-09 15:15:31 +0000 |
commit | 9a5b4bcb2e33907e5840f6a576a7cac39f080343 (patch) | |
tree | b049e8f51e58a7249604882fb9d4d065fc5a29ea | |
parent | 769d4e324aa3e88fcd0dddab649abc5c15298d11 (diff) | |
download | mandoc-9a5b4bcb2e33907e5840f6a576a7cac39f080343.tar.gz |
*** empty log message ***
-rw-r--r-- | validate.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -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) { |