version 1.44, 2010/05/09 10:17:02 |
version 1.46, 2010/05/14 12:55:22 |
Line 398 args(struct mdoc *m, int line, int *pos, |
|
Line 398 args(struct mdoc *m, int line, int *pos, |
|
assert(*pos); |
assert(*pos); |
assert(' ' != buf[*pos]); |
assert(' ' != buf[*pos]); |
|
|
if ('\0' == buf[*pos]) |
if ('\0' == buf[*pos]) { |
|
if (ARGS_PPHRASED & fl) |
|
return(ARGS_EOLN); |
|
/* |
|
* If we're not in a partial phrase and the flag for |
|
* being a phrase literal is still set, the punctuation |
|
* is unterminated. |
|
*/ |
|
if (MDOC_PHRASELIT & m->flags) |
|
if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM)) |
|
return(ARGS_ERROR); |
|
|
|
m->flags &= ~MDOC_PHRASELIT; |
return(ARGS_EOLN); |
return(ARGS_EOLN); |
|
} |
|
|
/* |
/* |
* If the first character is a delimiter and we're to look for |
* If the first character is a closing delimiter and we're to |
* delimited strings, then pass down the buffer seeing if it |
* look for delimited strings, then pass down the buffer seeing |
* follows the pattern of [[::delim::][ ]+]+. |
* if it follows the pattern of [[::delim::][ ]+]+. Note that |
|
* we ONLY care about closing delimiters. |
*/ |
*/ |
|
|
if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) { |
if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) { |
for (i = *pos; buf[i]; ) { |
for (i = *pos; buf[i]; ) { |
if ( mdoc_iscdelim(buf[i]) < 2) |
if (mdoc_iscdelim(buf[i]) < 2) |
break; |
break; |
i++; |
i++; |
if (0 == buf[i] || ' ' != buf[i]) |
if ('\0' == buf[i] || ' ' != buf[i]) |
break; |
break; |
i++; |
i++; |
while (buf[i] && ' ' == buf[i]) |
while (buf[i] && ' ' == buf[i]) |
i++; |
i++; |
} |
} |
|
|
if (0 == buf[i]) { |
if ('\0' == buf[i]) { |
*v = &buf[*pos]; |
*v = &buf[*pos]; |
if (' ' != buf[i - 1]) |
if (' ' != buf[i - 1]) |
return(ARGS_PUNCT); |
return(ARGS_PUNCT); |
Line 443 args(struct mdoc *m, int line, int *pos, |
|
Line 457 args(struct mdoc *m, int line, int *pos, |
|
if (ARGS_TABSEP & fl) { |
if (ARGS_TABSEP & fl) { |
/* Scan ahead to tab (can't be escaped). */ |
/* Scan ahead to tab (can't be escaped). */ |
p = strchr(*v, '\t'); |
p = strchr(*v, '\t'); |
|
pp = NULL; |
|
|
/* Scan ahead to unescaped `Ta'. */ |
/* Scan ahead to unescaped `Ta'. */ |
for (pp = *v; ; pp++) { |
if ( ! (MDOC_PHRASELIT & m->flags)) |
if (NULL == (pp = strstr(pp, "Ta"))) |
for (pp = *v; ; pp++) { |
break; |
if (NULL == (pp = strstr(pp, "Ta"))) |
if (pp > *v && ' ' != *(pp - 1)) |
break; |
continue; |
if (pp > *v && ' ' != *(pp - 1)) |
if (' ' == *(pp + 2) || 0 == *(pp + 2)) |
continue; |
break; |
if (' ' == *(pp + 2) || 0 == *(pp + 2)) |
} |
break; |
|
} |
|
|
/* By default, assume a phrase. */ |
/* By default, assume a phrase. */ |
rc = ARGS_PHRASE; |
rc = ARGS_PHRASE; |
Line 505 args(struct mdoc *m, int line, int *pos, |
|
Line 521 args(struct mdoc *m, int line, int *pos, |
|
* Whitespace is NOT involved in literal termination. |
* Whitespace is NOT involved in literal termination. |
*/ |
*/ |
|
|
if ('\"' == buf[*pos]) { |
if (MDOC_PHRASELIT & m->flags || '\"' == buf[*pos]) { |
*v = &buf[++(*pos)]; |
if ( ! (MDOC_PHRASELIT & m->flags)) |
|
*v = &buf[++(*pos)]; |
|
|
|
if (ARGS_PPHRASED & fl) |
|
m->flags |= MDOC_PHRASELIT; |
|
|
for ( ; buf[*pos]; (*pos)++) { |
for ( ; buf[*pos]; (*pos)++) { |
if ('\"' != buf[*pos]) |
if ('\"' != buf[*pos]) |
continue; |
continue; |
Line 516 args(struct mdoc *m, int line, int *pos, |
|
Line 536 args(struct mdoc *m, int line, int *pos, |
|
(*pos)++; |
(*pos)++; |
} |
} |
|
|
if (0 == buf[*pos]) { |
if ('\0' == buf[*pos]) { |
if (ARGS_NOWARN & fl) |
if (ARGS_NOWARN & fl || ARGS_PPHRASED & fl) |
return(ARGS_QWORD); |
return(ARGS_QWORD); |
if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM)) |
if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM)) |
return(ARGS_ERROR); |
return(ARGS_ERROR); |
return(ARGS_QWORD); |
return(ARGS_QWORD); |
} |
} |
|
|
buf[(*pos)++] = 0; |
m->flags &= ~MDOC_PHRASELIT; |
|
buf[(*pos)++] = '\0'; |
|
|
if (0 == buf[*pos]) |
if ('\0' == buf[*pos]) |
return(ARGS_QWORD); |
return(ARGS_QWORD); |
|
|
while (' ' == buf[*pos]) |
while (' ' == buf[*pos]) |
Line 548 args(struct mdoc *m, int line, int *pos, |
|
Line 569 args(struct mdoc *m, int line, int *pos, |
|
if (' ' == buf[*pos] && '\\' != buf[*pos - 1]) |
if (' ' == buf[*pos] && '\\' != buf[*pos - 1]) |
break; |
break; |
|
|
if (0 == buf[*pos]) |
if ('\0' == buf[*pos]) |
return(ARGS_WORD); |
return(ARGS_WORD); |
|
|
buf[(*pos)++] = 0; |
buf[(*pos)++] = '\0'; |
|
|
while (' ' == buf[*pos]) |
while (' ' == buf[*pos]) |
(*pos)++; |
(*pos)++; |
|
|
if (0 == buf[*pos] && ! (ARGS_NOWARN & fl)) |
if ('\0' == buf[*pos] && ! (ARGS_NOWARN & fl)) |
if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) |
if ( ! mdoc_pwarn(m, line, *pos, ETAILWS)) |
return(ARGS_ERROR); |
return(ARGS_ERROR); |
|
|