version 1.152, 2011/07/26 14:09:01 |
version 1.153, 2011/07/26 14:24:06 |
Line 395 roff_alloc(struct mparse *parse) |
|
Line 395 roff_alloc(struct mparse *parse) |
|
return(r); |
return(r); |
} |
} |
|
|
|
|
/* |
/* |
* Pre-filter each and every line for reserved words (one beginning with |
* Pre-filter each and every line for reserved words (one beginning with |
* `\*', e.g., `\*(ab'). These must be handled before the actual line |
* `\*', e.g., `\*(ab'). These must be handled before the actual line |
* is processed. |
* is processed. |
*/ |
* This also checks the syntax of regular escapes. |
|
*/ |
static int |
static int |
roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) |
roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) |
{ |
{ |
Line 433 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
Line 433 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
esc = mandoc_escape(&cp, NULL, NULL); |
esc = mandoc_escape(&cp, NULL, NULL); |
if (ESCAPE_ERROR != esc) |
if (ESCAPE_ERROR != esc) |
continue; |
continue; |
mandoc_msg(MANDOCERR_BADESCAPE, |
|
r->parse, ln, pos, NULL); |
|
cp = res; |
cp = res; |
|
mandoc_msg |
|
(MANDOCERR_BADESCAPE, r->parse, |
|
ln, (int)(stesc - *bufp), NULL); |
continue; |
continue; |
} |
} |
|
|
Line 467 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
Line 468 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
/* Advance to the end of the name. */ |
/* Advance to the end of the name. */ |
|
|
for (i = 0; 0 == maxl || i < maxl; i++, cp++) { |
for (i = 0; 0 == maxl || i < maxl; i++, cp++) { |
if ('\0' == *cp) |
if ('\0' == *cp) { |
return(1); /* Error. */ |
mandoc_msg |
|
(MANDOCERR_BADESCAPE, |
|
r->parse, ln, |
|
(int)(stesc - *bufp), NULL); |
|
return(1); |
|
} |
if (0 == maxl && ']' == *cp) |
if (0 == maxl && ']' == *cp) |
break; |
break; |
} |
} |
Line 481 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
Line 487 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
res = roff_getstrn(r, stnam, (size_t)i); |
res = roff_getstrn(r, stnam, (size_t)i); |
|
|
if (NULL == res) { |
if (NULL == res) { |
/* TODO: keep track of the correct position. */ |
mandoc_msg |
mandoc_msg(MANDOCERR_BADESCAPE, r->parse, ln, pos, NULL); |
(MANDOCERR_BADESCAPE, r->parse, |
|
ln, (int)(stesc - *bufp), NULL); |
res = ""; |
res = ""; |
} |
} |
|
|
Line 505 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
Line 512 roff_res(struct roff *r, char **bufp, size_t *szp, int |
|
return(1); |
return(1); |
} |
} |
|
|
|
|
enum rofferr |
enum rofferr |
roff_parseln(struct roff *r, int ln, char **bufp, |
roff_parseln(struct roff *r, int ln, char **bufp, |
size_t *szp, int pos, int *offs) |
size_t *szp, int pos, int *offs) |
Line 519 roff_parseln(struct roff *r, int ln, char **bufp, |
|
Line 525 roff_parseln(struct roff *r, int ln, char **bufp, |
|
* words to fill in. |
* words to fill in. |
*/ |
*/ |
|
|
if (r->first_string && ! roff_res(r, bufp, szp, ln, pos)) |
if ( ! roff_res(r, bufp, szp, ln, pos)) |
return(ROFF_REPARSE); |
return(ROFF_REPARSE); |
|
|
ppos = pos; |
ppos = pos; |