diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-09-12 00:54:10 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-09-12 00:54:10 +0000 |
commit | 8275a8e52fbf7fc40a4ad55c8d4ad9efe8f67058 (patch) | |
tree | c81a99061a1263dce03ec39c840a76a6e40782dd /mdoc_validate.c | |
parent | 01e7064c09b621aa81c81b4ce8108312e8e2d7b1 (diff) | |
download | mandoc-8275a8e52fbf7fc40a4ad55c8d4ad9efe8f67058.tar.gz |
warn about commas in function arguments; inspired by mdoclint(1)
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 23649490..15ee201b 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -100,6 +100,7 @@ static int post_en(POST_ARGS); static int post_es(POST_ARGS); static int post_eoln(POST_ARGS); static int post_ex(POST_ARGS); +static int post_fa(POST_ARGS); static int post_fo(POST_ARGS); static int post_hyph(POST_ARGS); static int post_hyphtext(POST_ARGS); @@ -157,10 +158,10 @@ static const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Er */ { NULL, NULL }, /* Ev */ { pre_std, post_ex }, /* Ex */ - { NULL, NULL }, /* Fa */ + { NULL, post_fa }, /* Fa */ { NULL, ewarn_ge1 }, /* Fd */ { NULL, NULL }, /* Fl */ - { NULL, NULL }, /* Fn */ + { NULL, post_fa }, /* Fn */ { NULL, NULL }, /* Ft */ { NULL, NULL }, /* Ic */ { NULL, ewarn_eq1 }, /* In */ @@ -1008,6 +1009,28 @@ post_fo(POST_ARGS) } static int +post_fa(POST_ARGS) +{ + const struct mdoc_node *n; + const char *cp; + + for (n = mdoc->last->child; n != NULL; n = n->next) { + for (cp = n->string; *cp != '\0'; cp++) { + /* Ignore callbacks and alterations. */ + if (*cp == '(' || *cp == '{') + break; + if (*cp != ',') + continue; + mandoc_msg(MANDOCERR_FA_COMMA, mdoc->parse, + n->line, n->pos + (cp - n->string), + n->string); + break; + } + } + return(1); +} + +static int post_vt(POST_ARGS) { const struct mdoc_node *n; |