aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-06 16:06:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-06 16:06:25 +0000
commitf5b94dbc5c8c520ba699b3625ee96b70beec3a75 (patch)
tree71ec0c7d6d8a379984f45d96e9e75b7d77eafaa4
parent70a62057d81d665dae089691140a2714bd510348 (diff)
downloadmandoc-f5b94dbc5c8c520ba699b3625ee96b70beec3a75.tar.gz
mandoc-f5b94dbc5c8c520ba699b3625ee96b70beec3a75.tar.zst
mandoc-f5b94dbc5c8c520ba699b3625ee96b70beec3a75.zip
replace the last legacy generic message type, "argument count wrong",
by more specific messages, improving diagnostics for .cc .tr .Bl -column
-rw-r--r--mandoc.123
-rw-r--r--mandoc.h5
-rw-r--r--mdoc_validate.c6
-rw-r--r--read.c5
-rw-r--r--roff.c11
5 files changed, 31 insertions, 19 deletions
diff --git a/mandoc.1 b/mandoc.1
index 7f08e5a3..c30c210d 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.150 2015/02/06 11:54:36 schwarze Exp $
+.\" $Id: mandoc.1,v 1.151 2015/02/06 16:06:25 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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-defined macro name to be called,
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
diff --git a/mandoc.h b/mandoc.h
index 0b94ed7d..c088d7de 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.199 2015/02/06 11:54:36 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.200 2015/02/06 16:06:25 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 01138f2a..830e9e27 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.275 2015/02/06 07:13:14 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.276 2015/02/06 16:06:25 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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();
diff --git a/read.c b/read.c
index 523d0cf5..5f6775e3 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.125 2015/02/06 11:54:36 schwarze Exp $ */
+/* $Id: read.c,v 1.126 2015/02/06 16:06:25 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -161,12 +161,14 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"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[MANDOCERR_MAX] = {
/* 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 \"\"",
diff --git a/roff.c b/roff.c
index 4ec05eb9..0caceed0 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.259 2015/01/30 00:19:46 schwarze Exp $ */
+/* $Id: roff.c,v 1.260 2015/02/06 16:06:25 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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--;
}