From 4b8b77f4eb349054321581a56bff586160457e68 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Tue, 24 Aug 2010 13:56:51 +0000 Subject: Handle nested, recursive mathematical subexpressions. This is definitely not general, but it's good enough for pod2man definitions (after I clean up the roff, which will be addressed in later fixes). --- out.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'out.c') diff --git a/out.c b/out.c index d1a9e79d..99288f57 100644 --- a/out.c +++ b/out.c @@ -279,6 +279,26 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz) i++; } + /* Handle embedded numerical subexp or escape. */ + + if ('(' == wp[i]) { + while (wp[i] && ')' != wp[i]) + if ('\\' == wp[i++]) { + /* Handle embedded escape. */ + *word = &wp[i]; + i += a2roffdeco(&dd, word, sz); + } + + if (')' == wp[i++]) + break; + + *d = DECO_NONE; + return(i - 1); + } else if ('\\' == wp[i]) { + *word = &wp[++i]; + i += a2roffdeco(&dd, word, sz); + } + break; case ('['): *d = DECO_SPECIAL; -- cgit