version 1.124, 2010/05/07 15:49:36 |
version 1.125, 2010/05/08 07:30:19 |
Line 542 mdoc_word_alloc(struct mdoc *m, int line, int pos, con |
|
Line 542 mdoc_word_alloc(struct mdoc *m, int line, int pos, con |
|
|
|
len = strlen(p); |
len = strlen(p); |
|
|
n = node_alloc(m, line, pos, -1, MDOC_TEXT); |
n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT); |
n->string = mandoc_malloc(len + 1); |
n->string = mandoc_malloc(len + 1); |
sv = strlcpy(n->string, p, len + 1); |
sv = strlcpy(n->string, p, len + 1); |
|
|
Line 681 mdoc_ptext(struct mdoc *m, int line, char *buf) |
|
Line 681 mdoc_ptext(struct mdoc *m, int line, char *buf) |
|
} |
} |
|
|
|
|
|
|
static int |
static int |
macrowarn(struct mdoc *m, int ln, const char *buf) |
macrowarn(struct mdoc *m, int ln, const char *buf) |
{ |
{ |
if ( ! (MDOC_IGN_MACRO & m->pflags)) |
if ( ! (MDOC_IGN_MACRO & m->pflags)) |
return(mdoc_verr(m, ln, 0, |
return(mdoc_verr(m, ln, 0, "unknown macro: %s%s", |
"unknown macro: %s%s", |
|
buf, strlen(buf) > 3 ? "..." : "")); |
buf, strlen(buf) > 3 ? "..." : "")); |
return(mdoc_vwarn(m, ln, 0, "unknown macro: %s%s", |
return(mdoc_vwarn(m, ln, 0, "unknown macro: %s%s", |
buf, strlen(buf) > 3 ? "..." : "")); |
buf, strlen(buf) > 3 ? "..." : "")); |
Line 701 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
Line 699 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
int |
int |
mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
{ |
{ |
int i, j, c; |
enum mdoct tok; |
char mac[5]; |
int i, j; |
|
char mac[5]; |
|
|
/* Empty lines are ignored. */ |
/* Empty lines are ignored. */ |
|
|
Line 744 mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
|
Line 743 mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
|
return(1); |
return(1); |
} |
} |
|
|
if (MDOC_MAX == (c = mdoc_hash_find(mac))) { |
if (MDOC_MAX == (tok = mdoc_hash_find(mac))) { |
if ( ! macrowarn(m, ln, mac)) |
if ( ! macrowarn(m, ln, mac)) |
goto err; |
goto err; |
return(1); |
return(1); |
Line 755 mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
|
Line 754 mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
|
while (buf[i] && ' ' == buf[i]) |
while (buf[i] && ' ' == buf[i]) |
i++; |
i++; |
|
|
/* Trailing whitespace? */ |
/* |
|
* Trailing whitespace. Note that tabs are allowed to be passed |
|
* into the parser as "text", so we only warn about spaces here. |
|
*/ |
|
|
if ('\0' == buf[i] && ' ' == buf[i - 1]) |
if ('\0' == buf[i] && ' ' == buf[i - 1]) |
if ( ! mdoc_pwarn(m, ln, i - 1, ETAILWS)) |
if ( ! mdoc_pwarn(m, ln, i - 1, ETAILWS)) |
Line 765 mdoc_pmacro(struct mdoc *m, int ln, char *buf) |
|
Line 767 mdoc_pmacro(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, tok, ln, 1, &i, buf)) |
goto err; |
goto err; |
|
|
return(1); |
return(1); |