From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id d3fc599c; for ; Fri, 6 Feb 2015 04:39:13 -0500 (EST) Date: Fri, 6 Feb 2015 04:39:13 -0500 (EST) Message-Id: <4187349493115544439.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: better diagnostics about excess arguments to .PD .ft .sp X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- better diagnostics about excess arguments to .PD .ft .sp Modified Files: -------------- mdocml: man_macro.c man_validate.c mandoc.1 Revision Data ------------- Index: mandoc.1 =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v retrieving revision 1.148 retrieving revision 1.149 diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.148 -r1.149 --- mandoc.1 +++ mandoc.1 @@ -1661,6 +1661,10 @@ are invoked with invalid arguments, the .Ic \&RE macro is invoked with more than one argument or with a non-integer argument, the +.Ic \&PD +macro or the +.Ic \&ft +or .Ic \&sp request is invoked with more than one argument, or a request of the .Ic \&de Index: man_macro.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_macro.c,v retrieving revision 1.96 retrieving revision 1.97 diff -Lman_macro.c -Lman_macro.c -u -p -r1.96 -r1.97 --- man_macro.c +++ man_macro.c @@ -427,6 +427,13 @@ in_line_eoln(MACRO_PROT_ARGS) man_macronames[tok], buf + *pos); break; } + if (buf[*pos] != '\0' && man->last != n && + (tok == MAN_PD || tok == MAN_ft || tok == MAN_sp)) { + mandoc_vmsg(MANDOCERR_ARG_EXCESS, + man->parse, line, *pos, "%s ... %s", + man_macronames[tok], buf + *pos); + break; + } la = *pos; if ( ! man_args(man, line, pos, buf, &p)) break; Index: man_validate.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_validate.c,v retrieving revision 1.111 retrieving revision 1.112 diff -Lman_validate.c -Lman_validate.c -u -p -r1.111 -r1.112 --- man_validate.c +++ man_validate.c @@ -39,7 +39,6 @@ typedef void (*v_check)(CHKARGS); static void check_eq2(CHKARGS); -static void check_le1(CHKARGS); static void check_le5(CHKARGS); static void check_par(CHKARGS); static void check_part(CHKARGS); @@ -85,7 +84,7 @@ static v_check man_valids[MAN_MAX] = { check_part, /* RS */ NULL, /* DT */ post_UC, /* UC */ - check_le1, /* PD */ + NULL, /* PD */ post_AT, /* AT */ NULL, /* in */ post_ft, /* ft */ @@ -182,7 +181,6 @@ check_##name(CHKARGS) \ } INEQ_DEFINE(2, ==, eq2) -INEQ_DEFINE(1, <=, le1) INEQ_DEFINE(5, <=, le5) static void @@ -240,10 +238,6 @@ post_ft(CHKARGS) n->line, n->pos, "ft %s", cp); *cp = '\0'; } - - if (1 < n->nchild) - mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, - n->pos, "want one child (have %d)", n->nchild); } static void @@ -494,9 +488,6 @@ post_AT(CHKARGS) static void post_vs(CHKARGS) { - - if (n->tok == MAN_sp) - check_le1(man, n); if (NULL != n->prev) return; -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv