diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-26 10:39:35 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-26 10:39:35 +0000 |
commit | 878d84055a253f63524c12172dd09c9044ad0afd (patch) | |
tree | 279ebf5690ecb93404f3c6dc07bc4a4f6d68cf22 /mdoc_validate.c | |
parent | 7d24aa6b61fc7c0a61348119c53447f5c9b1b892 (diff) | |
download | mandoc-878d84055a253f63524c12172dd09c9044ad0afd.tar.gz |
Documented `Ud'.
Proper EOS handling for `Rv', `Ex', `Ud', and `Bt'.
Both `Bt' and `Ud' now warn about and discard line arguments (reported
by Ulrich Spoerlein).
Collapsed posts_xr into posts_wtext (harmless: they're the same thing).
Added regressions for `Ud' and `Bt'.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 2791ceeb..c1381bb2 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -92,6 +92,7 @@ static int post_sh(POST_ARGS); static int post_sh_body(POST_ARGS); static int post_sh_head(POST_ARGS); static int post_st(POST_ARGS); +static int post_eoln(POST_ARGS); static int post_vt(POST_ARGS); static int pre_an(PRE_ARGS); static int pre_bd(PRE_ARGS); @@ -111,6 +112,7 @@ static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NULL }; static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; +static v_post posts_eoln[] = { post_eoln, NULL }; static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL }; static v_post posts_it[] = { post_it, NULL }; static v_post posts_lb[] = { eerr_eq1, post_lb, NULL }; @@ -127,7 +129,6 @@ static v_post posts_text1[] = { eerr_eq1, NULL }; static v_post posts_vt[] = { post_vt, NULL }; static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; static v_post posts_wtext[] = { ewarn_ge1, NULL }; -static v_post posts_xr[] = { ewarn_ge1, NULL }; static v_pre pres_an[] = { pre_an, NULL }; static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; static v_pre pres_bl[] = { pre_bl, NULL }; @@ -184,7 +185,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, posts_st }, /* St */ { NULL, NULL }, /* Va */ { NULL, posts_vt }, /* Vt */ - { NULL, posts_xr }, /* Xr */ + { NULL, posts_wtext }, /* Xr */ { NULL, posts_text }, /* %A */ { NULL, posts_text }, /* %B */ /* FIXME: can be used outside Rs/Re. */ { NULL, posts_text }, /* %D */ /* FIXME: check date with mandoc_a2time(). */ @@ -246,10 +247,10 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Oc */ { NULL, posts_wline }, /* Bk */ { NULL, NULL }, /* Ek */ - { NULL, posts_notext }, /* Bt */ + { NULL, posts_eoln }, /* Bt */ { NULL, NULL }, /* Hf */ { NULL, NULL }, /* Fr */ - { NULL, posts_notext }, /* Ud */ + { NULL, posts_eoln }, /* Ud */ { NULL, posts_lb }, /* Lb */ { NULL, posts_notext }, /* Lp */ { NULL, posts_text }, /* Lk */ @@ -391,7 +392,7 @@ CHECK_CHILD_DEFN(err, lt, <) /* err_child_lt() */ CHECK_CHILD_DEFN(warn, lt, <) /* warn_child_lt() */ CHECK_BODY_DEFN(ge1, warn, warn_child_gt, 0) /* bwarn_ge1() */ CHECK_BODY_DEFN(ge1, err, err_child_gt, 0) /* berr_ge1() */ -CHECK_ELEM_DEFN(ge1, warn, warn_child_gt, 0) /* ewarn_gt1() */ +CHECK_ELEM_DEFN(ge1, warn, warn_child_gt, 0) /* ewarn_ge1() */ CHECK_ELEM_DEFN(eq1, err, err_child_eq, 1) /* eerr_eq1() */ CHECK_ELEM_DEFN(le1, err, err_child_lt, 2) /* eerr_le1() */ CHECK_ELEM_DEFN(eq0, err, err_child_eq, 0) /* eerr_eq0() */ @@ -829,6 +830,16 @@ post_lb(POST_ARGS) static int +post_eoln(POST_ARGS) +{ + + if (NULL == mdoc->last->child) + return(1); + return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST)); +} + + +static int post_vt(POST_ARGS) { const struct mdoc_node *n; |