=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.99 retrieving revision 1.102 diff -u -p -r1.99 -r1.102 --- mandoc/roff.c 2010/08/24 12:48:43 1.99 +++ mandoc/roff.c 2010/09/04 20:18:53 1.102 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.99 2010/08/24 12:48:43 kristaps Exp $ */ +/* $Id: roff.c,v 1.102 2010/09/04 20:18:53 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -59,7 +59,7 @@ enum rofft { ROFF_rm, ROFF_tr, ROFF_cblock, - ROFF_ccond, + ROFF_ccond, /* FIXME: remove this. */ ROFF_nr, ROFF_MAX }; @@ -248,6 +248,7 @@ roffnode_pop(struct roff *r) if (r->rstackpos > -1) r->rstackpos--; + ROFF_DEBUG("roff: popping scope\n"); r->last = r->last->parent; if (p->end) free(p->end); @@ -426,8 +427,8 @@ roff_parseln(struct roff *r, int ln, char **bufp, if (r->last) { t = r->last->tok; assert(roffs[t].sub); - ROFF_DEBUG("roff: intercept scoped context: %s\n", - roffs[t].name); + ROFF_DEBUG("roff: intercept scoped context: %s, [%s]\n", + roffs[t].name, &(*bufp)[pos]); return((*roffs[t].sub) (r, t, bufp, szp, ln, pos, pos, offs)); @@ -748,7 +749,6 @@ roff_cond_sub(ROFF_ARGS) { enum rofft t; enum roffrule rr; - struct roffnode *l; ppos = pos; rr = r->last->rule; @@ -758,15 +758,16 @@ roff_cond_sub(ROFF_ARGS) * continue. */ - l = r->last; roffnode_cleanscope(r); - if (l != r->last) + if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) { + if ('\\' == (*bufp)[pos] && '}' == (*bufp)[pos + 1]) + return(roff_ccond + (r, ROFF_ccond, bufp, szp, + ln, pos, pos + 2, offs)); return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); + } - if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) - return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); - /* * A denied conditional must evaluate its children if and only * if they're either structurally required (such as loops and @@ -796,6 +797,8 @@ roff_cond_text(ROFF_ARGS) * We display the value of the text if out current evaluation * scope permits us to do so. */ + + /* FIXME: use roff_ccond? */ st = &(*bufp)[pos]; if (NULL == (ep = strstr(st, "\\}"))) {