Downgrade empty item heads from ERROR to WARNING.
Show the list type in the error message.
Choose better variable names for nodes in post_it().
-/* $Id: mandoc.h,v 1.131 2014/07/03 21:23:54 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.132 2014/07/03 23:24:56 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
MANDOCERR_DISPTYPE, /* missing display type */
MANDOCERR_LISTFIRST, /* list type must come first */
MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */
MANDOCERR_DISPTYPE, /* missing display type */
MANDOCERR_LISTFIRST, /* list type must come first */
MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */
+ MANDOCERR_IT_NOHEAD, /* missing head in list item: type */
MANDOCERR_FONTTYPE, /* missing font type */
/* related to bad macro arguments */
MANDOCERR_FONTTYPE, /* missing font type */
/* related to bad macro arguments */
MANDOCERR_SCOPEEXIT, /* scope open on exit */
MANDOCERR_UNAME, /* uname(3) system call failed */
/* FIXME: merge following with MANDOCERR_ARGCOUNT */
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_NUMERIC, /* request requires a numeric argument */
MANDOCERR_NOBODY, /* macro requires body argument(s) */
MANDOCERR_NOARGV, /* macro requires argument(s) */
MANDOCERR_NUMERIC, /* request requires a numeric argument */
-/* $Id: mdoc_term.c,v 1.269 2014/07/02 19:55:10 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.270 2014/07/03 23:24:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
term_word(p, "\\ \\ ");
break;
case LIST_inset:
term_word(p, "\\ \\ ");
break;
case LIST_inset:
- if (MDOC_BODY == n->type)
+ if (MDOC_BODY == n->type && n->parent->head->nchild)
term_word(p, "\\ ");
break;
default:
term_word(p, "\\ ");
break;
default:
-/* $Id: mdoc_validate.c,v 1.223 2014/07/02 20:19:11 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.224 2014/07/03 23:24:56 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
{
int i, cols;
enum mdoc_list lt;
{
int i, cols;
enum mdoc_list lt;
- struct mdoc_node *n, *c;
+ struct mdoc_node *nbl, *nit, *nch;
- if (MDOC_BLOCK != mdoc->last->type)
+ nit = mdoc->last;
+ if (MDOC_BLOCK != nit->type)
- n = mdoc->last->parent->parent;
- lt = n->norm->Bl.type;
+ nbl = nit->parent->parent;
+ lt = nbl->norm->Bl.type;
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_LISTTYPE);
+ mdoc_nmsg(mdoc, nit, MANDOCERR_LISTTYPE);
return(1);
}
switch (lt) {
case LIST_tag:
return(1);
}
switch (lt) {
case LIST_tag:
- if (mdoc->last->head->child)
- break;
- /* FIXME: give this a dummy value. */
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
- break;
case LIST_hang:
/* FALLTHROUGH */
case LIST_ohang:
case LIST_hang:
/* FALLTHROUGH */
case LIST_ohang:
case LIST_inset:
/* FALLTHROUGH */
case LIST_diag:
case LIST_inset:
/* FALLTHROUGH */
case LIST_diag:
- if (NULL == mdoc->last->head->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
+ if (NULL == nit->head->child)
+ mandoc_msg(MANDOCERR_IT_NOHEAD,
+ mdoc->parse, nit->line, nit->pos,
+ mdoc_argnames[nbl->args->argv[0].arg]);
break;
case LIST_bullet:
/* FALLTHROUGH */
break;
case LIST_bullet:
/* FALLTHROUGH */
case LIST_enum:
/* FALLTHROUGH */
case LIST_hyphen:
case LIST_enum:
/* FALLTHROUGH */
case LIST_hyphen:
- if (NULL == mdoc->last->body->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY);
+ if (NULL == nit->body->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY);
/* FALLTHROUGH */
case LIST_item:
/* FALLTHROUGH */
case LIST_item:
- if (mdoc->last->head->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST);
+ if (NULL != nit->head->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_ARGSLOST);
- cols = (int)n->norm->Bl.ncols;
+ cols = (int)nbl->norm->Bl.ncols;
- assert(NULL == mdoc->last->head->child);
+ assert(NULL == nit->head->child);
- if (NULL == mdoc->last->body->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY);
+ if (NULL == nit->body->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY);
- for (i = 0, c = mdoc->last->child; c; c = c->next)
- if (MDOC_BODY == c->type)
+ for (i = 0, nch = nit->child; nch; nch = nch->next)
+ if (MDOC_BODY == nch->type)
else
er = MANDOCERR_SYNTARGCOUNT;
else
er = MANDOCERR_SYNTARGCOUNT;
- mandoc_vmsg(er, mdoc->parse,
- mdoc->last->line, mdoc->last->pos,
+ mandoc_vmsg(er, mdoc->parse, nit->line, nit->pos,
"columns == %d (have %d)", cols, i);
return(MANDOCERR_ARGCOUNT == er);
default:
"columns == %d (have %d)", cols, i);
return(MANDOCERR_ARGCOUNT == er);
default:
-/* $Id: read.c,v 1.58 2014/07/03 21:23:54 schwarze Exp $ */
+/* $Id: read.c,v 1.59 2014/07/03 23:24:56 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
"missing display type",
"list type must come first",
"tag lists require a width argument",
"missing display type",
"list type must come first",
"tag lists require a width argument",
+ "missing head in list item",
"missing font type",
/* related to bad macro arguments */
"missing font type",
/* related to bad macro arguments */
"missing end of block",
"scope open on exit",
"uname(3) system call failed",
"missing end of block",
"scope open on exit",
"uname(3) system call failed",
- "macro requires line argument(s)",
"macro requires body argument(s)",
"macro requires argument(s)",
"request requires a numeric argument",
"macro requires body argument(s)",
"macro requires argument(s)",
"request requires a numeric argument",