source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: better diagnostics about excess arguments to .PD .ft .sp
@ 2015-02-06  9:39 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-06  9:39 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-06  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06  9:39 mdocml: better diagnostics about excess arguments to .PD .ft .sp 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).