version 1.213, 2014/06/29 22:38:47 |
version 1.214, 2014/06/29 23:26:00 |
Line 200 static enum rofferr roff_line_ignore(ROFF_ARGS); |
|
Line 200 static enum rofferr roff_line_ignore(ROFF_ARGS); |
|
static enum rofferr roff_nr(ROFF_ARGS); |
static enum rofferr roff_nr(ROFF_ARGS); |
static void roff_openeqn(struct roff *, const char *, |
static void roff_openeqn(struct roff *, const char *, |
int, int, const char *); |
int, int, const char *); |
static enum rofft roff_parse(struct roff *, const char *, int *); |
static enum rofft roff_parse(struct roff *, char *, int *, |
|
int, int); |
static enum rofferr roff_parsetext(char **, size_t *, int, int *); |
static enum rofferr roff_parsetext(char **, size_t *, int, int *); |
static enum rofferr roff_res(struct roff *, |
static enum rofferr roff_res(struct roff *, |
char **, size_t *, int, int); |
char **, size_t *, int, int); |
Line 764 roff_parseln(struct roff *r, int ln, char **bufp, |
|
Line 765 roff_parseln(struct roff *r, int ln, char **bufp, |
|
* the compilers handle it. |
* the compilers handle it. |
*/ |
*/ |
|
|
if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos))) |
if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos, ln, ppos))) |
return(ROFF_CONT); |
return(ROFF_CONT); |
|
|
assert(roffs[t].proc); |
assert(roffs[t].proc); |
Line 797 roff_endparse(struct roff *r) |
|
Line 798 roff_endparse(struct roff *r) |
|
* form of ".foo xxx" in the usual way. |
* form of ".foo xxx" in the usual way. |
*/ |
*/ |
static enum rofft |
static enum rofft |
roff_parse(struct roff *r, const char *buf, int *pos) |
roff_parse(struct roff *r, char *buf, int *pos, int ln, int ppos) |
{ |
{ |
|
char *cp; |
const char *mac; |
const char *mac; |
size_t maclen; |
size_t maclen; |
enum rofft t; |
enum rofft t; |
|
|
if ('\0' == buf[*pos] || '"' == buf[*pos] || |
cp = buf + *pos; |
'\t' == buf[*pos] || ' ' == buf[*pos]) |
|
|
if ('\0' == *cp || '"' == *cp || '\t' == *cp || ' ' == *cp) |
return(ROFF_MAX); |
return(ROFF_MAX); |
|
|
/* We stop the macro parse at an escape, tab, space, or nil. */ |
mac = cp; |
|
maclen = roff_getname(r, &cp, ln, ppos); |
|
|
mac = buf + *pos; |
|
maclen = strcspn(mac, " \\\t\0"); |
|
|
|
t = (r->current_string = roff_getstrn(r, mac, maclen)) |
t = (r->current_string = roff_getstrn(r, mac, maclen)) |
? ROFF_USERDEF : roffhash_find(mac, maclen); |
? ROFF_USERDEF : roffhash_find(mac, maclen); |
|
|
*pos += (int)maclen; |
if (ROFF_MAX != t) |
|
*pos = cp - buf; |
|
|
while (buf[*pos] && ' ' == buf[*pos]) |
|
(*pos)++; |
|
|
|
return(t); |
return(t); |
} |
} |
|
|
Line 996 roff_block_sub(ROFF_ARGS) |
|
Line 995 roff_block_sub(ROFF_ARGS) |
|
i++; |
i++; |
|
|
pos = i; |
pos = i; |
if (ROFF_MAX != roff_parse(r, *bufp, &pos)) |
if (ROFF_MAX != roff_parse(r, *bufp, &pos, ln, ppos)) |
return(ROFF_RERUN); |
return(ROFF_RERUN); |
return(ROFF_IGN); |
return(ROFF_IGN); |
} |
} |
Line 1007 roff_block_sub(ROFF_ARGS) |
|
Line 1006 roff_block_sub(ROFF_ARGS) |
|
* pulling it out of the hashtable. |
* pulling it out of the hashtable. |
*/ |
*/ |
|
|
t = roff_parse(r, *bufp, &pos); |
t = roff_parse(r, *bufp, &pos, ln, ppos); |
|
|
/* |
/* |
* Macros other than block-end are only significant |
* Macros other than block-end are only significant |
Line 1042 roff_cond_sub(ROFF_ARGS) |
|
Line 1041 roff_cond_sub(ROFF_ARGS) |
|
|
|
rr = r->last->rule; |
rr = r->last->rule; |
roffnode_cleanscope(r); |
roffnode_cleanscope(r); |
t = roff_parse(r, *bufp, &pos); |
t = roff_parse(r, *bufp, &pos, ln, ppos); |
|
|
/* |
/* |
* Fully handle known macros when they are structurally |
* Fully handle known macros when they are structurally |