Change 16556 by jhi@alpha on 2002/05/12 15:29:36 EBCDIC: make t/op/pat #242 and 243 finally succeed.
Affected files ... .... //depot/perl/pod/perlebcdic.pod#17 edit .... //depot/perl/regcomp.c#305 edit Differences ... ==== //depot/perl/pod/perlebcdic.pod#17 (text) ==== Index: perl/pod/perlebcdic.pod --- perl/pod/perlebcdic.pod#16~15317~ Tue Mar 19 05:56:27 2002 +++ perl/pod/perlebcdic.pod Sun May 12 08:29:36 2002 @@ -837,7 +837,11 @@ [A-Z] and [a-z] have been especially coded to not pick up gap characters. For example, characters such as E<ocirc> C<o WITH CIRCUMFLEX> that lie between I and J would not be matched by the -regular expression range C</[H-K]/>. +regular expression range C</[H-K]/>. This works in +the other direction, too, if either of the range end points is +explicitly numeric: C<[\x89-\x91]> will match C<\x8e>, even +though C<\x89> is C<i> and C<\x91 > is C<j>, and C<\x8e> +is a gap character from the alphabetic viewpoint. If you do want to match the alphabet gap characters in a single octet regular expression try matching the hex or octal code such ==== //depot/perl/regcomp.c#305 (text) ==== Index: perl/regcomp.c --- perl/regcomp.c#304~16231~ Sat Apr 27 14:56:22 2002 +++ perl/regcomp.c Sun May 12 08:29:36 2002 @@ -3523,6 +3523,9 @@ UV n; bool optimize_invert = TRUE; AV* unicode_alternate = 0; +#ifdef EBCDIC + UV literal_endpoint = 0; +#endif ret = reganode(pRExC_state, ANYOF, 0); @@ -3685,6 +3688,10 @@ break; } } /* end of \blah */ +#ifdef EBCDIC + else + literal_endpoint++; +#endif if (namedclass > OOB_NAMEDCLASS) { /* this is a named class \blah */ @@ -4087,8 +4094,11 @@ IV ceilvalue = value < 256 ? value : 255; #ifdef EBCDIC - if ((isLOWER(prevvalue) && isLOWER(ceilvalue)) || - (isUPPER(prevvalue) && isUPPER(ceilvalue))) + /* In EBCDIC [\x89-\x91] should include + * the \x8e but [i-j] should not. */ + if (literal_endpoint == 2 && + ((isLOWER(prevvalue) && isLOWER(ceilvalue)) || + (isUPPER(prevvalue) && isUPPER(ceilvalue)))) { if (isLOWER(prevvalue)) { for (i = prevvalue; i <= ceilvalue; i++) @@ -4168,6 +4178,9 @@ } } } +#ifdef EBCDIC + literal_endpoint = 0; +#endif } range = 0; /* this range (if it was one) is done now */ End of Patch.