From: SADAHIRO Tomoyuki Date: Fri, 12 Aug 2005 00:20:39 +0000 (+0900) Subject: Re: Transliteration operator(tr//)on EBCDIC platform X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4c3a8340729ab239a926a5263f711fc20a0e2468;p=p5sagit%2Fp5-mst-13.2.git Re: Transliteration operator(tr//)on EBCDIC platform Message-Id: <20050812001541.EA69.BQW10602@nifty.com> p4raw-id: //depot/perl@25303 --- diff --git a/t/op/tr.t b/t/op/tr.t index b3661a4..2a3d29c 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -295,18 +295,15 @@ is($a, "X"); # (i-j, r-s, I-J, R-S), [\x89-\x91] [\xc9-\xd1] has to match them, # from Karsten Sperling. -# Not working in EBCDIC as of 12674. $c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/\x89-\x91/X/; is($c, 8); is($a, "XXXXXXXX"); - -# Not working in EBCDIC as of 12674. + $c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/\xc9-\xd1/X/; is($c, 8); is($a, "XXXXXXXX"); - -SKIP: { +SKIP: { skip "not EBCDIC", 4 unless $Is_EBCDIC; $c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/i-j/X/; diff --git a/toke.c b/toke.c index 19bac4f..1b16de0 100644 --- a/toke.c +++ b/toke.c @@ -1368,6 +1368,9 @@ S_scan_const(pTHX_ char *start) I32 has_utf8 = FALSE; /* Output constant is UTF8 */ I32 this_utf8 = UTF; /* The source string is assumed to be UTF8 */ UV uv; +#ifdef EBCDIC + UV literal_endpoint = 0; +#endif const char *leaveit = /* set of acceptably-backslashed characters */ PL_lex_inpat @@ -1417,8 +1420,9 @@ S_scan_const(pTHX_ char *start) } #ifdef EBCDIC - if ((isLOWER(min) && isLOWER(max)) || - (isUPPER(min) && isUPPER(max))) { + if (literal_endpoint == 2 && + ((isLOWER(min) && isLOWER(max)) || + (isUPPER(min) && isUPPER(max)))) { if (isLOWER(min)) { for (i = min; i <= max; i++) if (isLOWER(i)) @@ -1437,6 +1441,9 @@ S_scan_const(pTHX_ char *start) /* mark the range as done, and continue */ dorange = FALSE; didrange = TRUE; +#ifdef EBCDIC + literal_endpoint = 0; +#endif continue; } @@ -1455,6 +1462,9 @@ S_scan_const(pTHX_ char *start) } else { didrange = FALSE; +#ifdef EBCDIC + literal_endpoint = 0; +#endif } } @@ -1788,6 +1798,10 @@ S_scan_const(pTHX_ char *start) s++; continue; } /* end if (backslash) */ +#ifdef EBCDIC + else + literal_endpoint++; +#endif default_action: /* If we started with encoded form, or already know we want it