* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.
-/* $Id: eqn.c,v 1.42 2014/04/23 21:06:41 schwarze Exp $ */
+/* $Id: eqn.c,v 1.43 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
p++;
if ('\0' == *p)
return(er);
- mandoc_msg(MANDOCERR_ARGSLOST, ep->parse, ln, pos, NULL);
+ mandoc_vmsg(MANDOCERR_ARG_SKIP, ep->parse,
+ ln, pos, "EN %s", p);
return(er);
}
-/* $Id: man_validate.c,v 1.96 2014/07/02 11:43:20 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.97 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
break;
case MAN_HEAD:
if (n->nchild)
- man_nmsg(man, n, MANDOCERR_ARGSLOST);
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ man->parse, n->line, n->pos,
+ "%s %s%s", man_macronames[n->tok],
+ n->child->string,
+ n->nchild > 1 ? " ..." : "");
break;
default:
break;
-/* $Id: mandoc.h,v 1.133 2014/07/04 01:50:06 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.134 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
MANDOCERR_BL_WIDTH, /* missing -width in -tag list, using 8n */
MANDOCERR_IT_NOHEAD, /* empty head in list item: type */
MANDOCERR_IT_NOBODY, /* empty list item: type */
- MANDOCERR_FONTTYPE, /* missing font type */
+ MANDOCERR_BF_NOFONT, /* missing font type, using \fR */
+ MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */
MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */
/* related to bad macro arguments */
MANDOCERR_UNAME, /* uname(3) system call failed */
MANDOCERR_NUMERIC, /* request requires a numeric argument */
MANDOCERR_BL_NOTYPE, /* missing list type, using -item */
- MANDOCERR_ARGSLOST, /* line argument(s) will be lost */
+ MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */
+ MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
MANDOCERR_NOTMANUAL, /* not a manual */
MANDOCERR_COLUMNS, /* column syntax is inconsistent */
MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */
- MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */
MANDOCERR_SYNTCHILD, /* child violates parent syntax */
MANDOCERR_SYNTARGCOUNT, /* argument count wrong, violates syntax */
MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
-/* $Id: mdoc_macro.c,v 1.135 2014/07/02 20:19:11 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.136 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
later = n;
}
- if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) {
- /* FIXME: do this in validate */
- if (buf[*pos])
- mdoc_pmsg(mdoc, line, ppos, MANDOCERR_ARGSLOST);
-
+ if ( ! (MDOC_PARSED & mdoc_macros[tok].flags)) {
+ if ('\0' != buf[*pos])
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, line, ppos,
+ "%s %s", mdoc_macronames[tok],
+ buf + *pos);
if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
return(0);
return(rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos));
-/* $Id: mdoc_man.c,v 1.65 2014/07/02 19:55:10 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.66 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
else
print_word("-");
font_pop();
- break;
+ outflags |= MMAN_nl;
+ return(0);
case LIST_enum:
print_width(bln->norm->Bl.width, NULL, 0);
TPremain = 0;
outflags |= MMAN_nl;
print_count(&bln->norm->Bl.count);
- break;
+ outflags |= MMAN_nl;
+ return(0);
case LIST_hang:
print_width(bln->norm->Bl.width, n->child, 6);
TPremain = 0;
- break;
+ outflags |= MMAN_nl;
+ return(1);
case LIST_tag:
print_width(bln->norm->Bl.width, n->child, 0);
putchar('\n');
default:
return(1);
}
- outflags |= MMAN_nl;
default:
break;
}
-/* $Id: mdoc_validate.c,v 1.225 2014/07/04 01:50:07 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.226 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
static int hwarn_eq0(POST_ARGS);
static int hwarn_eq1(POST_ARGS);
static int hwarn_ge1(POST_ARGS);
-static int hwarn_le1(POST_ARGS);
static int post_an(POST_ARGS);
static int post_at(POST_ARGS);
static v_post posts_an[] = { post_an, NULL };
static v_post posts_at[] = { post_at, post_defaults, NULL };
static v_post posts_bd[] = { post_literal, hwarn_eq0, bwarn_ge1, NULL };
-static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
+static v_post posts_bf[] = { post_bf, NULL };
static v_post posts_bk[] = { hwarn_eq0, bwarn_ge1, NULL };
static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL };
static v_post posts_bx[] = { post_bx, NULL };
return(check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_GT, 0));
}
-static int
-hwarn_le1(POST_ARGS)
-{
- return(check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_LT, 2));
-}
-
static void
check_args(struct mdoc *mdoc, struct mdoc_node *n)
{
static int
post_bf(POST_ARGS)
{
- struct mdoc_node *np;
+ struct mdoc_node *np, *nch;
enum mdocargt arg;
/*
assert(MDOC_BLOCK == np->parent->type);
assert(MDOC_Bf == np->parent->tok);
- /*
- * Cannot have both argument and parameter.
- * If neither is specified, let it through with a warning.
- */
+ /* Check the number of arguments. */
- if (np->parent->args && np->child) {
- mdoc_nmsg(mdoc, np, MANDOCERR_SYNTARGVCOUNT);
- return(0);
- } else if (NULL == np->parent->args && NULL == np->child) {
- mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE);
- return(1);
+ nch = np->child;
+ if (NULL == np->parent->args) {
+ if (NULL == nch) {
+ mdoc_nmsg(mdoc, np, MANDOCERR_BF_NOFONT);
+ return(1);
+ }
+ nch = nch->next;
}
+ if (NULL != nch)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ nch->line, nch->pos, "Bf ... %s", nch->string);
/* Extract argument into data. */
else if (0 == strcmp(np->child->string, "Sy"))
np->norm->Bf.font = FONT_Sy;
else
- mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE);
+ mandoc_vmsg(MANDOCERR_BF_BADFONT, mdoc->parse,
+ np->child->line, np->child->pos,
+ "Bf %s", np->child->string);
return(1);
}
static int
post_eoln(POST_ARGS)
{
+ const struct mdoc_node *n;
- if (mdoc->last->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST);
+ n = mdoc->last;
+ if (n->child)
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, n->line, n->pos,
+ "%s %s", mdoc_macronames[n->tok],
+ n->child->string);
return(1);
}
/* FALLTHROUGH */
case LIST_item:
if (NULL != nit->head->child)
- mdoc_nmsg(mdoc, nit, MANDOCERR_ARGSLOST);
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ mdoc->parse, nit->line, nit->pos,
+ "It %s", nit->head->child->string);
break;
case LIST_column:
cols = (int)nbl->norm->Bl.ncols;
-/* $Id: read.c,v 1.60 2014/07/04 01:50:07 schwarze Exp $ */
+/* $Id: read.c,v 1.61 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
"missing -width in -tag list, using 8n",
"empty head in list item",
"empty list item",
- "missing font type",
+ "missing font type, using \\fR",
+ "unknown font type, using \\fR",
"missing -std argument, adding it",
/* related to bad macro arguments */
"uname(3) system call failed",
"request requires a numeric argument",
"missing list type, using -item",
- "line argument(s) will be lost",
+ "skipping all arguments",
+ "skipping excess arguments",
"generic fatal error",
"not a manual",
"column syntax is inconsistent",
"NOT IMPLEMENTED: .Bd -file",
- "argument count wrong, violates syntax",
"child violates parent syntax",
"argument count wrong, violates syntax",
"NOT IMPLEMENTED: .so with absolute path or \"..\"",
-/* $Id: roff.c,v 1.216 2014/07/03 21:23:54 schwarze Exp $ */
+/* $Id: roff.c,v 1.217 2014/07/04 16:12:08 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
}
if ((*bufp)[pos])
- mandoc_msg(MANDOCERR_ARGSLOST, r->parse, ln, pos, NULL);
+ mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
+ ".. %s", *bufp + pos);
roffnode_pop(r);
roffnode_cleanscope(r);
r->last->end = mandoc_strndup(name, namesz);
if ('\0' != *cp)
- mandoc_msg(MANDOCERR_ARGSLOST, r->parse, ln, pos, NULL);
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
+ ln, pos, ".%s ... %s", roffs[tok].name, cp);
return(ROFF_IGN);
}