diff options
-rw-r--r-- | mandoc.1 | 8 | ||||
-rw-r--r-- | mandoc.h | 1 | ||||
-rw-r--r-- | mdoc_validate.c | 29 | ||||
-rw-r--r-- | read.c | 1 |
4 files changed, 38 insertions, 1 deletions
@@ -1120,6 +1120,14 @@ An argument of an or .Ic \&Fn macro contains a comma; it should probably be split into two arguments. +.It Sy "parenthesis in function name" +.Pq mdoc +The first argument of an +.Ic \&Fc +or +.Ic \&Fn +macro contains an opening or closing parenthesis; that's probably wrong, +parentheses are added automatically. .It Sy "invalid content in Rs block" .Pq mdoc An @@ -114,6 +114,7 @@ enum mandocerr { MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */ MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: At version */ MANDOCERR_FA_COMMA, /* comma in function argument: arg */ + MANDOCERR_FN_PAREN, /* parenthesis in function name: arg */ MANDOCERR_RS_BAD, /* invalid content in Rs block: macro */ MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */ MANDOCERR_FT_BAD, /* unknown font, skipping request: ft font */ diff --git a/mdoc_validate.c b/mdoc_validate.c index 15ee201b..89978898 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -101,6 +101,8 @@ 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_fn(POST_ARGS); +static int post_fname(POST_ARGS); static int post_fo(POST_ARGS); static int post_hyph(POST_ARGS); static int post_hyphtext(POST_ARGS); @@ -161,7 +163,7 @@ static const struct valids mdoc_valids[MDOC_MAX] = { { NULL, post_fa }, /* Fa */ { NULL, ewarn_ge1 }, /* Fd */ { NULL, NULL }, /* Fl */ - { NULL, post_fa }, /* Fn */ + { NULL, post_fn }, /* Fn */ { NULL, NULL }, /* Ft */ { NULL, NULL }, /* Ic */ { NULL, ewarn_eq1 }, /* In */ @@ -1000,11 +1002,36 @@ post_eoln(POST_ARGS) } static int +post_fname(POST_ARGS) +{ + const struct mdoc_node *n; + size_t pos; + + n = mdoc->last->child; + pos = strcspn(n->string, "()"); + if (n->string[pos] != '\0') + mandoc_msg(MANDOCERR_FN_PAREN, mdoc->parse, + n->line, n->pos + pos, n->string); + return(1); +} + +static int +post_fn(POST_ARGS) +{ + + post_fname(mdoc); + post_fa(mdoc); + return(1); +} + +static int post_fo(POST_ARGS) { hwarn_eq1(mdoc); bwarn_ge1(mdoc); + if (mdoc->last->type == MDOC_HEAD) + post_fname(mdoc); return(1); } @@ -159,6 +159,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "skipping -width argument", "unknown AT&T UNIX version", "comma in function argument", + "parenthesis in function name", "invalid content in Rs block", "invalid Boolean argument", "unknown font, skipping request", |