version 1.99, 2009/08/13 11:43:24 |
version 1.101, 2009/08/19 11:58:32 |
Line 74 const char *const __mdoc_merrnames[MERRMAX] = { |
|
Line 74 const char *const __mdoc_merrnames[MERRMAX] = { |
|
"unclosed explicit scope", /* EOPEN */ |
"unclosed explicit scope", /* EOPEN */ |
"unterminated quoted phrase", /* EQUOTPHR */ |
"unterminated quoted phrase", /* EQUOTPHR */ |
"closure macro without prior context", /* ENOCTX */ |
"closure macro without prior context", /* ENOCTX */ |
"invalid whitespace after control character", /* ESPACE */ |
|
"no description found for library" /* ELIB */ |
"no description found for library" /* ELIB */ |
}; |
}; |
|
|
Line 544 pstring(struct mdoc *m, int line, int pos, const char |
|
Line 543 pstring(struct mdoc *m, int line, int pos, const char |
|
/* Prohibit truncation. */ |
/* Prohibit truncation. */ |
assert(sv < len + 1); |
assert(sv < len + 1); |
|
|
return(node_append(m, n)); |
if ( ! node_append(m, n)) |
|
return(0); |
|
m->next = MDOC_NEXT_SIBLING; |
|
return(1); |
} |
} |
|
|
|
|
Line 601 parsetext(struct mdoc *m, int line, char *buf) |
|
Line 603 parsetext(struct mdoc *m, int line, char *buf) |
|
* back-end, as it should be preserved as a single term. |
* back-end, as it should be preserved as a single term. |
*/ |
*/ |
|
|
if (MDOC_LITERAL & m->flags) { |
if (MDOC_LITERAL & m->flags) |
if ( ! mdoc_word_alloc(m, line, 0, buf)) |
return(mdoc_word_alloc(m, line, 0, buf)); |
return(0); |
|
m->next = MDOC_NEXT_SIBLING; |
|
return(1); |
|
} |
|
|
|
/* Disallow blank/white-space lines in non-literal mode. */ |
/* Disallow blank/white-space lines in non-literal mode. */ |
|
|
Line 631 parsetext(struct mdoc *m, int line, char *buf) |
|
Line 629 parsetext(struct mdoc *m, int line, char *buf) |
|
buf[i++] = 0; |
buf[i++] = 0; |
if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) |
if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) |
return(0); |
return(0); |
m->next = MDOC_NEXT_SIBLING; |
|
|
|
for ( ; ' ' == buf[i]; i++) |
for ( ; ' ' == buf[i]; i++) |
/* Skip trailing whitespace. */ ; |
/* Skip trailing whitespace. */ ; |
Line 670 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
Line 667 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
int |
int |
parsemacro(struct mdoc *m, int ln, char *buf) |
parsemacro(struct mdoc *m, int ln, char *buf) |
{ |
{ |
int i, c; |
int i, j, c, ppos; |
char mac[5]; |
char mac[5]; |
|
|
/* Empty lines are ignored. */ |
/* Empty lines are ignored. */ |
|
|
/* FIXME: this can accept `. xx' like libman! */ |
|
|
|
if (0 == buf[1]) |
if (0 == buf[1]) |
return(1); |
return(1); |
|
|
if (' ' == buf[1]) { |
i = 1; |
i = 2; |
|
|
/* Accept whitespace after the initial control char. */ |
|
|
|
if (' ' == buf[i]) { |
|
i++; |
while (buf[i] && ' ' == buf[i]) |
while (buf[i] && ' ' == buf[i]) |
i++; |
i++; |
if (0 == buf[i]) |
if (0 == buf[i]) |
return(1); |
return(1); |
return(mdoc_perr(m, ln, 1, ESPACE)); |
|
} |
} |
|
|
|
ppos = i; |
|
|
/* Copy the first word into a nil-terminated buffer. */ |
/* Copy the first word into a nil-terminated buffer. */ |
|
|
for (i = 1; i < 5; i++) { |
for (j = 0; j < 4; j++, i++) { |
if (0 == (mac[i - 1] = buf[i])) |
if (0 == (mac[j] = buf[i])) |
break; |
break; |
else if (' ' == buf[i]) |
else if (' ' == buf[i]) |
break; |
break; |
} |
} |
|
|
mac[i - 1] = 0; |
mac[j] = 0; |
|
|
if (i == 5 || i <= 2) { |
if (j == 4 || j < 2) { |
if ( ! macrowarn(m, ln, mac)) |
if ( ! macrowarn(m, ln, mac)) |
goto err; |
goto err; |
return(1); |
return(1); |
Line 721 parsemacro(struct mdoc *m, int ln, char *buf) |
|
Line 721 parsemacro(struct mdoc *m, int ln, char *buf) |
|
* Begin recursive parse sequence. Since we're at the start of |
* Begin recursive parse sequence. Since we're at the start of |
* the line, we don't need to do callable/parseable checks. |
* the line, we don't need to do callable/parseable checks. |
*/ |
*/ |
if ( ! mdoc_macro(m, c, ln, 1, &i, buf)) |
if ( ! mdoc_macro(m, c, ln, ppos, &i, buf)) |
goto err; |
goto err; |
|
|
return(1); |
return(1); |
Line 731 err: /* Error out. */ |
|
Line 731 err: /* Error out. */ |
|
m->flags |= MDOC_HALT; |
m->flags |= MDOC_HALT; |
return(0); |
return(0); |
} |
} |
|
|
|
|