source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Split MANDOCERR_IGNARGV into one message for .An and one for .Bl
Date: Thu, 31 Jul 2014 05:22:22 -0400 (EDT)	[thread overview]
Message-ID: <201407310922.s6V9MMRR030766@krisdoz.my.domain> (raw)

Log Message:
-----------
Split MANDOCERR_IGNARGV into one message for .An and one for .Bl 
and report the macro name and argument.

Modified Files:
--------------
    mdocml:
        mandoc.h
        mdoc_validate.c
        read.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.237
retrieving revision 1.238
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.237 -r1.238
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -568,8 +568,9 @@ static int
 pre_bl(PRE_ARGS)
 {
 	struct mdoc_node *np;
-	struct mdoc_argv *argv;
+	struct mdoc_argv *argv, *wa;
 	int		  i;
+	enum mdocargt	  mdoclt;
 	enum mdoc_list	  lt;
 
 	if (MDOC_BLOCK != n->type) {
@@ -591,6 +592,8 @@ pre_bl(PRE_ARGS)
 	 * ones.  If we find no list type, we default to LIST_item.
 	 */
 
+	wa = n->args->argv;
+	mdoclt = MDOC_ARG_MAX;
 	for (i = 0; n->args && i < (int)n->args->argc; i++) {
 		argv = n->args->argv + i;
 		lt = LIST__NONE;
@@ -638,6 +641,7 @@ pre_bl(PRE_ARGS)
 			n->norm->Bl.comp = 1;
 			break;
 		case MDOC_Width:
+			wa = argv;
 			if (0 == argv->sz) {
 				mandoc_msg(MANDOCERR_ARG_EMPTY,
 				    mdoc->parse, argv->line,
@@ -671,6 +675,7 @@ pre_bl(PRE_ARGS)
 		}
 		if (LIST__NONE == lt)
 			continue;
+		mdoclt = argv->arg;
 
 		/* Check: multiple list types. */
 
@@ -726,7 +731,9 @@ pre_bl(PRE_ARGS)
 		/* FALLTHROUGH */
 	case LIST_item:
 		if (n->norm->Bl.width)
-			mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
+			mandoc_vmsg(MANDOCERR_BL_SKIPW, mdoc->parse,
+			    wa->line, wa->pos, "Bl -%s",
+			    mdoc_argnames[mdoclt]);
 		break;
 	case LIST_bullet:
 		/* FALLTHROUGH */
@@ -838,18 +845,23 @@ pre_bd(PRE_ARGS)
 static int
 pre_an(PRE_ARGS)
 {
-	int		 i;
+	struct mdoc_argv *argv;
+	size_t	 i;
 
-	if (NULL == n->args)
+	if (n->args == NULL)
 		return(1);
 
-	for (i = 1; i < (int)n->args->argc; i++)
-		mdoc_pmsg(mdoc, n->args->argv[i].line,
-		    n->args->argv[i].pos, MANDOCERR_IGNARGV);
+	for (i = 1; i < n->args->argc; i++) {
+		argv = n->args->argv + i;
+		mandoc_vmsg(MANDOCERR_AN_REP,
+		    mdoc->parse, argv->line, argv->pos,
+		    "An -%s", mdoc_argnames[argv->arg]);
+	}
 
-	if (MDOC_Split == n->args->argv[0].arg)
+	argv = n->args->argv;
+	if (argv->arg == MDOC_Split)
 		n->norm->An.auth = AUTH_split;
-	else if (MDOC_Nosplit == n->args->argv[0].arg)
+	else if (argv->arg == MDOC_Nosplit)
 		n->norm->An.auth = AUTH_nosplit;
 	else
 		abort();
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -Lmandoc.h -Lmandoc.h -u -p -r1.148 -r1.149
--- mandoc.h
+++ mandoc.h
@@ -100,11 +100,12 @@ enum	mandocerr {
 	MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */
 
 	/* related to bad arguments */
-	MANDOCERR_IGNARGV, /* skipping argument */
 	MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */
 	MANDOCERR_ARG_REP, /* duplicate argument: macro arg */
+	MANDOCERR_AN_REP, /* skipping duplicate argument: An -arg */
 	MANDOCERR_BD_REP, /* skipping duplicate display type: type */
 	MANDOCERR_BL_REP, /* skipping duplicate list type: type */
+	MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */
 	MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: version */
 	MANDOCERR_RS_BAD, /* invalid content in Rs block: macro */
 	MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */
Index: read.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -Lread.c -Lread.c -u -p -r1.75 -r1.76
--- read.c
+++ read.c
@@ -144,11 +144,12 @@ static	const char * const	mandocerrs[MAN
 	"missing -std argument, adding it",
 
 	/* related to bad macro arguments */
-	"skipping argument",
 	"unterminated quoted argument",
 	"duplicate argument",
+	"skipping duplicate argument",
 	"skipping duplicate display type",
 	"skipping duplicate list type",
+	"skipping -width argument",
 	"unknown AT&T UNIX version",
 	"invalid content in Rs block",
 	"invalid Boolean argument",
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2014-07-31  9:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201407310922.s6V9MMRR030766@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).