summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-08-12 18:42:35 +0300
committerGurusamy Sarathy <gsar@cpan.org>1998-09-23 03:20:13 +0000
commit8ada0baa1f731edbe470a7630cfeb30c131b4672 (patch)
tree878d7ca51320e5fb9ab9f95b0c13c54031deddad /toke.c
parent4beedc23b598a493399ba23c8c4bd5448e52283a (diff)
downloadperl-8ada0baa1f731edbe470a7630cfeb30c131b4672.tar.gz
apply minimal variant of patch (sent via private mail)
Message-Id: <199808121242.PAA29761@comanche.spices> Subject: [PATCH] 5.004_02 or 5.005_51: fix regexp and tr character ranges in non-ASCII lands p4raw-id: //depot/perl@1803
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/toke.c b/toke.c
index 2381be3cda..90fc7b8223 100644
--- a/toke.c
+++ b/toke.c
@@ -904,6 +904,7 @@ scan_const(char *start)
/* expand a range A-Z to the full set of characters. AIE! */
if (dorange) {
I32 i; /* current expanded character */
+ I32 min; /* first character in range */
I32 max; /* last character in range */
i = d - SvPVX(sv); /* remember current offset */
@@ -911,10 +912,26 @@ scan_const(char *start)
d = SvPVX(sv) + i; /* restore d after the grow potentially has changed the ptr */
d -= 2; /* eat the first char and the - */
- max = (U8)d[1]; /* last char in range */
-
- for (i = (U8)*d; i <= max; i++)
- *d++ = i;
+ min = (U8)*d; /* first char in range */
+ max = (U8)d[1]; /* last char in range */
+
+#ifndef ASCIIish
+ if ((isLOWER(min) && isLOWER(max)) ||
+ (isUPPER(min) && isUPPER(max))) {
+ if (isLOWER(min)) {
+ for (i = min; i <= max; i++)
+ if (isLOWER(i))
+ *d++ = i;
+ } else {
+ for (i = min; i <= max; i++)
+ if (isUPPER(i))
+ *d++ = i;
+ }
+ }
+ else
+#endif
+ for (i = min; i <= max; i++)
+ *d++ = i;
/* mark the range as done, and continue */
dorange = FALSE;