source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: replace the last legacy generic message type, "argument count
@ 2015-02-06 16:06 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-06 16:06 UTC (permalink / raw)
  To: source

Log Message:
-----------
replace the last legacy generic message type, "argument count wrong",
by more specific messages, improving diagnostics for .cc .tr .Bl -column

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

Revision Data
-------------
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.199
retrieving revision 1.200
diff -Lmandoc.h -Lmandoc.h -u -p -r1.199 -r1.200
--- mandoc.h
+++ mandoc.h
@@ -117,12 +117,14 @@ enum	mandocerr {
 	MANDOCERR_BD_REP, /* skipping duplicate display type: Bd -type */
 	MANDOCERR_BL_REP, /* skipping duplicate list type: Bl -type */
 	MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */
+	MANDOCERR_BL_COL, /* wrong number of cells */
 	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 */
+	MANDOCERR_TR_ODD, /* odd number of characters in request: tr char */
 
 	/* related to plain text */
 	MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */
@@ -167,7 +169,6 @@ enum	mandocerr {
 
 	/* related to request and macro arguments */
 	MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */
-	MANDOCERR_ARGCOUNT, /* argument count wrong */
 	MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */
 	MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */
 	MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.150
retrieving revision 1.151
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.150 -r1.151
--- mandoc.1
+++ mandoc.1
@@ -1201,6 +1201,15 @@ list has a
 .Fl width
 argument.
 That has no effect.
+.It Sy "wrong number of cells"
+In a line of a
+.Ic \&Bl Fl column
+list, the number of tabs or
+.Ic \&Ta
+macros is less than the number expected from the list header line
+or exceeds the expected number by more than one.
+Missing cells remain empty, and all cells exceeding the number of
+columns are joined into one single cell.
 .It Sy "unknown AT&T UNIX version"
 .Pq mdoc
 An
@@ -1252,6 +1261,12 @@ request or a
 layout modifier has an unknown
 .Ar font
 argument.
+.It Sy "odd number of characters in request"
+.Pq roff
+A
+.Ic \&tr
+request contains an odd number of characters.
+The last character is mapped to the blank character.
 .El
 .Ss "Warnings related to plain text"
 .Bl -ohang
@@ -1538,12 +1553,6 @@ When parsing for a request or a user-def
 only the escape sequence is discarded.
 The characters preceding it are used as the request or macro name,
 the characters following it are used as the arguments to the request or macro.
-.It Sy "argument count wrong"
-.Pq mdoc , man , roff
-The indicated request or macro has too few or too many arguments.
-The syntax tree will contain the wrong number of arguments as given.
-Formatting behaviour depends on the specific request or macro in question.
-Note that the same message may also occur as a WARNING, see above.
 .It Sy "NOT IMPLEMENTED: Bd -file"
 .Pq mdoc
 For security reasons, the
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -Lroff.c -Lroff.c -u -p -r1.259 -r1.260
--- roff.c
+++ roff.c
@@ -2538,7 +2538,8 @@ roff_cc(ROFF_ARGS)
 		r->control = 0;
 
 	if (*p != '\0')
-		mandoc_msg(MANDOCERR_ARGCOUNT, r->parse, ln, ppos, NULL);
+		mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
+		    ln, p - buf->buf, "cc ... %s", p);
 
 	return(ROFF_IGN);
 }
@@ -2553,7 +2554,7 @@ roff_tr(ROFF_ARGS)
 	p = buf->buf + pos;
 
 	if (*p == '\0') {
-		mandoc_msg(MANDOCERR_ARGCOUNT, r->parse, ln, ppos, NULL);
+		mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, "tr");
 		return(ROFF_IGN);
 	}
 
@@ -2581,8 +2582,8 @@ roff_tr(ROFF_ARGS)
 			}
 			ssz = (size_t)(p - second);
 		} else if (*second == '\0') {
-			mandoc_msg(MANDOCERR_ARGCOUNT, r->parse,
-			    ln, (int)(p - buf->buf), NULL);
+			mandoc_vmsg(MANDOCERR_TR_ODD, r->parse,
+			    ln, first - buf->buf, "tr %s", first);
 			second = " ";
 			p--;
 		}
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -Lread.c -Lread.c -u -p -r1.125 -r1.126
--- read.c
+++ read.c
@@ -161,12 +161,14 @@ static	const char * const	mandocerrs[MAN
 	"skipping duplicate display type",
 	"skipping duplicate list type",
 	"skipping -width argument",
+	"wrong number of cells",
 	"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",
+	"odd number of characters in request",
 
 	/* related to plain text */
 	"blank line in fill mode, using .sp",
@@ -211,7 +213,6 @@ static	const char * const	mandocerrs[MAN
 
 	/* related to request and macro arguments */
 	"escaped character not allowed in a name",
-	"argument count wrong",
 	"NOT IMPLEMENTED: Bd -file",
 	"missing list type, using -item",
 	"missing manual name, using \"\"",
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.275 -r1.276
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -1221,9 +1221,9 @@ post_it(POST_ARGS)
 				i++;
 
 		if (i < cols || i > cols + 1)
-			mandoc_vmsg(MANDOCERR_ARGCOUNT,
+			mandoc_vmsg(MANDOCERR_BL_COL,
 			    mdoc->parse, nit->line, nit->pos,
-			    "columns == %d (have %d)", cols, i);
+			    "%d columns, %d cells", cols, i);
 		break;
 	default:
 		abort();
--
 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 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06 16:06 mdocml: replace the last legacy generic message type, "argument count 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).