tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* more ERROR cleanup
@ 2010-10-25  0:01 Ingo Schwarze
  0 siblings, 0 replies; only message in thread
From: Ingo Schwarze @ 2010-10-25  0:01 UTC (permalink / raw)
  To: tech

Hi,

i just checked the ERROR conditions - whether they really mean that
relevant information could get lost or the document structure could
be garbled.  It turned out most don't really lose information and
only have local effects, so they should be warnings; in particular:

NAMESECFIRST: nothing lost, merely a matter of convention
CHILD: nothing lost, local effect in .Vt
BADATT: nothing lost, local effect in .At
LISTREP: only the second type argument is lost, list will be fine
DISPREP: only the second type argument is lost, display will be fine
ARGVREP: only the repeated argument is lost
NONAME: local effect in .Nm or .Ex, .Ex will still format properly
MACROOBS: nothing lost except the obsolete macro
MACROEMPTY: nothing lost except the empty macro
BADBODY: nothing lost except the prolog macro
BADPROLOG: at the worst, some prolog info might get lost
BADNAMESEC: nothing lost, local effect in the name section
NOBLANKLN: actually formatted in a sane way
SCOPEREP: nothing lost, formatted in a sane way
NOTITLE: default title used, no other effect
DISPTYPE: -ragged is a sane default, no infomation loss
FONTTYPE: at the worst, wrong font, no information loss
IGNPAR: no information loss, just suppressing a blank line

While here, i have improved a few messages and made the
wording more uniform.  Besides, i have removed duplicate error
messages from mdoc_action.c, post_bl_tagwidth(), as the same
error has already been thrown in mdoc_validate.c, pre_bl().
And finally, i consolidated MANDOCERR_WIDTHARG into
MANDOCERR_IGNARGV, as requested by the FIXME.

OK?

Yours,
  Ingo


Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/main.c,v
retrieving revision 1.50
diff -u -p -r1.50 main.c
--- main.c	24 Oct 2010 18:15:43 -0000	1.50
+++ main.c	24 Oct 2010 23:27:10 -0000
@@ -104,65 +104,75 @@ static	const char * const	mandocerrs[MAN
 
 	"generic warning",
 
-	"text should be uppercase",
-	"sections out of conventional order",
-	"section name repeats",
-	"out of order prologue",
-	"repeated prologue entry",
-	"list type must come first",
-	"bad standard",
-	"bad library",
-	"tab in non-literal context",
-	"bad escape sequence",
-	"unterminated quoted string",
-	"argument requires the width argument",
-	"superfluous width argument",
-	"ignoring argument",
-	"bad date argument",
-	"bad width argument",
+	/* related to the prologue */
+	"no title in document",
+	"document title should be all caps",
 	"unknown manual section",
-	"nested displays are not portable",
+	"cannot parse date argument",
+	"prologue macros out of order",
+	"duplicate prologue macro",
+	"macro not allowed in prologue",
+	"macro not allowed in body",
+
+	/* related to document structure */
+	"NAME section must come first",
+	"bad NAME section contents",
+	"manual name not yet set",
+	"sections out of conventional order",
+	"duplicate section name",
 	"section not in conventional manual section",
-	"end of line whitespace",
+
+	/* related to macros and nesting */
+	"skipping obsolete macro",
+	"skipping paragraph macro",
 	"blocks badly nested",
+	"child violates parent syntax",
+	"nested displays are not portable",
+	"already in literal mode",
 
-	"generic error",
+	/* related to missing macro arguments */
+	"skipping empty macro",
+	"missing display type",
+	"list type must come first",
+	"tag lists require a width argument",
+	"missing font type",
 
-	"NAME section must come first",
+	/* related to bad macro arguments */
+	"skipping argument",
+	"duplicate argument",
+	"duplicate display type",
+	"duplicate list type",
+	"unknown AT&T UNIX version",
 	"bad Boolean value",
-	"child violates parent syntax",
-	"bad AT&T symbol",
-	"list type repeated",
-	"display type repeated",
-	"argument repeated",
-	"manual name not yet set",
-	"obsolete macro ignored",
-	"empty macro ignored",
-	"macro not allowed in body",
-	"macro not allowed in prologue",
-	"bad character",
-	"bad NAME section contents",
-	"no blank lines",
-	"no text in this context",
+	"unknown library specifier",
+	"unknown standard specifier",
+	"bad width argument",
+
+	/* related to plain text */
+	"blank line in non-literal context",
+	"tab in non-literal context",
+	"end of line whitespace",
 	"bad comment style",
-	"unknown macro will be lost",
+	"unknown escape sequence",
+	"unterminated quoted string",
+
+	"generic error",
+
+	"skipping bad character",
+	"skipping text before the first section header",
+	"skipping unknown macro",
 	"line scope broken",
 	"argument count wrong",
-	"request scope close w/none open",
+	"skipping end of block that is not open",
 	"missing end of block",
-	"scope already open",
 	"scope open on exit",
 	"uname(3) system call failed",
 	"macro requires line argument(s)",
 	"macro requires body argument(s)",
 	"macro requires argument(s)",
-	"no title in document",
 	"missing list type",
-	"missing display type",
-	"missing font type",
 	"line argument(s) will be lost",
 	"body argument(s) will be lost",
-	"paragraph macro ignored",
 	"tbl(1) error",
 
 	"generic fatal error",
Index: mandoc.h
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mandoc.h,v
retrieving revision 1.17
diff -u -p -r1.17 mandoc.h
--- mandoc.h	24 Oct 2010 18:15:43 -0000	1.17
+++ mandoc.h	24 Oct 2010 23:27:10 -0000
@@ -45,66 +45,76 @@ enum	mandocerr {
 	MANDOCERR_OK,
 
 	MANDOCERR_WARNING, /* ===== start of warnings ===== */
-	MANDOCERR_UPPERCASE, /* text should be uppercase */
-	MANDOCERR_SECOOO, /* sections out of conventional order */
-	MANDOCERR_SECREP, /* section name repeats */
-	MANDOCERR_PROLOGOOO, /* out of order prologue */
-	MANDOCERR_PROLOGREP, /* repeated prologue entry */
-	MANDOCERR_LISTFIRST, /* list type must come first */
-	MANDOCERR_BADSTANDARD, /* bad standard */
-	MANDOCERR_BADLIB, /* bad library */
-	MANDOCERR_BADTAB, /* tab in non-literal context */
-	MANDOCERR_BADESCAPE, /* bad escape sequence */
-	MANDOCERR_BADQUOTE, /* unterminated quoted string */
-	MANDOCERR_NOWIDTHARG, /* argument requires the width argument */
-	/* FIXME: merge with MANDOCERR_IGNARGV. */
-	MANDOCERR_WIDTHARG, /* superfluous width argument */
-	MANDOCERR_IGNARGV, /* ignoring argument */
-	MANDOCERR_BADDATE, /* bad date argument */
-	MANDOCERR_BADWIDTH, /* bad width argument */
+
+	/* related to the prologue */
+	MANDOCERR_NOTITLE, /* no title in document */
+	MANDOCERR_UPPERCASE, /* document title should be all caps */
 	MANDOCERR_BADMSEC, /* unknown manual section */
-	MANDOCERR_NESTEDDISP, /* nested displays are not portable */
+	MANDOCERR_BADDATE, /* cannot parse date argument */
+	MANDOCERR_PROLOGOOO, /* prologue macros out of order */
+	MANDOCERR_PROLOGREP, /* duplicate prologue macro */
+	MANDOCERR_BADPROLOG, /* macro not allowed in prologue */
+	MANDOCERR_BADBODY, /* macro not allowed in body */
+
+	/* related to document structure */
+	MANDOCERR_NAMESECFIRST, /* NAME section must come first */
+	MANDOCERR_BADNAMESEC, /* bad NAME section contents */
+	MANDOCERR_NONAME, /* manual name not yet set */
+	MANDOCERR_SECOOO, /* sections out of conventional order */
+	MANDOCERR_SECREP, /* duplicate section name */
 	MANDOCERR_SECMSEC, /* section not in conventional manual section */
-	MANDOCERR_EOLNSPACE, /* end of line whitespace */
+
+	/* related to macros and nesting */
+	MANDOCERR_MACROOBS, /* skipping obsolete macro */
+	MANDOCERR_IGNPAR, /* skipping paragraph macro */
 	MANDOCERR_SCOPENEST, /* blocks badly nested */
+	MANDOCERR_CHILD, /* child violates parent syntax */
+	MANDOCERR_NESTEDDISP, /* nested displays are not portable */
+	MANDOCERR_SCOPEREP, /* already in literal mode */
 
-	MANDOCERR_ERROR, /* ===== start of errors ===== */
-	MANDOCERR_NAMESECFIRST, /* NAME section must come first */
+	/* related to missing macro arguments */
+	MANDOCERR_MACROEMPTY, /* skipping empty macro */
+	MANDOCERR_DISPTYPE, /* missing display type */
+	MANDOCERR_LISTFIRST, /* list type must come first */
+	MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */
+	MANDOCERR_FONTTYPE, /* missing font type */
+
+	/* related to bad macro arguments */
+	MANDOCERR_IGNARGV, /* skipping argument */
+	MANDOCERR_ARGVREP, /* duplicate argument */
+	MANDOCERR_DISPREP, /* duplicate display type */
+	MANDOCERR_LISTREP, /* duplicate list type */
+	MANDOCERR_BADATT, /* unknown AT&T UNIX version */
 	MANDOCERR_BADBOOL, /* bad Boolean value */
-	MANDOCERR_CHILD, /* child violates parent syntax */
-	MANDOCERR_BADATT, /* bad AT&T symbol */
-	MANDOCERR_LISTREP, /* list type repeated */
-	MANDOCERR_DISPREP, /* display type repeated */
-	MANDOCERR_ARGVREP, /* argument repeated */
-	MANDOCERR_NONAME, /* manual name not yet set */
-	MANDOCERR_MACROOBS, /* obsolete macro ignored */
-	MANDOCERR_MACROEMPTY, /* empty macro ignored */
-	MANDOCERR_BADBODY, /* macro not allowed in body */
-	MANDOCERR_BADPROLOG, /* macro not allowed in prologue */
-	MANDOCERR_BADCHAR, /* bad character */
-	MANDOCERR_BADNAMESEC, /* bad NAME section contents */
-	MANDOCERR_NOBLANKLN, /* no blank lines */
-	MANDOCERR_NOTEXT, /* no text in this context */
+	MANDOCERR_BADLIB, /* unknown library specifier */
+	MANDOCERR_BADSTANDARD, /* unknown standard specifier */
+	MANDOCERR_BADWIDTH, /* bad width argument */
+
+	/* related to plain text */
+	MANDOCERR_NOBLANKLN, /* blank line in non-literal context */
+	MANDOCERR_BADTAB, /* tab in non-literal context */
+	MANDOCERR_EOLNSPACE, /* end of line whitespace */
 	MANDOCERR_BADCOMMENT, /* bad comment style */
-	MANDOCERR_MACRO, /* unknown macro will be lost */
+	MANDOCERR_BADESCAPE, /* unknown escape sequence */
+	MANDOCERR_BADQUOTE, /* unterminated quoted string */
+
+	MANDOCERR_ERROR, /* ===== start of errors ===== */
+	MANDOCERR_BADCHAR, /* skipping bad character */
+	MANDOCERR_NOTEXT, /* skipping text before the first section header */
+	MANDOCERR_MACRO, /* skipping unknown macro */
 	MANDOCERR_LINESCOPE, /* line scope broken */
 	MANDOCERR_ARGCOUNT, /* argument count wrong */
-	MANDOCERR_NOSCOPE, /* no such block is open */
+	MANDOCERR_NOSCOPE, /* skipping end of block that is not open */
 	MANDOCERR_SCOPEBROKEN, /* missing end of block */
-	MANDOCERR_SCOPEREP, /* scope already open */
 	MANDOCERR_SCOPEEXIT, /* scope open on exit */
 	MANDOCERR_UNAME, /* uname(3) system call failed */
 	/* FIXME: merge following with MANDOCERR_ARGCOUNT */
 	MANDOCERR_NOARGS, /* macro requires line argument(s) */
 	MANDOCERR_NOBODY, /* macro requires body argument(s) */
 	MANDOCERR_NOARGV, /* macro requires argument(s) */
-	MANDOCERR_NOTITLE, /* no title in document */
 	MANDOCERR_LISTTYPE, /* missing list type */
-	MANDOCERR_DISPTYPE, /* missing display type */
-	MANDOCERR_FONTTYPE, /* missing font type */
 	MANDOCERR_ARGSLOST, /* line argument(s) will be lost */
 	MANDOCERR_BODYLOST, /* body argument(s) will be lost */
-	MANDOCERR_IGNPAR, /* paragraph macro ignored */
 	MANDOCERR_TBL, /* tbl(1) error */
 
 	MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
Index: mdoc_action.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_action.c,v
retrieving revision 1.46
diff -u -p -r1.46 mdoc_action.c
--- mdoc_action.c	24 Oct 2010 18:15:43 -0000	1.46
+++ mdoc_action.c	24 Oct 2010 23:27:11 -0000
@@ -665,12 +665,8 @@ post_bl_tagwidth(POST_ARGS)
 		assert(MDOC_BLOCK == nn->type);
 		nn = nn->head->child;
 
-		if (nn == NULL) {
-			/* No -width for .Bl and first .It is emtpy */
-			if ( ! mdoc_nmsg(m, n, MANDOCERR_NOWIDTHARG))
-				return(0);
+		if (nn == NULL)
 			break;
-		}
 
 		if (MDOC_TEXT == nn->type) {
 			sz = strlen(nn->string) + 1;
@@ -679,8 +675,6 @@ post_bl_tagwidth(POST_ARGS)
 
 		if (0 != (ssz = mdoc_macro2len(nn->tok)))
 			sz = ssz;
-		else if ( ! mdoc_nmsg(m, n, MANDOCERR_NOWIDTHARG))
-			return(0);
 
 		break;
 	} 
Index: mdoc_validate.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_validate.c,v
retrieving revision 1.74
diff -u -p -r1.74 mdoc_validate.c
--- mdoc_validate.c	24 Oct 2010 18:15:43 -0000	1.74
+++ mdoc_validate.c	24 Oct 2010 23:27:12 -0000
@@ -731,11 +731,9 @@ pre_bl(PRE_ARGS)
 	case (LIST_inset):
 		/* FALLTHROUGH */
 	case (LIST_item):
-		if (NULL == n->data.Bl->width)
-			break;
-		if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG))
-			break;
-		return(0);
+		if (n->data.Bl->width)
+			mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
+		break;
 	default:
 		break;
 	}
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2010-10-25  0:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25  0:01 more ERROR cleanup Ingo 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).