| 2383 |
for (;; ptr++) |
for (;; ptr++) |
| 2384 |
{ |
{ |
| 2385 |
BOOL negate_class; |
BOOL negate_class; |
| 2386 |
|
BOOL should_flip_negation; |
| 2387 |
BOOL possessive_quantifier; |
BOOL possessive_quantifier; |
| 2388 |
BOOL is_quantifier; |
BOOL is_quantifier; |
| 2389 |
BOOL is_recurse; |
BOOL is_recurse; |
| 2632 |
else break; |
else break; |
| 2633 |
} |
} |
| 2634 |
|
|
| 2635 |
|
/* If a class contains a negative special such as \S, we need to flip the |
| 2636 |
|
negation flag at the end, so that support for characters > 255 works |
| 2637 |
|
correctly (they are all included in the class). */ |
| 2638 |
|
|
| 2639 |
|
should_flip_negation = FALSE; |
| 2640 |
|
|
| 2641 |
/* Keep a count of chars with values < 256 so that we can optimize the case |
/* Keep a count of chars with values < 256 so that we can optimize the case |
| 2642 |
of just a single character (as long as it's < 256). However, For higher |
of just a single character (as long as it's < 256). However, For higher |
| 2643 |
valued UTF-8 characters, we don't yet do any optimization. */ |
valued UTF-8 characters, we don't yet do any optimization. */ |
| 2812 |
continue; |
continue; |
| 2813 |
|
|
| 2814 |
case ESC_D: |
case ESC_D: |
| 2815 |
|
should_flip_negation = TRUE; |
| 2816 |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit]; |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit]; |
| 2817 |
continue; |
continue; |
| 2818 |
|
|
| 2821 |
continue; |
continue; |
| 2822 |
|
|
| 2823 |
case ESC_W: |
case ESC_W: |
| 2824 |
|
should_flip_negation = TRUE; |
| 2825 |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word]; |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word]; |
| 2826 |
continue; |
continue; |
| 2827 |
|
|
| 2831 |
continue; |
continue; |
| 2832 |
|
|
| 2833 |
case ESC_S: |
case ESC_S: |
| 2834 |
|
should_flip_negation = TRUE; |
| 2835 |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space]; |
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space]; |
| 2836 |
classbits[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */ |
classbits[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */ |
| 2837 |
continue; |
continue; |
| 3337 |
zeroreqbyte = reqbyte; |
zeroreqbyte = reqbyte; |
| 3338 |
|
|
| 3339 |
/* If there are characters with values > 255, we have to compile an |
/* If there are characters with values > 255, we have to compile an |
| 3340 |
extended class, with its own opcode. If there are no characters < 256, |
extended class, with its own opcode, unless there was a negated special |
| 3341 |
we can omit the bitmap in the actual compiled code. */ |
such as \S in the class, because in that case all characters > 255 are in |
| 3342 |
|
the class, so any that were explicitly given as well can be ignored. If |
| 3343 |
|
(when there are explicit characters > 255 that must be listed) there are no |
| 3344 |
|
characters < 256, we can omit the bitmap in the actual compiled code. */ |
| 3345 |
|
|
| 3346 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 3347 |
if (class_utf8) |
if (class_utf8 && !should_flip_negation) |
| 3348 |
{ |
{ |
| 3349 |
*class_utf8data++ = XCL_END; /* Marks the end of extra data */ |
*class_utf8data++ = XCL_END; /* Marks the end of extra data */ |
| 3350 |
*code++ = OP_XCLASS; |
*code++ = OP_XCLASS; |
| 3370 |
} |
} |
| 3371 |
#endif |
#endif |
| 3372 |
|
|
| 3373 |
/* If there are no characters > 255, negate the 32-byte map if necessary, |
/* If there are no characters > 255, set the opcode to OP_CLASS or |
| 3374 |
and copy it into the code vector. If this is the first thing in the branch, |
OP_NCLASS, depending on whether the whole class was negated and whether |
| 3375 |
there can be no first char setting, whatever the repeat count. Any reqbyte |
there were negative specials such as \S in the class. Then copy the 32-byte |
| 3376 |
setting must remain unchanged after any kind of repeat. */ |
map into the code vector, negating it if necessary. */ |
| 3377 |
|
|
| 3378 |
|
*code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS; |
| 3379 |
if (negate_class) |
if (negate_class) |
| 3380 |
{ |
{ |
|
*code++ = OP_NCLASS; |
|
| 3381 |
if (lengthptr == NULL) /* Save time in the pre-compile phase */ |
if (lengthptr == NULL) /* Save time in the pre-compile phase */ |
| 3382 |
for (c = 0; c < 32; c++) code[c] = ~classbits[c]; |
for (c = 0; c < 32; c++) code[c] = ~classbits[c]; |
| 3383 |
} |
} |
| 3384 |
else |
else |
| 3385 |
{ |
{ |
|
*code++ = OP_CLASS; |
|
| 3386 |
memcpy(code, classbits, 32); |
memcpy(code, classbits, 32); |
| 3387 |
} |
} |
| 3388 |
code += 32; |
code += 32; |