version 1.88, 2010/11/30 15:36:28 |
version 1.93, 2011/01/01 10:51:30 |
Line 36 const char *const __man_macronames[MAN_MAX] = { |
|
Line 36 const char *const __man_macronames[MAN_MAX] = { |
|
"IP", "HP", "SM", "SB", |
"IP", "HP", "SM", "SB", |
"BI", "IB", "BR", "RB", |
"BI", "IB", "BR", "RB", |
"R", "B", "I", "IR", |
"R", "B", "I", "IR", |
"RI", "na", "i", "sp", |
"RI", "na", "sp", "nf", |
"nf", "fi", "r", "RE", |
"fi", "RE", "RS", "DT", |
"RS", "DT", "UC", "PD", |
"UC", "PD", "AT", "in", |
"Sp", "Vb", "Ve", "AT", |
"ft" |
"in" |
|
}; |
}; |
|
|
const char * const *man_macronames = __man_macronames; |
const char * const *man_macronames = __man_macronames; |
Line 349 man_ptext(struct man *m, int line, char *buf, int offs |
|
Line 348 man_ptext(struct man *m, int line, char *buf, int offs |
|
|
|
if ('\\' == buf[offs] && |
if ('\\' == buf[offs] && |
'.' == buf[offs + 1] && |
'.' == buf[offs + 1] && |
'"' == buf[offs + 2]) |
'"' == buf[offs + 2]) { |
return(man_pmsg(m, line, offs, MANDOCERR_BADCOMMENT)); |
man_pmsg(m, line, offs, MANDOCERR_BADCOMMENT); |
|
return(1); |
|
} |
|
|
/* Literal free-form text whitespace is preserved. */ |
/* Literal free-form text whitespace is preserved. */ |
|
|
Line 382 man_ptext(struct man *m, int line, char *buf, int offs |
|
Line 383 man_ptext(struct man *m, int line, char *buf, int offs |
|
|
|
if (' ' == buf[i - 1] || '\t' == buf[i - 1]) { |
if (' ' == buf[i - 1] || '\t' == buf[i - 1]) { |
if (i > 1 && '\\' != buf[i - 2]) |
if (i > 1 && '\\' != buf[i - 2]) |
if ( ! man_pmsg(m, line, i - 1, MANDOCERR_EOLNSPACE)) |
man_pmsg(m, line, i - 1, MANDOCERR_EOLNSPACE); |
return(0); |
|
|
|
for (--i; i && ' ' == buf[i]; i--) |
for (--i; i && ' ' == buf[i]; i--) |
/* Spin back to non-space. */ ; |
/* Spin back to non-space. */ ; |
Line 474 man_pmacro(struct man *m, int ln, char *buf, int offs) |
|
Line 474 man_pmacro(struct man *m, int ln, char *buf, int offs) |
|
|
|
tok = (j > 0 && j < 4) ? man_hash_find(mac) : MAN_MAX; |
tok = (j > 0 && j < 4) ? man_hash_find(mac) : MAN_MAX; |
if (MAN_MAX == tok) { |
if (MAN_MAX == tok) { |
man_vmsg(m, MANDOCERR_MACRO, ln, ppos, |
man_vmsg(m, MANDOCERR_MACRO, ln, ppos, "%s", buf + ppos - 1); |
"unknown macro: %s%s", |
|
buf, strlen(buf) > 3 ? "..." : ""); |
|
return(1); |
return(1); |
} |
} |
|
|
Line 491 man_pmacro(struct man *m, int ln, char *buf, int offs) |
|
Line 489 man_pmacro(struct man *m, int ln, char *buf, int offs) |
|
*/ |
*/ |
|
|
if ('\0' == buf[i] && ' ' == buf[i - 1]) |
if ('\0' == buf[i] && ' ' == buf[i - 1]) |
if ( ! man_pmsg(m, ln, i - 1, MANDOCERR_EOLNSPACE)) |
man_pmsg(m, ln, i - 1, MANDOCERR_EOLNSPACE); |
goto err; |
|
|
|
/* |
/* |
* Remove prior ELINE macro, as it's being clobbering by a new |
* Remove prior ELINE macro, as it's being clobbered by a new |
* macro. Note that NSCOPED macros do not close out ELINE |
* macro. Note that NSCOPED macros do not close out ELINE |
* macros---they don't print text---so we let those slip by. |
* macros---they don't print text---so we let those slip by. |
*/ |
*/ |
|
|
if ( ! (MAN_NSCOPED & man_macros[tok].flags) && |
if ( ! (MAN_NSCOPED & man_macros[tok].flags) && |
m->flags & MAN_ELINE) { |
m->flags & MAN_ELINE) { |
assert(MAN_TEXT != m->last->type); |
|
|
|
/* |
|
* This occurs in the following construction: |
|
* .B |
|
* .br |
|
* .B |
|
* .br |
|
* I hate man macros. |
|
* Flat-out disallow this madness. |
|
*/ |
|
if (MAN_NSCOPED & man_macros[m->last->tok].flags) { |
|
man_pmsg(m, ln, ppos, MANDOCERR_SYNTLINESCOPE); |
|
return(0); |
|
} |
|
|
|
n = m->last; |
n = m->last; |
|
assert(MAN_TEXT != n->type); |
|
|
assert(n); |
/* Remove repeated NSCOPED macros causing ELINE. */ |
assert(NULL == n->child); |
|
assert(0 == n->nchild); |
|
|
|
if ( ! man_nmsg(m, n, MANDOCERR_LINESCOPE)) |
if (MAN_NSCOPED & man_macros[n->tok].flags) |
return(0); |
n = n->parent; |
|
|
|
man_vmsg(m, MANDOCERR_LINESCOPE, n->line, n->pos, |
|
"%s", man_macronames[n->tok]); |
|
|
man_node_delete(m, n); |
man_node_delete(m, n); |
m->flags &= ~MAN_ELINE; |
m->flags &= ~MAN_ELINE; |