=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_argv.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/mandoc/mdoc_argv.c 2009/07/26 22:48:41 1.12 --- src/usr.bin/mandoc/mdoc_argv.c 2009/08/22 22:39:55 1.13 *************** *** 1,4 **** ! /* $Id: mdoc_argv.c,v 1.12 2009/07/26 22:48:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: mdoc_argv.c,v 1.13 2009/08/22 22:39:55 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 32,42 **** * There's no limit to the number or arguments that may be allocated. */ - /* FIXME .Bf Li raises "macro-like parameter". */ - - #define ARGS_DELIM (1 << 1) - #define ARGS_TABSEP (1 << 2) - #define ARGV_NONE (1 << 0) #define ARGV_SINGLE (1 << 1) #define ARGV_MULTI (1 << 2) --- 32,37 ---- *************** *** 327,336 **** int ! mdoc_zargs(struct mdoc *m, int line, int *pos, char *buf, char **v) { ! return(args(m, line, pos, buf, 0, v)); } --- 322,332 ---- int ! mdoc_zargs(struct mdoc *m, int line, int *pos, ! char *buf, int flags, char **v) { ! return(args(m, line, pos, buf, flags, v)); } *************** *** 379,384 **** --- 375,395 ---- int i; char *p, *pp; + /* + * Parse out the terms (like `val' in `.Xx -arg val' or simply + * `.Xx val'), which can have all sorts of properties: + * + * ARGS_DELIM: use special handling if encountering trailing + * delimiters in the form of [[::delim::][ ]+]+. + * + * ARGS_NOWARN: don't post warnings. This is only used when + * re-parsing delimiters, as the warnings have already been + * posted. + * + * ARGS_TABSEP: use special handling for tab/`Ta' separated + * phrases like in `Bl -column'. + */ + assert(*pos); assert(' ' != buf[*pos]); *************** *** 403,412 **** i++; } - /* FIXME: warn about trailing whitespace. */ - if (0 == buf[i]) { *v = &buf[*pos]; return(ARGS_PUNCT); } } --- 414,427 ---- i++; } if (0 == buf[i]) { *v = &buf[*pos]; + if (' ' != buf[i - 1]) + return(ARGS_PUNCT); + if (ARGS_NOWARN & fl) + return(ARGS_PUNCT); + if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) + return(ARGS_ERROR); return(ARGS_PUNCT); } } *************** *** 450,456 **** p = strchr(*v, 0); /* Whitespace check for eoln case... */ ! if (0 == *p && ' ' == *(p - 1)) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR); --- 465,471 ---- p = strchr(*v, 0); /* Whitespace check for eoln case... */ ! if (0 == *p && ' ' == *(p - 1) && ! (ARGS_NOWARN & fl)) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR); *************** *** 490,495 **** --- 505,512 ---- } if (0 == buf[*pos]) { + if (ARGS_NOWARN & fl) + return(ARGS_QWORD); if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM)) return(ARGS_ERROR); return(ARGS_QWORD); *************** *** 503,509 **** while (' ' == buf[*pos]) (*pos)++; ! if (0 == buf[*pos]) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR); --- 520,526 ---- while (' ' == buf[*pos]) (*pos)++; ! if (0 == buf[*pos] && ! (ARGS_NOWARN & fl)) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR); *************** *** 527,533 **** while (' ' == buf[*pos]) (*pos)++; ! if (0 == buf[*pos]) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR); --- 544,550 ---- while (' ' == buf[*pos]) (*pos)++; ! if (0 == buf[*pos] && ! (ARGS_NOWARN & fl)) if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) return(ARGS_ERROR);