summaryrefslogtreecommitdiff
path: root/regen/regcharclass.pl
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2012-11-17 12:58:12 +0100
committerYves Orton <demerphq@gmail.com>2012-11-17 12:58:12 +0100
commitee98d22d3f83f14ecaaaefd176f9630c0f262afd (patch)
tree74968e13ed853b793cd2aa2ad5596ffb552ea412 /regen/regcharclass.pl
parentba593adc2b8b59175ac3c28b7b41aef7a74908e2 (diff)
downloadperl-ee98d22d3f83f14ecaaaefd176f9630c0f262afd.tar.gz
Eliminate test from generated cp macros
Sayeth Karl: In the _cp macros, the final test can be simplified: /*** GENERATED CODE ***/ #define is_VERTWS_cp(cp) \ ( ( 0x0A <= cp && cp <= 0x0D ) || ( 0x0D < cp && \ ( 0x85 == cp || ( 0x85 < cp && \ ( 0x2028 == cp || ( 0x2028 < cp && \ 0x2029 == cp ) ) ) ) ) ) That 0x2028 < cp can be omitted and it will still mean the same thing. And So Be It.
Diffstat (limited to 'regen/regcharclass.pl')
-rwxr-xr-xregen/regcharclass.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl
index b7dddd2efc..944f61b976 100755
--- a/regen/regcharclass.pl
+++ b/regen/regcharclass.pl
@@ -1076,8 +1076,13 @@ sub _combine {
$gtv= sprintf "$self->{val_fmt}", $item;
}
if ( @cond ) {
- return "( $cstr || ( $gtv < $test &&\n"
- . $self->_combine( $test, @cond ) . " ) )";
+ my $combine= $self->_combine( $test, @cond );
+ if (@cond >1) {
+ return "( $cstr || ( $gtv < $test &&\n"
+ . $combine . " ) )";
+ } else {
+ return "( $cstr || $combine )";
+ }
} else {
return $cstr;
}