summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.18
-rw-r--r--mandoc.h1
-rw-r--r--mdoc_validate.c29
-rw-r--r--read.c1
4 files changed, 38 insertions, 1 deletions
diff --git a/mandoc.1 b/mandoc.1
index fc203c3e..7340a8d2 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -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
diff --git a/mandoc.h b/mandoc.h
index fac9d1bc..d18d5c97 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -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);
}
diff --git a/read.c b/read.c
index 346bee13..2b984371 100644
--- a/read.c
+++ b/read.c
@@ -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",