]> git.cameronkatri.com Git - mandoc.git/blobdiff - mandoc.c
Clarified EXIT STATUS sections. Discussed among schwarze@, Thomas, and
[mandoc.git] / mandoc.c
index 53e7c7b681c276985a00611c6c99af86c8abaf2d..5598ca810f72dee8f98797c86560ef0181b2ed57 100644 (file)
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,4 +1,4 @@
-/*     $Id: mandoc.c,v 1.29 2010/08/20 01:02:07 schwarze Exp $ */
+/*     $Id: mandoc.c,v 1.34 2010/08/29 11:28:09 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -55,14 +55,10 @@ mandoc_special(char *p)
                /* FALLTHROUGH */
        case ('x'):
                /* FALLTHROUGH */
-       case ('w'):
-               /* FALLTHROUGH */
        case ('S'):
                /* FALLTHROUGH */
        case ('R'):
                /* FALLTHROUGH */
-       case ('o'):
-               /* FALLTHROUGH */
        case ('N'):
                /* FALLTHROUGH */
        case ('l'):
@@ -130,6 +126,27 @@ mandoc_special(char *p)
                        p++;
                } 
                
+               /* Handle embedded numerical subexp or escape. */
+
+               if ('(' == *p) {
+                       while (*p && ')' != *p)
+                               if ('\\' == *p++) {
+                                       i = mandoc_special(--p);
+                                       if (0 == i)
+                                               return(0);
+                                       p += i;
+                               }
+
+                       if (')' == *p++)
+                               break;
+
+                       return(0);
+               } else if ('\\' == *p) {
+                       if (0 == (i = mandoc_special(p)))
+                               return(0);
+                       p += i;
+               }
+
                break;
 #if 0
        case ('Y'):
@@ -140,9 +157,9 @@ mandoc_special(char *p)
                /* FALLTHROUGH */
        case ('n'):
                /* FALLTHROUGH */
+#endif
        case ('k'):
                /* FALLTHROUGH */
-#endif
        case ('M'):
                /* FALLTHROUGH */
        case ('m'):
@@ -171,6 +188,23 @@ mandoc_special(char *p)
        case ('['):
                term = ']';
                break;
+       case ('z'):
+               len = 1;
+               if ('\\' == *p) {
+                       if (0 == (i = mandoc_special(p)))
+                               return(0);
+                       p += i;
+                       return(*p ? (int)(p - sv) : 0);
+               }
+               break;
+       case ('o'):
+               /* FALLTHROUGH */
+       case ('w'):
+               if ('\'' == *p++) {
+                       term = '\'';
+                       break;
+               }
+               /* FALLTHROUGH */
        default:
                len = 1;
                p--;