version 1.64, 2011/03/17 00:58:14 |
version 1.65, 2011/03/17 01:23:28 |
Line 412 args(struct mdoc *m, int line, int *pos, |
|
Line 412 args(struct mdoc *m, int line, int *pos, |
|
return(ARGS_EOLN); |
return(ARGS_EOLN); |
} |
} |
|
|
/* |
|
* If the first character is a closing delimiter and we're to |
|
* look for delimited strings, then pass down the buffer seeing |
|
* if it follows the pattern of [[::delim::][ ]+]+. Note that |
|
* we ONLY care about closing delimiters. |
|
*/ |
|
|
|
*v = &buf[*pos]; |
*v = &buf[*pos]; |
|
|
if (ARGS_DELIM & fl && args_checkpunct(&buf[*pos])) { |
if (ARGS_DELIM & fl && args_checkpunct(&buf[*pos])) { |
Line 572 args(struct mdoc *m, int line, int *pos, |
|
Line 565 args(struct mdoc *m, int line, int *pos, |
|
|
|
/* |
/* |
* Check if the string consists only of space-separated closing |
* Check if the string consists only of space-separated closing |
* delimiters. |
* delimiters. This is a bit of a dance: the first must be a close |
|
* delimiter, but it may be followed by middle delimiters. Arbitrary |
|
* whitespace may separate these tokens. |
*/ |
*/ |
static int |
static int |
args_checkpunct(const char *p) |
args_checkpunct(const char *p) |
{ |
{ |
int i; |
int i, j; |
|
char buf[DELIMSZ]; |
enum mdelim d; |
enum mdelim d; |
|
|
i = 0; |
i = 0; |
|
|
if (DELIM_CLOSE != mdoc_iscdelim(p[i])) |
/* First token must be a close-delimiter. */ |
|
|
|
for (j = 0; p[i] && ' ' != p[i] && j < DELIMSZ; j++, i++) |
|
buf[j] = p[i]; |
|
|
|
if (DELIMSZ == j) |
return(0); |
return(0); |
|
|
while ('\0' != p[i]) { |
buf[j] = '\0'; |
d = mdoc_iscdelim(p[i]); |
if (DELIM_CLOSE != mdoc_isdelim(buf)) |
if (DELIM_NONE == d || DELIM_OPEN == d) |
return(0); |
break; |
|
|
while (' ' == p[i]) |
i++; |
i++; |
if ('\0' == p[i] || ' ' != p[i]) |
|
break; |
/* Remaining must NOT be open/none. */ |
i++; |
|
while (p[i] && ' ' == p[i]) |
while (p[i]) { |
|
j = 0; |
|
while (p[i] && ' ' != p[i] && j < DELIMSZ) |
|
buf[j++] = p[i++]; |
|
|
|
if (DELIMSZ == j) |
|
return(0); |
|
|
|
buf[j] = '\0'; |
|
d = mdoc_isdelim(buf); |
|
if (DELIM_NONE == d || DELIM_OPEN == d) |
|
return(0); |
|
|
|
while (' ' == p[i]) |
i++; |
i++; |
} |
} |
|
|