version 1.16, 2009/01/17 20:10:36 |
version 1.21, 2009/01/20 13:49:36 |
|
|
|
|
#include "private.h" |
#include "private.h" |
|
|
|
/* |
|
* Parse arguments and parameters of macros. Arguments follow the |
|
* syntax of `-arg [val [valN...]]', while parameters are free-form text |
|
* following arguments (if any). This file must correctly handle the |
|
* strange punctuation rules dictated by groff. |
|
*/ |
|
|
/* FIXME: .It called with -column and quoted arguments. */ |
/* FIXME: .It called with -column and quoted arguments. */ |
|
|
Line 64 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
Line 70 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
if ( ! mdoc_iscdelim(buf[i])) |
if ( ! mdoc_iscdelim(buf[i])) |
break; |
break; |
i++; |
i++; |
if (0 == buf[i] || ! isspace(buf[i])) |
if (0 == buf[i] || ! isspace((int)buf[i])) |
break; |
break; |
i++; |
i++; |
while (buf[i] && isspace(buf[i])) |
while (buf[i] && isspace((int)buf[i])) |
i++; |
i++; |
} |
} |
if (0 == buf[i]) { |
if (0 == buf[i]) { |
Line 78 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
Line 84 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
|
|
/* Parse routine for non-quoted string. */ |
/* Parse routine for non-quoted string. */ |
|
|
if ('\"' != buf[*pos]) { |
assert(*pos > 0); |
|
if ('\"' != buf[*pos] || ! (ARGS_QUOTED & fl)) { |
*v = &buf[*pos]; |
*v = &buf[*pos]; |
|
|
/* FIXME: UGLY tab-sep processing. */ |
/* FIXME: UGLY tab-sep processing. */ |
Line 98 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
Line 105 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
} |
} |
(*pos)++; |
(*pos)++; |
} |
} |
else |
else { |
while (buf[*pos] && ! isspace(buf[*pos])) |
while (buf[*pos]) { |
|
if (isspace((int)buf[*pos])) |
|
if ('\\' != buf[*pos - 1]) |
|
break; |
(*pos)++; |
(*pos)++; |
|
} |
|
} |
|
|
if (0 == buf[*pos]) |
if (0 == buf[*pos]) |
return(ARGS_WORD); |
return(ARGS_WORD); |
Line 111 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
Line 123 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
return(ARGS_WORD); |
return(ARGS_WORD); |
|
|
if ( ! (ARGS_TABSEP & fl)) |
if ( ! (ARGS_TABSEP & fl)) |
while (buf[*pos] && isspace(buf[*pos])) |
while (buf[*pos] && isspace((int)buf[*pos])) |
(*pos)++; |
(*pos)++; |
|
|
if (buf[*pos]) |
if (buf[*pos]) |
Line 141 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
Line 153 mdoc_args(struct mdoc *mdoc, int line, int *pos, char |
|
|
|
buf[(*pos)++] = 0; |
buf[(*pos)++] = 0; |
if (0 == buf[*pos]) |
if (0 == buf[*pos]) |
return(ARGS_WORD); |
return(ARGS_QWORD); |
|
|
while (buf[*pos] && isspace(buf[*pos])) |
while (buf[*pos] && isspace((int)buf[*pos])) |
(*pos)++; |
(*pos)++; |
|
|
if (buf[*pos]) |
if (buf[*pos]) |
return(ARGS_WORD); |
return(ARGS_QWORD); |
|
|
if ( ! mdoc_pwarn(mdoc, line, *pos, WARN_COMPAT, "whitespace at end-of-line")) |
if ( ! mdoc_pwarn(mdoc, line, *pos, WARN_COMPAT, "whitespace at end-of-line")) |
return(ARGS_ERROR); |
return(ARGS_ERROR); |
|
|
return(ARGS_WORD); |
return(ARGS_QWORD); |
} |
} |
|
|
|
|
Line 440 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
Line 452 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
if (0 == buf[*pos]) |
if (0 == buf[*pos]) |
return(ARGV_EOLN); |
return(ARGV_EOLN); |
|
|
assert( ! isspace(buf[*pos])); |
assert( ! isspace((int)buf[*pos])); |
|
|
if ('-' != buf[*pos]) |
if ('-' != buf[*pos]) |
return(ARGV_WORD); |
return(ARGV_WORD); |
Line 451 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
Line 463 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
v->line = line; |
v->line = line; |
v->pos = *pos; |
v->pos = *pos; |
|
|
while (buf[*pos] && ! isspace(buf[*pos])) |
assert(*pos > 0); |
|
while (buf[*pos]) { |
|
if (isspace((int)buf[*pos])) |
|
if ('\\' != buf[*pos - 1]) |
|
break; |
(*pos)++; |
(*pos)++; |
|
} |
|
|
if (buf[*pos]) |
if (buf[*pos]) |
buf[(*pos)++] = 0; |
buf[(*pos)++] = 0; |
Line 463 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
Line 480 mdoc_argv(struct mdoc *mdoc, int line, int tok, |
|
return(ARGV_WORD); |
return(ARGV_WORD); |
} |
} |
|
|
while (buf[*pos] && isspace(buf[*pos])) |
while (buf[*pos] && isspace((int)buf[*pos])) |
(*pos)++; |
(*pos)++; |
|
|
/* FIXME: whitespace if no value. */ |
/* FIXME: whitespace if no value. */ |