* mdocml: warn about commas in function arguments; inspired by mdoclint(1)
@ 2014-09-12 0:54 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-09-12 0:54 UTC (permalink / raw)
To: source
Log Message:
-----------
warn about commas in function arguments; inspired by mdoclint(1)
Modified Files:
--------------
mdocml:
mandoc.1
mandoc.h
mdoc_validate.c
read.c
Revision Data
-------------
Index: mandoc.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.1,v
retrieving revision 1.112
retrieving revision 1.113
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.112 -r1.113
--- mandoc.1
+++ mandoc.1
@@ -1118,6 +1118,13 @@ macro has an invalid argument.
It is used verbatim, with
.Qq "AT&T UNIX "
prefixed to it.
+.It Sy "comma in function argument"
+.Pq mdoc
+An argument of an
+.Ic \&Fa
+or
+.Ic \&Fn
+macro contains a comma; it should probably be split into two arguments.
.It Sy "invalid content in Rs block"
.Pq mdoc
An
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.248 -r1.249
--- mdoc_validate.c
+++ 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[M
{ 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 */
@@ -1004,6 +1005,28 @@ post_fo(POST_ARGS)
hwarn_eq1(mdoc);
bwarn_ge1(mdoc);
+ return(1);
+}
+
+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);
}
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.155
retrieving revision 1.156
diff -Lmandoc.h -Lmandoc.h -u -p -r1.155 -r1.156
--- mandoc.h
+++ mandoc.h
@@ -113,6 +113,7 @@ enum mandocerr {
MANDOCERR_BL_REP, /* skipping duplicate list type: Bl -type */
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_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 */
Index: read.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -Lread.c -Lread.c -u -p -r1.87 -r1.88
--- read.c
+++ read.c
@@ -158,6 +158,7 @@ static const char * const mandocerrs[MAN
"skipping duplicate list type",
"skipping -width argument",
"unknown AT&T UNIX version",
+ "comma in function argument",
"invalid content in Rs block",
"invalid Boolean argument",
"unknown font, skipping request",
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-12 0:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 0:54 mdocml: warn about commas in function arguments; inspired by mdoclint(1) schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).