summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2007-03-23 05:44:14 +0000
committerKenichi Handa <handa@m17n.org>2007-03-23 05:44:14 +0000
commit6482db2eb982c10a91d875719ed5de4d1d994065 (patch)
treeac0cd27c72e355cd0f28c2ebf18e69ba6ff6afae /src/regex.c
parentd85d38392e338f66053a6a6f1017720660239338 (diff)
downloademacs-6482db2eb982c10a91d875719ed5de4d1d994065.tar.gz
emacs-6482db2eb982c10a91d875719ed5de4d1d994065.tar.bz2
emacs-6482db2eb982c10a91d875719ed5de4d1d994065.zip
(analyse_first): Fix for multibyte characters in "case
charset:" and "case categoryspec:".
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/regex.c b/src/regex.c
index 4fbd80232c6..81c37730a9a 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -4103,17 +4103,21 @@ analyse_first (p, pend, fastmap, multibyte)
if (!!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) ^ not)
fastmap[j] = 1;
- if ((not && multibyte)
- /* Any leading code can possibly start a character
+#ifdef emacs
+ if (/* Any leading code can possibly start a character
which doesn't match the specified set of characters. */
- || (CHARSET_RANGE_TABLE_EXISTS_P (&p[-2])
- && CHARSET_RANGE_TABLE_BITS (&p[-2]) != 0))
- /* If we can match a character class, we can match
- any multibyte characters. */
+ not
+ ||
+ /* If we can match a character class, we can match any
+ multibyte characters. */
+ (CHARSET_RANGE_TABLE_EXISTS_P (&p[-2])
+ && CHARSET_RANGE_TABLE_BITS (&p[-2]) != 0))
+
{
if (match_any_multibyte_characters == false)
{
- for (j = 0x80; j < (1 << BYTEWIDTH); j++)
+ for (j = MIN_MULTIBYTE_LEADING_CODE;
+ j <= MAX_MULTIBYTE_LEADING_CODE; j++)
fastmap[j] = 1;
match_any_multibyte_characters = true;
}
@@ -4145,6 +4149,7 @@ analyse_first (p, pend, fastmap, multibyte)
fastmap[j] = 1;
}
}
+#endif
break;
case syntaxspec:
@@ -4167,20 +4172,18 @@ analyse_first (p, pend, fastmap, multibyte)
if (!fastmap) break;
not = (re_opcode_t)p[-1] == notcategoryspec;
k = *p++;
- for (j = (multibyte ? 127 : (1 << BYTEWIDTH)); j >= 0; j--)
+ for (j = (1 << BYTEWIDTH); j >= 0; j--)
if ((CHAR_HAS_CATEGORY (j, k)) ^ not)
fastmap[j] = 1;
- if (multibyte)
+ /* Any leading code can possibly start a character which
+ has or doesn't has the specified category. */
+ if (match_any_multibyte_characters == false)
{
- /* Any character set can possibly contain a character
- whose category is K (or not). */
- if (match_any_multibyte_characters == false)
- {
- for (j = 0x80; j < (1 << BYTEWIDTH); j++)
- fastmap[j] = 1;
- match_any_multibyte_characters = true;
- }
+ for (j = MIN_MULTIBYTE_LEADING_CODE;
+ j <= MAX_MULTIBYTE_LEADING_CODE; j++)
+ fastmap[j] = 1;
+ match_any_multibyte_characters = true;
}
break;