diff options
-rw-r--r-- | regcharclass.h | 4 | ||||
-rwxr-xr-x | regen/regcharclass.pl | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/regcharclass.h b/regcharclass.h index 5b04492b0f..f7ca75843e 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -647,7 +647,7 @@ */ /*** GENERATED CODE ***/ #define is_PROBLEMATIC_LOCALE_FOLD_utf8(s) \ -( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0x80 ) == 0x00 ) ? 1 \ +( ( NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x7F ) ? 1 \ : ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xFE ) == 0xC2 ) ? \ 2 \ : ( 0xC4 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xC7 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ @@ -684,7 +684,7 @@ */ /*** GENERATED CODE ***/ #define is_PROBLEMATIC_LOCALE_FOLDEDS_START_utf8(s) \ -( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0x80 ) == 0x00 ) ? 1 \ +( ( NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x7F ) ? 1 \ : ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xFE ) == 0xC2 ) ? \ 2 \ : ( 0xC4 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xC7 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 002cd0f6a9..1f780a48f5 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -1097,6 +1097,21 @@ sub _cond_as_str { $ranges[$i] = # Trivial case: single element range sprintf "$self->{val_fmt} == $test", $ranges[$i]->[0]; } + elsif ($ranges[$i]->[0] == 0) { + # If the range matches all 256 possible bytes, it is trivially + # true. + return 1 if $ranges[0]->[1] == 0xFF; # @ranges must be 1 in + # this case + $ranges[$i] = sprintf "( $test <= $self->{val_fmt} )", + $ranges[$i]->[1]; + } + elsif ($ranges[$i]->[1] == 255) { + + # Similarly the max possible is 255, so can omit an upper bound + # test if the calculated max is the max possible one. + $ranges[$i] = sprintf "( $test >= $self->{val_fmt} )", + $ranges[0]->[0]; + } else { my $output = ""; |