version 1.122, 2009/11/05 08:40:16 |
version 1.123, 2009/11/06 10:31:32 |
Line 374 do_reserved(struct termp *p, const char *word, size_t |
|
Line 374 do_reserved(struct termp *p, const char *word, size_t |
|
static void |
static void |
do_escaped(struct termp *p, const char **word) |
do_escaped(struct termp *p, const char **word) |
{ |
{ |
int j, type, sv; |
int j, type, sv, t, lim; |
const char *wp; |
const char *wp; |
|
|
wp = *word; |
wp = *word; |
type = 1; |
type = 1; |
|
|
if (0 == *(++wp)) { |
if ('\0' == *(++wp)) { |
*word = wp; |
*word = wp; |
return; |
return; |
} |
} |
|
|
if ('(' == *wp) { |
if ('(' == *wp) { |
wp++; |
wp++; |
if (0 == *wp || 0 == *(wp + 1)) { |
if ('\0' == *wp || '\0' == *(wp + 1)) { |
*word = 0 == *wp ? wp : wp + 1; |
*word = '\0' == *wp ? wp : wp + 1; |
return; |
return; |
} |
} |
|
|
Line 397 do_escaped(struct termp *p, const char **word) |
|
Line 397 do_escaped(struct termp *p, const char **word) |
|
return; |
return; |
|
|
} else if ('*' == *wp) { |
} else if ('*' == *wp) { |
if (0 == *(++wp)) { |
if ('\0' == *(++wp)) { |
*word = wp; |
*word = wp; |
return; |
return; |
} |
} |
Line 405 do_escaped(struct termp *p, const char **word) |
|
Line 405 do_escaped(struct termp *p, const char **word) |
|
switch (*wp) { |
switch (*wp) { |
case ('('): |
case ('('): |
wp++; |
wp++; |
if (0 == *wp || 0 == *(wp + 1)) { |
if ('\0' == *wp || '\0' == *(wp + 1)) { |
*word = 0 == *wp ? wp : wp + 1; |
*word = '\0' == *wp ? wp : wp + 1; |
return; |
return; |
} |
} |
|
|
Line 421 do_escaped(struct termp *p, const char **word) |
|
Line 421 do_escaped(struct termp *p, const char **word) |
|
*word = wp; |
*word = wp; |
return; |
return; |
} |
} |
|
|
|
} else if ('s' == *wp) { |
|
/* This closely follows mandoc_special(). */ |
|
if ('\0' == *(++wp)) { |
|
*word = wp; |
|
return; |
|
} |
|
|
|
t = 0; |
|
lim = 1; |
|
|
|
if (*wp == '\'') { |
|
lim = 0; |
|
t = 1; |
|
++wp; |
|
} else if (*wp == '[') { |
|
lim = 0; |
|
t = 2; |
|
++wp; |
|
} else if (*wp == '(') { |
|
lim = 2; |
|
t = 3; |
|
++wp; |
|
} |
|
|
|
if (*wp == '+' || *wp == '-') |
|
++wp; |
|
|
|
if (*wp == '\'') { |
|
if (t) { |
|
*word = wp; |
|
return; |
|
} |
|
lim = 0; |
|
t = 1; |
|
++wp; |
|
} else if (*wp == '[') { |
|
if (t) { |
|
*word = wp; |
|
return; |
|
} |
|
lim = 0; |
|
t = 2; |
|
++wp; |
|
} else if (*wp == '(') { |
|
if (t) { |
|
*word = wp; |
|
return; |
|
} |
|
lim = 2; |
|
t = 3; |
|
++wp; |
|
} |
|
|
|
if ( ! isdigit((u_char)*wp)) { |
|
*word = --wp; |
|
return; |
|
} |
|
|
|
for (j = 0; isdigit((u_char)*wp); j++) { |
|
if (lim && j >= lim) |
|
break; |
|
++wp; |
|
} |
|
|
|
if (t && t < 3) { |
|
if (1 == t && *wp != '\'') { |
|
*word = --wp; |
|
return; |
|
} |
|
if (2 == t && *wp != ']') { |
|
*word = --wp; |
|
return; |
|
} |
|
++wp; |
|
} |
|
*word = --wp; |
|
return; |
|
|
} else if ('f' == *wp) { |
} else if ('f' == *wp) { |
if (0 == *(++wp)) { |
if ('\0' == *(++wp)) { |
*word = wp; |
*word = wp; |
return; |
return; |
} |
} |
Line 470 do_escaped(struct termp *p, const char **word) |
|
Line 548 do_escaped(struct termp *p, const char **word) |
|
for (j = 0; *wp && ']' != *wp; wp++, j++) |
for (j = 0; *wp && ']' != *wp; wp++, j++) |
/* Loop... */ ; |
/* Loop... */ ; |
|
|
if (0 == *wp) { |
if ('\0' == *wp) { |
*word = wp; |
*word = wp; |
return; |
return; |
} |
} |
Line 495 term_word(struct termp *p, const char *word) |
|
Line 573 term_word(struct termp *p, const char *word) |
|
|
|
sv = word; |
sv = word; |
|
|
if (word[0] && 0 == word[1]) |
if (word[0] && '\0' == word[1]) |
switch (word[0]) { |
switch (word[0]) { |
case('.'): |
case('.'): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |