comparison src/regex.c @ 23964:11c5dd0a7bd7

(re_compile_fastmap): Do something similar to the previous change, for charset_not, wordchar, notwordchar, categoryspec, notcategoryspec.
author Richard M. Stallman <rms@gnu.org>
date Wed, 30 Dec 1998 20:44:39 +0000
parents e2e16f655cff
children aceb3b94328d
comparison
equal deleted inserted replaced
23963:c242e2dc93a9 23964:11c5dd0a7bd7
3321 } 3321 }
3322 break; 3322 break;
3323 3323
3324 3324
3325 case charset_not: 3325 case charset_not:
3326 /* Chars beyond end of map must be allowed. End of map is 3326 /* Chars beyond end of bitmap are possible matches.
3327 `127' if bufp->multibyte is nonzero. */ 3327 All the single-byte codes can occur in multibyte buffers.
3328 simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH); 3328 So any that are not listed in the charset
3329 are possible matches, even in multibyte buffers. */
3330 simple_char_max = (1 << BYTEWIDTH);
3329 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH; 3331 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH;
3330 j < simple_char_max; j++) 3332 j < simple_char_max; j++)
3331 fastmap[j] = 1; 3333 fastmap[j] = 1;
3332 3334
3333 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++; 3335 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++;
3350 } 3352 }
3351 break; 3353 break;
3352 3354
3353 3355
3354 case wordchar: 3356 case wordchar:
3355 simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH); 3357 /* All the single-byte codes can occur in multibyte buffers,
3358 and they may have word syntax. So do consider them. */
3359 simple_char_max = (1 << BYTEWIDTH);
3356 for (j = 0; j < simple_char_max; j++) 3360 for (j = 0; j < simple_char_max; j++)
3357 if (SYNTAX (j) == Sword) 3361 if (SYNTAX (j) == Sword)
3358 fastmap[j] = 1; 3362 fastmap[j] = 1;
3359 3363
3360 if (bufp->multibyte) 3364 if (bufp->multibyte)
3363 goto set_fastmap_for_multibyte_characters; 3367 goto set_fastmap_for_multibyte_characters;
3364 break; 3368 break;
3365 3369
3366 3370
3367 case notwordchar: 3371 case notwordchar:
3368 simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH); 3372 /* All the single-byte codes can occur in multibyte buffers,
3373 and they may not have word syntax. So do consider them. */
3374 simple_char_max = (1 << BYTEWIDTH);
3369 for (j = 0; j < simple_char_max; j++) 3375 for (j = 0; j < simple_char_max; j++)
3370 if (SYNTAX (j) != Sword) 3376 if (SYNTAX (j) != Sword)
3371 fastmap[j] = 1; 3377 fastmap[j] = 1;
3372 3378
3373 if (bufp->multibyte) 3379 if (bufp->multibyte)
3443 #endif 3449 #endif
3444 3450
3445 3451
3446 case categoryspec: 3452 case categoryspec:
3447 k = *p++; 3453 k = *p++;
3448 simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH); 3454 simple_char_max = (1 << BYTEWIDTH);
3449 for (j = 0; j < simple_char_max; j++) 3455 for (j = 0; j < simple_char_max; j++)
3450 if (CHAR_HAS_CATEGORY (j, k)) 3456 if (CHAR_HAS_CATEGORY (j, k))
3451 fastmap[j] = 1; 3457 fastmap[j] = 1;
3452 3458
3453 if (bufp->multibyte) 3459 if (bufp->multibyte)
3457 break; 3463 break;
3458 3464
3459 3465
3460 case notcategoryspec: 3466 case notcategoryspec:
3461 k = *p++; 3467 k = *p++;
3462 simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH); 3468 simple_char_max = (1 << BYTEWIDTH);
3463 for (j = 0; j < simple_char_max; j++) 3469 for (j = 0; j < simple_char_max; j++)
3464 if (!CHAR_HAS_CATEGORY (j, k)) 3470 if (!CHAR_HAS_CATEGORY (j, k))
3465 fastmap[j] = 1; 3471 fastmap[j] = 1;
3466 3472
3467 if (bufp->multibyte) 3473 if (bufp->multibyte)