+ switch (wp[i++]) {
+ case ('('):
+ lim = 2;
+ break;
+ case ('['):
+ term = ']';
+ break;
+ case ('\''):
+ term = '\'';
+ break;
+ case ('0'):
+ j = 1;
+ /* FALLTHROUGH */
+ default:
+ i--;
+ lim = 1;
+ break;
+ }
+
+ if ('+' == wp[i] || '-' == wp[i]) {
+ if (j)
+ return(i);
+ 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;
+ term = ']';
+ break;
+ case ('c'):
+ *d = DECO_NOSPACE;
+ return(i);
+ case ('z'):
+ *d = DECO_NONE;
+ if ('\\' == wp[i]) {
+ *word = &wp[++i];
+ return(i + a2roffdeco(&dd, word, sz));
+ } else
+ lim = 1;
+ break;
+ case ('o'):
+ /* FALLTHROUGH */
+ case ('w'):
+ if ('\'' == wp[i++]) {
+ term = '\'';
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ *d = DECO_SSPECIAL;
+ i--;
+ lim = 1;
+ break;
+ }
+
+ assert(term || lim);
+ *word = &wp[i];
+
+ if (term) {
+ j = i;
+ while (wp[i] && wp[i] != term)
+ i++;
+ if ('\0' == wp[i]) {
+ *d = DECO_NONE;
+ return(i);
+ }
+
+ assert(i >= j);
+ *sz = (size_t)(i - j);