]> git.cameronkatri.com Git - mandoc.git/blobdiff - roff.c
Removed TODO that was fixed by parsing escapes in offset strings.
[mandoc.git] / roff.c
diff --git a/roff.c b/roff.c
index b111ad234e56ec2b7cc1c7d5ca1066148ed744e9..7467fe0e11c29305693c5fff6d51a86dbd363647 100644 (file)
--- a/roff.c
+++ b/roff.c
@@ -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 <kristaps@bsd.lv>
  * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -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,14 +758,15 @@ roff_cond_sub(ROFF_ARGS)
         * continue. 
         */
 
-       l = r->last;
        roffnode_cleanscope(r);
 
-       if (l != r->last)
-               return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);
-
-       if (ROFF_MAX == (t = roff_parse(*bufp, &pos)))
+       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);
+       }
 
        /*
         * A denied conditional must evaluate its children if and only
@@ -797,6 +798,8 @@ roff_cond_text(ROFF_ARGS)
         * scope permits us to do so.
         */
 
+       /* FIXME: use roff_ccond? */
+
        st = &(*bufp)[pos];
        if (NULL == (ep = strstr(st, "\\}"))) {
                roffnode_cleanscope(r);