-/* $Id: mdoc_argv.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: mdoc_argv.c,v 1.9 2009/07/06 09:21:24 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
* There's no limit to the number or arguments that may be allocated.
*/
+/* FIXME .Bf Li raises "macro-like parameter". */
+/* FIXME .Bl -column should deprecate old-groff syntax. */
+
#define ARGS_QUOTED (1 << 0)
#define ARGS_DELIM (1 << 1)
#define ARGS_TABSEP (1 << 2)
};
static int mdoc_argflags[MDOC_MAX] = {
- 0, /* \" */
+ 0, /* Ap */
0, /* Dd */
0, /* Dt */
0, /* Os */
ARGS_DELIM | ARGS_QUOTED, /* Dl */
0, /* Bd */
0, /* Ed */
- 0, /* Bl */
+ ARGS_QUOTED, /* Bl */
0, /* El */
0, /* It */
ARGS_DELIM, /* Ad */
0, /* Fr */
0, /* Ud */
0, /* Lb */
- 0, /* Ap */
ARGS_DELIM, /* Lp */
ARGS_DELIM | ARGS_QUOTED, /* Lk */
ARGS_DELIM | ARGS_QUOTED, /* Mt */
p = "argument requires a value";
break;
}
+
assert(p);
return(mdoc_perr(mdoc, line, pos, p));
}
pwarn(struct mdoc *mdoc, int line, int pos, enum mwarn code)
{
char *p;
- int c;
p = NULL;
- c = WARN_SYNTAX;
+
switch (code) {
case (WQUOTPARM):
p = "unexpected quoted parameter";
break;
case (WCOLEMPTY):
p = "last list column is empty";
- c = WARN_COMPAT;
break;
case (WTAILWS):
p = "trailing whitespace";
- c = WARN_COMPAT;
break;
}
+
assert(p);
- return(mdoc_pwarn(mdoc, line, pos, c, p));
+ return(mdoc_pwarn(mdoc, line, pos, p));
}
argv_multi(struct mdoc *mdoc, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
- int c, ppos;
+ int c;
char *p;
- ppos = *pos;
-
for (v->sz = 0; ; v->sz++) {
if ('-' == buf[*pos])
break;
return(verr(mdoc, EMALLOC));
}
- if (v->sz)
- return(1);
-
- return(perr(mdoc, line, ppos, EARGVAL));
+ return(1);
}