125 |
# define SYNTAX_ENTRY_VIA_PROPERTY |
# define SYNTAX_ENTRY_VIA_PROPERTY |
126 |
|
|
127 |
# include "syntax.h" |
# include "syntax.h" |
128 |
# include "charset.h" |
# include "character.h" |
129 |
# include "category.h" |
# include "category.h" |
130 |
|
|
131 |
# ifdef malloc |
# ifdef malloc |
246 |
# define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ |
# define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ |
247 |
(c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) |
(c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) |
248 |
# define MAKE_CHAR(charset, c1, c2) (c1) |
# define MAKE_CHAR(charset, c1, c2) (c1) |
249 |
|
# define BYTE8_TO_CHAR(c) (c) |
250 |
|
# define CHAR_BYTE8_P(c) (0) |
251 |
#endif /* not emacs */ |
#endif /* not emacs */ |
252 |
|
|
253 |
#ifndef RE_TRANSLATE |
#ifndef RE_TRANSLATE |
2611 |
/* Fetch the character which ends the range. */ |
/* Fetch the character which ends the range. */ |
2612 |
PATFETCH (c1); |
PATFETCH (c1); |
2613 |
|
|
2614 |
if (SINGLE_BYTE_CHAR_P (c)) |
if (SINGLE_BYTE_CHAR_P (c) |
2615 |
|
&& ! SINGLE_BYTE_CHAR_P (c1)) |
2616 |
{ |
{ |
2617 |
if (! SINGLE_BYTE_CHAR_P (c1)) |
/* Handle a range starting with a character |
2618 |
{ |
fitting in a bitmap to a character not |
2619 |
/* Handle a range starting with a |
fitting in a bitmap (thus require range |
2620 |
character of less than 256, and ending |
table). We use both a bitmap (for the |
2621 |
with a character of not less than 256. |
range from C to 255) and a range table (for |
2622 |
Split that into two ranges, the low one |
the remaining range). Here, we setup only |
2623 |
ending at 0377, and the high one |
a range table. A bitmap is setup later. */ |
2624 |
starting at the smallest character in |
re_wchar_t c2 |
2625 |
the charset of C1 and ending at C1. */ |
= CHAR_BYTE8_P (c1) ? BYTE8_TO_CHAR (0x80) : 256; |
2626 |
int charset = CHAR_CHARSET (c1); |
|
2627 |
int c2 = MAKE_CHAR (charset, 0, 0); |
SET_RANGE_TABLE_WORK_AREA (range_table_work, c2, c1); |
2628 |
|
c1 = 255; |
|
SET_RANGE_TABLE_WORK_AREA (range_table_work, |
|
|
c2, c1); |
|
|
c1 = 0377; |
|
|
} |
|
2629 |
} |
} |
|
else if (!SAME_CHARSET_P (c, c1)) |
|
|
FREE_STACK_RETURN (REG_ERANGE); |
|
2630 |
} |
} |
2631 |
else |
else |
2632 |
/* Range from C to C. */ |
/* Range from C to C. */ |
3552 |
set_fastmap_for_multibyte_characters: |
set_fastmap_for_multibyte_characters: |
3553 |
if (match_any_multibyte_characters == false) |
if (match_any_multibyte_characters == false) |
3554 |
{ |
{ |
3555 |
for (j = 0x80; j < 0xA0; j++) /* XXX */ |
for (j = 0x80; j < 0x100; j++) /* XXX */ |
3556 |
if (BASE_LEADING_CODE_P (j)) |
if (BASE_LEADING_CODE_P (j)) |
3557 |
fastmap[j] = 1; |
fastmap[j] = 1; |
3558 |
match_any_multibyte_characters = true; |
match_any_multibyte_characters = true; |
3562 |
else if (!not && CHARSET_RANGE_TABLE_EXISTS_P (&p[-2]) |
else if (!not && CHARSET_RANGE_TABLE_EXISTS_P (&p[-2]) |
3563 |
&& match_any_multibyte_characters == false) |
&& match_any_multibyte_characters == false) |
3564 |
{ |
{ |
3565 |
/* Set fastmap[I] 1 where I is a base leading code of each |
/* Set fastmap[I] to 1 where I is a base leading code of each |
3566 |
multibyte character in the range table. */ |
multibyte characer in the range table. */ |
3567 |
int c, count; |
int c, count; |
3568 |
|
unsigned char buf1[MAX_MULTIBYTE_LENGTH]; |
3569 |
|
unsigned char buf2[MAX_MULTIBYTE_LENGTH]; |
3570 |
|
|
3571 |
/* Make P points the range table. `+ 2' is to skip flag |
/* Make P points the range table. `+ 2' is to skip flag |
3572 |
bits for a character class. */ |
bits for a character class. */ |
3576 |
EXTRACT_NUMBER_AND_INCR (count, p); |
EXTRACT_NUMBER_AND_INCR (count, p); |
3577 |
for (; count > 0; count--, p += 2 * 3) /* XXX */ |
for (; count > 0; count--, p += 2 * 3) /* XXX */ |
3578 |
{ |
{ |
3579 |
/* Extract the start of each range. */ |
/* Extract the start and end of each range. */ |
3580 |
|
EXTRACT_CHARACTER (c, p); |
3581 |
|
CHAR_STRING (c, buf1); |
3582 |
|
p += 3; |
3583 |
EXTRACT_CHARACTER (c, p); |
EXTRACT_CHARACTER (c, p); |
3584 |
j = CHAR_CHARSET (c); |
CHAR_STRING (c, buf2); |
3585 |
fastmap[CHARSET_LEADING_CODE_BASE (j)] = 1; |
for (j = buf1[0]; j <= buf2[0]; j++) |
3586 |
|
fastmap[j] = 1; |
3587 |
} |
} |
3588 |
} |
} |
3589 |
break; |
break; |