X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/ac2ee6a683c48e758ae871419ea18b57aa82e14b..0dd9e4fce7c0b9444311670b6068714c46322fa6:/mandoc.c diff --git a/mandoc.c b/mandoc.c index 41d4196a..5598ca81 100644 --- a/mandoc.c +++ b/mandoc.c @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.31 2010/08/24 13:07:01 kristaps Exp $ */ +/* $Id: mandoc.c,v 1.34 2010/08/29 11:28:09 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -59,8 +59,6 @@ mandoc_special(char *p) /* FALLTHROUGH */ case ('R'): /* FALLTHROUGH */ - case ('o'): - /* FALLTHROUGH */ case ('N'): /* FALLTHROUGH */ case ('l'): @@ -128,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'): @@ -138,9 +157,9 @@ mandoc_special(char *p) /* FALLTHROUGH */ case ('n'): /* FALLTHROUGH */ +#endif case ('k'): /* FALLTHROUGH */ -#endif case ('M'): /* FALLTHROUGH */ case ('m'): @@ -172,10 +191,14 @@ mandoc_special(char *p) case ('z'): len = 1; if ('\\' == *p) { - p += mandoc_special(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 = '\'';