diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-07-07 21:35:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-07-07 21:35:43 +0000 |
commit | 0eaec9e69f942d1f7150392b86029c266106e548 (patch) | |
tree | 6a277ced0f740e1fe6439c5d7fb1cf1a9fbfbcc9 | |
parent | 94c6c9333a40e6a83829325e18a44644de0c4c13 (diff) |
Clean up ERROR messages related to document structure and macros:
Hierarchical naming and mention macro names in messages.
35 files changed, 212 insertions, 67 deletions
diff --git a/regress/usr.bin/mandoc/char/space/leading-man.in b/regress/usr.bin/mandoc/char/space/leading-man.in index 7e1483f39a4..6d48f3be50f 100644 --- a/regress/usr.bin/mandoc/char/space/leading-man.in +++ b/regress/usr.bin/mandoc/char/space/leading-man.in @@ -1,12 +1,11 @@ .TH SPACE-LEADING-MAN 1 "January 15, 2011" OpenBSD .SH NAME -pace-leading-man \- leading spaces on text lines in man documents +space-leading-man \- leading spaces on text lines in man documents .SH DESCRIPTION normal line of text second normal line leading space .BI bold italic normal after macro -.B .BI bold italic leading space after a macro line diff --git a/regress/usr.bin/mandoc/char/space/leading-man.out_ascii b/regress/usr.bin/mandoc/char/space/leading-man.out_ascii index 6d837322f47..a8d468b86d7 100644 --- a/regress/usr.bin/mandoc/char/space/leading-man.out_ascii +++ b/regress/usr.bin/mandoc/char/space/leading-man.out_ascii @@ -3,7 +3,7 @@ SPACE-LEADING-MAN(1) OpenBSD Reference Manual SPACE-LEADING-MAN(1) NNAAMMEE - pace-leading-man - leading spaces on text lines in man documents + space-leading-man - leading spaces on text lines in man documents DDEESSCCRRIIPPTTIIOONN normal line of text second normal line diff --git a/regress/usr.bin/mandoc/man/RS/Makefile b/regress/usr.bin/mandoc/man/RS/Makefile index 6d0c822dfaf..66fdf8d55b5 100644 --- a/regress/usr.bin/mandoc/man/RS/Makefile +++ b/regress/usr.bin/mandoc/man/RS/Makefile @@ -1,5 +1,6 @@ -# $OpenBSD: Makefile,v 1.6 2014/02/16 12:30:52 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2014/07/07 21:35:42 schwarze Exp $ -REGRESS_TARGETS = breaking empty literal lonelyRE nested width +REGRESS_TARGETS = breaking empty literal lonelyRE nested noRE width +LINT_TARGETS = lonelyRE noRE .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/man/RS/lonelyRE.out_lint b/regress/usr.bin/mandoc/man/RS/lonelyRE.out_lint new file mode 100644 index 00000000000..8cb300289ed --- /dev/null +++ b/regress/usr.bin/mandoc/man/RS/lonelyRE.out_lint @@ -0,0 +1,3 @@ +mandoc: lonelyRE.in:11:2: ERROR: skipping end of block that is not open: RE +mandoc: lonelyRE.in:15:2: ERROR: skipping end of block that is not open: RE +mandoc: lonelyRE.in:20:2: ERROR: skipping end of block that is not open: RE diff --git a/regress/usr.bin/mandoc/man/RS/noRE.in b/regress/usr.bin/mandoc/man/RS/noRE.in new file mode 100644 index 00000000000..45ecbc26685 --- /dev/null +++ b/regress/usr.bin/mandoc/man/RS/noRE.in @@ -0,0 +1,9 @@ +.TH RS-NORE 1 "June 20, 2014" OpenBSD +.SH NAME +RS-noRE \- unclosed indented block +.SH DESCRIPTION +regular +text +.RS 8n +indented +text diff --git a/regress/usr.bin/mandoc/man/RS/noRE.out_ascii b/regress/usr.bin/mandoc/man/RS/noRE.out_ascii new file mode 100644 index 00000000000..cb0b4abf1b3 --- /dev/null +++ b/regress/usr.bin/mandoc/man/RS/noRE.out_ascii @@ -0,0 +1,14 @@ +RS-NORE(1) OpenBSD Reference Manual RS-NORE(1) + + + +NNAAMMEE + RS-noRE - unclosed indented block + +DDEESSCCRRIIPPTTIIOONN + regular text + indented text + + + +OpenBSD June 20, 2014 RS-NORE(1) diff --git a/regress/usr.bin/mandoc/man/RS/noRE.out_lint b/regress/usr.bin/mandoc/man/RS/noRE.out_lint new file mode 100644 index 00000000000..3c4c0a13aba --- /dev/null +++ b/regress/usr.bin/mandoc/man/RS/noRE.out_lint @@ -0,0 +1 @@ +mandoc: noRE.in:7:2: ERROR: appending missing end of block: RS diff --git a/regress/usr.bin/mandoc/man/TP/Makefile b/regress/usr.bin/mandoc/man/TP/Makefile index 7f3d995fe2e..0ff19165166 100644 --- a/regress/usr.bin/mandoc/man/TP/Makefile +++ b/regress/usr.bin/mandoc/man/TP/Makefile @@ -1,8 +1,13 @@ -# $OpenBSD: Makefile,v 1.8 2014/07/02 11:42:56 schwarze Exp $ +# $OpenBSD: Makefile,v 1.9 2014/07/07 21:35:42 schwarze Exp $ -REGRESS_TARGETS = badarg double literal longhead macrotag manyargs +REGRESS_TARGETS = badarg double eof literal longhead macrotag manyargs REGRESS_TARGETS += sameline width -LINT_TARGETS = double +LINT_TARGETS = double eof + +# groff-1.22.1 defect: +# - If the last line of the file is .TP, groff does not print a page footer. + +SKIP_GROFF = eof .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/man/TP/eof.in b/regress/usr.bin/mandoc/man/TP/eof.in new file mode 100644 index 00000000000..7ab9a100c00 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/eof.in @@ -0,0 +1,6 @@ +.TH TP-EOF 1 "July 7, 2014" OpenBSD +.SH NAME +TP-eof \- indented paragraph macro at the end of the file +.SH DESCRIPTION +The last line of the file is TP: +.TP diff --git a/regress/usr.bin/mandoc/man/TP/eof.out_ascii b/regress/usr.bin/mandoc/man/TP/eof.out_ascii new file mode 100644 index 00000000000..78f0868a7b8 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/eof.out_ascii @@ -0,0 +1,14 @@ +TP-EOF(1) OpenBSD Reference Manual TP-EOF(1) + + + +NNAAMMEE + TP-eof - indented paragraph macro at the end of the file + +DDEESSCCRRIIPPTTIIOONN + The last line of the file is TP: + + + + +OpenBSD July 7, 2014 TP-EOF(1) diff --git a/regress/usr.bin/mandoc/man/TP/eof.out_lint b/regress/usr.bin/mandoc/man/TP/eof.out_lint new file mode 100644 index 00000000000..b74b2a8cb21 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/eof.out_lint @@ -0,0 +1 @@ +mandoc: eof.in: WARNING: line scope broken: at end of file diff --git a/regress/usr.bin/mandoc/man/UR/Makefile b/regress/usr.bin/mandoc/man/UR/Makefile index a0230e4712b..d7ebab005c0 100644 --- a/regress/usr.bin/mandoc/man/UR/Makefile +++ b/regress/usr.bin/mandoc/man/UR/Makefile @@ -1,5 +1,11 @@ -# $OpenBSD: Makefile,v 1.1 2013/10/17 20:51:31 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2014/07/07 21:35:42 schwarze Exp $ -REGRESS_TARGETS = args +REGRESS_TARGETS = args noUE +LINT_TARGETS = noUE + +# groff-1.22.2 defect: +# - without .UE, .UR does not print the URI. + +SKIP_GROFF = noUE .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/man/UR/noUE.in b/regress/usr.bin/mandoc/man/UR/noUE.in new file mode 100644 index 00000000000..8b6f61ddf21 --- /dev/null +++ b/regress/usr.bin/mandoc/man/UR/noUE.in @@ -0,0 +1,11 @@ +.TH UR-NOUE 1 "July 7, 2014" OpenBSD +.SH NAME +UR-noUE \- unclosed URI macro +.SH DESCRIPTION +lonely UE: +.UE +.PP +argument plus text: +.UR http://www.openbsd.org/ +OpenBSD +homepage diff --git a/regress/usr.bin/mandoc/man/UR/noUE.out_ascii b/regress/usr.bin/mandoc/man/UR/noUE.out_ascii new file mode 100644 index 00000000000..d6ed2766a20 --- /dev/null +++ b/regress/usr.bin/mandoc/man/UR/noUE.out_ascii @@ -0,0 +1,15 @@ +UR-NOUE(1) OpenBSD Reference Manual UR-NOUE(1) + + + +NNAAMMEE + UR-noUE - unclosed URI macro + +DDEESSCCRRIIPPTTIIOONN + lonely UE: + + argument plus text: OpenBSD homepage <http://www.openbsd.org/> + + + +OpenBSD July 7, 2014 UR-NOUE(1) diff --git a/regress/usr.bin/mandoc/man/UR/noUE.out_lint b/regress/usr.bin/mandoc/man/UR/noUE.out_lint new file mode 100644 index 00000000000..d81fad0f634 --- /dev/null +++ b/regress/usr.bin/mandoc/man/UR/noUE.out_lint @@ -0,0 +1,2 @@ +mandoc: noUE.in:6:2: ERROR: skipping end of block that is not open: UE +mandoc: noUE.in:9:2: ERROR: appending missing end of block: UR diff --git a/regress/usr.bin/mandoc/mdoc/Bd/Makefile b/regress/usr.bin/mandoc/mdoc/Bd/Makefile index dd14ada5d29..a9036446555 100644 --- a/regress/usr.bin/mandoc/mdoc/Bd/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bd/Makefile @@ -1,12 +1,12 @@ -# $OpenBSD: Makefile,v 1.14 2014/07/06 19:08:57 schwarze Exp $ +# $OpenBSD: Makefile,v 1.15 2014/07/07 21:35:42 schwarze Exp $ REGRESS_TARGETS = blank nested spacing REGRESS_TARGETS += badargs empty offset-empty -REGRESS_TARGETS += break broken +REGRESS_TARGETS += break broken unclosed -LINT_TARGETS = blank nested badargs break broken +LINT_TARGETS = blank nested badargs break broken unclosed -# groff defect: +# groff-1.22.2 defect: # - a display breaking another block continues indefinitely SKIP_GROFF = break diff --git a/regress/usr.bin/mandoc/mdoc/Bd/unclosed.in b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.in new file mode 100644 index 00000000000..17c2c51dd17 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.in @@ -0,0 +1,10 @@ +.Dd July 7, 2014 +.Dt BD-UNCLOSED 1 +.Os OpenBSD +.Sh NAME +.Nm Bd-unclosed +.Nd display still open at the end of the file +.Sh DESCRIPTION +before display +.Bd -ragged -offset indent +inside display diff --git a/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_ascii b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_ascii new file mode 100644 index 00000000000..d9f01f0ae61 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_ascii @@ -0,0 +1,11 @@ +BD-UNCLOSED(1) OpenBSD Reference Manual BD-UNCLOSED(1) + +NNAAMMEE + BBdd--uunncclloosseedd - display still open at the end of the file + +DDEESSCCRRIIPPTTIIOONN + before display + + inside display + +OpenBSD July 7, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_lint b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_lint new file mode 100644 index 00000000000..8741513e839 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bd/unclosed.out_lint @@ -0,0 +1 @@ +mandoc: unclosed.in:9:2: ERROR: appending missing end of block: Bd diff --git a/regress/usr.bin/mandoc/mdoc/Bl/Makefile b/regress/usr.bin/mandoc/mdoc/Bl/Makefile index 6c18108a512..e6295a715a7 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.22 2014/07/05 01:11:33 schwarze Exp $ +# $OpenBSD: Makefile,v 1.23 2014/07/07 21:35:42 schwarze Exp $ REGRESS_TARGETS = item inset diag ohang bullet dash enum hang tag REGRESS_TARGETS += column extend nested @@ -9,7 +9,7 @@ REGRESS_TARGETS += bareTa unclosed break broken LINT_TARGETS = notype badargs LINT_TARGETS += noIt emptyhead emptytag emptyitem -LINT_TARGETS += break broken +LINT_TARGETS += bareTa break broken # groff-1.22.2 defects: # - lists with missing or late type ruin indentation diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bareTa.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/bareTa.out_lint new file mode 100644 index 00000000000..469e1023531 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/bareTa.out_lint @@ -0,0 +1,4 @@ +mandoc: bareTa.in:9:2: ERROR: skipping column outside column list +mandoc: bareTa.in:13:2: ERROR: skipping column outside column list +mandoc: bareTa.in:18:5: ERROR: skipping column outside column list +mandoc: bareTa.in:18:2: ERROR: skipping all arguments: It ignored arguments diff --git a/regress/usr.bin/mandoc/roff/cond/Makefile b/regress/usr.bin/mandoc/roff/cond/Makefile index fd88fc0988e..9c847081525 100644 --- a/regress/usr.bin/mandoc/roff/cond/Makefile +++ b/regress/usr.bin/mandoc/roff/cond/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.6 2014/07/03 21:23:08 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2014/07/07 21:35:42 schwarze Exp $ REGRESS_TARGETS = if ie close numeric strcmp before-Dd -LINT_TARGETS = if +LINT_TARGETS = if close .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/roff/cond/close.in b/regress/usr.bin/mandoc/roff/cond/close.in index af30596391f..7fa9142373d 100644 --- a/regress/usr.bin/mandoc/roff/cond/close.in +++ b/regress/usr.bin/mandoc/roff/cond/close.in @@ -10,3 +10,6 @@ closing after an ignored macro .PP .if t \{text \} closing after plain text +.PP +.if n \{ +still open at the end of the file diff --git a/regress/usr.bin/mandoc/roff/cond/close.out_ascii b/regress/usr.bin/mandoc/roff/cond/close.out_ascii index efe79fae324..9415813231d 100644 --- a/regress/usr.bin/mandoc/roff/cond/close.out_ascii +++ b/regress/usr.bin/mandoc/roff/cond/close.out_ascii @@ -12,6 +12,8 @@ DDEESSCCRRIIPPTTIIOONN closing after plain text + still open at the end of the file + OpenBSD 2013-06-27 COND-CLOSE(1) diff --git a/regress/usr.bin/mandoc/roff/cond/close.out_lint b/regress/usr.bin/mandoc/roff/cond/close.out_lint new file mode 100644 index 00000000000..e3419dbac11 --- /dev/null +++ b/regress/usr.bin/mandoc/roff/cond/close.out_lint @@ -0,0 +1 @@ +mandoc: close.in:14:1: ERROR: appending missing end of block: if diff --git a/regress/usr.bin/mandoc/roff/ig/basic.in b/regress/usr.bin/mandoc/roff/ig/basic.in index 904aeb974b7..7e89883294d 100644 --- a/regress/usr.bin/mandoc/roff/ig/basic.in +++ b/regress/usr.bin/mandoc/roff/ig/basic.in @@ -20,4 +20,8 @@ with two arguments ignored text .end2 .br -final text +Here is a stray .. block ending, +.. +and then an .ig staying open until the end of the file: +.ig +ignored text diff --git a/regress/usr.bin/mandoc/roff/ig/basic.out_ascii b/regress/usr.bin/mandoc/roff/ig/basic.out_ascii index 0535cdc8e83..540bb2b987c 100644 --- a/regress/usr.bin/mandoc/roff/ig/basic.out_ascii +++ b/regress/usr.bin/mandoc/roff/ig/basic.out_ascii @@ -7,6 +7,7 @@ DDEESSCCRRIIPPTTIIOONN no arguments with end marker with two arguments - final text + Here is a stray .. block ending, and then an .ig staying open until the + end of the file: OpenBSD July 7, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/roff/ig/basic.out_lint b/regress/usr.bin/mandoc/roff/ig/basic.out_lint index 75beb322b8d..2b03b9cf69f 100644 --- a/regress/usr.bin/mandoc/roff/ig/basic.out_lint +++ b/regress/usr.bin/mandoc/roff/ig/basic.out_lint @@ -1 +1,3 @@ mandoc: basic.in:19:5: ERROR: skipping excess arguments: .ig ... excess +mandoc: basic.in:24:1: ERROR: skipping end of block that is not open: .. +mandoc: basic.in:26:1: ERROR: appending missing end of block: ig diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index a38ff9e9675..87b15be981d 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.82 2014/07/07 19:17:39 schwarze Exp $ */ +/* $Id: man.c,v 1.83 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -538,7 +538,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) if (MAN_NSCOPED & man_macros[n->tok].flags) n = n->parent; - mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line, + mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line, n->pos, "%s breaks %s", man_macronames[tok], man_macronames[n->tok]); @@ -569,7 +569,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) assert(MAN_BLOCK == n->type); assert(MAN_SCOPED & man_macros[n->tok].flags); - mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line, + mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line, n->pos, "%s breaks %s", man_macronames[tok], man_macronames[n->tok]); diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index 671c8fec3d9..8ac4fd71781 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.46 2014/07/07 19:17:39 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.47 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -106,7 +106,7 @@ man_unscope(struct man *man, const struct man_node *to) MAN_BLOCK == n->type && 0 == (MAN_VALID & n->flags) && MAN_EXPLICIT & man_macros[n->tok].flags) - mandoc_msg(MANDOCERR_SCOPEEXIT, + mandoc_msg(MANDOCERR_BLK_NOEND, man->parse, n->line, n->pos, man_macronames[n->tok]); /* @@ -266,7 +266,8 @@ blk_close(MACRO_PROT_ARGS) break; if (NULL == nn) { - man_pmsg(man, line, ppos, MANDOCERR_NOSCOPE); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse, + line, ppos, man_macronames[tok]); if ( ! rew_scope(MAN_BLOCK, man, MAN_PP)) return(0); } else diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index bad90155585..b8fc6083faa 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.71 2014/07/06 19:08:56 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.72 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -186,10 +186,9 @@ static int check_root(CHKARGS) { - if (MAN_BLINE & man->flags) - man_nmsg(man, n, MANDOCERR_SCOPEEXIT); - else if (MAN_ELINE & man->flags) - man_nmsg(man, n, MANDOCERR_SCOPEEXIT); + if ((MAN_BLINE | MAN_ELINE) & man->flags) + mandoc_msg(MANDOCERR_BLK_LINE, man->parse, + 0, 0, "at end of file"); man->flags &= ~MAN_BLINE; man->flags &= ~MAN_ELINE; diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 0ef18391a11..7b42fece5e1 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.84 2014/07/07 16:12:06 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.85 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -75,13 +75,13 @@ enum mandocerr { MANDOCERR_PAR_SKIP, /* skipping paragraph macro: macro ... */ MANDOCERR_PAR_MOVE, /* moving paragraph macro out of list: macro */ MANDOCERR_NS_SKIP, /* skipping no-space macro */ - MANDOCERR_BLOCK_NEST, /* blocks badly nested: macro ... */ + MANDOCERR_BLK_NEST, /* blocks badly nested: macro ... */ MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */ MANDOCERR_BL_MOVE, /* moving content out of list: macro */ MANDOCERR_VT_CHILD, /* .Vt block has child macro: macro */ MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping .fi */ MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping .nf */ - MANDOCERR_LINESCOPE, /* line scope broken: macro breaks macro */ + MANDOCERR_BLK_LINE, /* line scope broken: macro breaks macro */ /* related to missing arguments */ MANDOCERR_REQ_EMPTY, /* skipping empty request: request */ @@ -136,17 +136,20 @@ enum mandocerr { MANDOCERR_TBLBLOCK, /* data block still open */ MANDOCERR_TBLEXTRADAT, /* ignoring extra data cells */ + /* related to document structure and macros */ MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */ MANDOCERR_BADCHAR, /* skipping bad character */ + MANDOCERR_MACRO, /* skipping unknown macro */ + MANDOCERR_TA_STRAY, /* skipping column outside column list */ + MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */ + MANDOCERR_BLK_BROKEN, /* inserting missing end of block: macro ... */ + MANDOCERR_BLK_NOEND, /* appending missing end of block: macro */ + + /* related to request and macro arguments */ MANDOCERR_NAMESC, /* escaped character not allowed in a name */ MANDOCERR_NONAME, /* manual name not yet set */ - MANDOCERR_MACRO, /* skipping unknown macro */ MANDOCERR_ARGCOUNT, /* argument count wrong */ MANDOCERR_ST_BAD, /* unknown standard specifier: standard */ - MANDOCERR_STRAYTA, /* skipping column outside column list */ - MANDOCERR_NOSCOPE, /* skipping end of block that is not open */ - MANDOCERR_SCOPEBROKEN, /* missing end of block */ - MANDOCERR_SCOPEEXIT, /* scope open on exit */ MANDOCERR_UNAME, /* uname(3) system call failed */ MANDOCERR_NUMERIC, /* request requires a numeric argument */ MANDOCERR_BL_NOTYPE, /* missing list type, using -item */ diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 1bf68f70b3b..40fdba9ba02 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.93 2014/07/04 16:11:41 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.94 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -230,7 +230,8 @@ mdoc_macroend(struct mdoc *mdoc) for ( ; n; n = n->parent) if (MDOC_BLOCK == n->type && MDOC_EXPLICIT & mdoc_macros[n->tok].flags) - mdoc_nmsg(mdoc, n, MANDOCERR_SCOPEEXIT); + mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse, + n->line, n->pos, mdoc_macronames[n->tok]); /* Rewind to the first. */ @@ -524,7 +525,7 @@ make_pending(struct mdoc_node *broken, enum mdoct tok, taker->pending = broken->pending; } broken->pending = breaker; - mandoc_vmsg(MANDOCERR_BLOCK_NEST, mdoc->parse, line, ppos, + mandoc_vmsg(MANDOCERR_BLK_NEST, mdoc->parse, line, ppos, "%s breaks %s", mdoc_macronames[tok], mdoc_macronames[broken->tok]); return(1); @@ -554,7 +555,7 @@ rew_sub(enum mdoc_type t, struct mdoc *mdoc, ! (MDOC_EXPLICIT & mdoc_macros[tok].flags)); break; case REWIND_FORCE: - mandoc_vmsg(MANDOCERR_SCOPEBROKEN, mdoc->parse, + mandoc_vmsg(MANDOCERR_BLK_BROKEN, mdoc->parse, line, ppos, "%s breaks %s", mdoc_macronames[tok], mdoc_macronames[n->tok]); @@ -570,7 +571,9 @@ rew_sub(enum mdoc_type t, struct mdoc *mdoc, return(1); /* FALLTHROUGH */ case REWIND_ERROR: - mdoc_pmsg(mdoc, line, ppos, MANDOCERR_NOSCOPE); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, + mdoc->parse, line, ppos, + mdoc_macronames[tok]); return(1); } break; @@ -1759,7 +1762,8 @@ phrase_ta(MACRO_PROT_ARGS) while (NULL != n && MDOC_Bl != n->tok) n = n->parent; if (NULL == n || LIST_column != n->norm->Bl.type) { - mdoc_pmsg(mdoc, line, ppos, MANDOCERR_STRAYTA); + mandoc_msg(MANDOCERR_TA_STRAY, mdoc->parse, + line, ppos, NULL); return(1); } diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 0613e25576c..9833f3d9928 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.45 2014/07/07 16:12:06 schwarze Exp $ */ +/* $Id: read.c,v 1.46 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -172,17 +172,20 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "data block still open", "ignoring extra data cells", + /* related to document structure and macros */ "input stack limit exceeded, infinite loop?", "skipping bad character", + "skipping unknown macro", + "skipping column outside column list", + "skipping end of block that is not open", + "inserting missing end of block", + "appending missing end of block", + + /* related to request and macro arguments */ "escaped character not allowed in a name", "manual name not yet set", - "skipping unknown macro", "argument count wrong", "unknown standard specifier", - "skipping column outside column list", - "skipping end of block that is not open", - "missing end of block", - "scope open on exit", "uname(3) system call failed", "request requires a numeric argument", "missing list type, using -item", diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 1b20f976d58..47251e4cece 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.93 2014/07/07 11:34:41 schwarze Exp $ */ +/* $Id: roff.c,v 1.94 2014/07/07 21:35:42 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -782,18 +782,19 @@ roff_endparse(struct roff *r) { if (r->last) - mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse, - r->last->line, r->last->col, NULL); + mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, + r->last->line, r->last->col, + roffs[r->last->tok].name); if (r->eqn) { - mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse, - r->eqn->eqn.ln, r->eqn->eqn.pos, NULL); + mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, + r->eqn->eqn.ln, r->eqn->eqn.pos, "EQ"); eqn_end(&r->eqn); } if (r->tbl) { - mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse, - r->tbl->line, r->tbl->pos, NULL); + mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, + r->tbl->line, r->tbl->pos, "TS"); tbl_end(&r->tbl); } } @@ -837,7 +838,8 @@ roff_cblock(ROFF_ARGS) */ if (NULL == r->last) { - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, ".."); return(ROFF_IGN); } @@ -855,7 +857,8 @@ roff_cblock(ROFF_ARGS) case ROFF_ig: break; default: - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, ".."); return(ROFF_IGN); } @@ -885,7 +888,8 @@ roff_ccond(struct roff *r, int ln, int ppos) { if (NULL == r->last) { - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, "\\}"); return; } @@ -897,12 +901,14 @@ roff_ccond(struct roff *r, int ln, int ppos) case ROFF_if: break; default: - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, "\\}"); return; } if (r->last->endspan > -1) { - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, "\\}"); return; } @@ -1789,7 +1795,8 @@ roff_TE(ROFF_ARGS) { if (NULL == r->tbl) - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, "TE"); else tbl_end(&r->tbl); @@ -1801,7 +1808,8 @@ roff_T_(ROFF_ARGS) { if (NULL == r->tbl) - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, + ln, ppos, "T&"); else tbl_restart(ppos, ln, r->tbl); @@ -1852,7 +1860,7 @@ static enum rofferr roff_EN(ROFF_ARGS) { - mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, "EN"); return(ROFF_IGN); } @@ -1862,7 +1870,8 @@ roff_TS(ROFF_ARGS) struct tbl_node *tbl; if (r->tbl) { - mandoc_msg(MANDOCERR_SCOPEBROKEN, r->parse, ln, ppos, NULL); + mandoc_msg(MANDOCERR_BLK_BROKEN, r->parse, + ln, ppos, "TS breaks TS"); tbl_end(&r->tbl); } |