This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't use EBCDIC macro for a C language escape
authorKarl Williamson <public@khwilliamson.com>
Fri, 8 Feb 2013 04:35:57 +0000 (21:35 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Aug 2013 15:55:49 +0000 (09:55 -0600)
C recognizes '\a' (for BEL); just use that instead of a look-up.

regen/unicode_constants.pl could be used to generate the character for
the ESC (set in nearby code), but I didn't do that because of
potential bootstrapping problems when porting to an EBCDIC platform
without a working perl.  (The other characters generated in that .pl are
less likely to cause problems when compiling perl.)

regcomp.c
toke.c

index 440d26a..78773e6 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10918,7 +10918,7 @@ tryagain:
                        p++;
                        break;
                    case 'a':
-                         ender = ASCII_TO_NATIVE('\007');
+                         ender = '\a';
                        p++;
                        break;
                    case 'o':
@@ -12579,7 +12579,7 @@ parseit:
            case 'f':   value = '\f';                   break;
            case 'b':   value = '\b';                   break;
            case 'e':   value = ASCII_TO_NATIVE('\033');break;
-           case 'a':   value = ASCII_TO_NATIVE('\007');break;
+           case 'a':   value = '\a';                   break;
            case 'o':
                RExC_parse--;   /* function expects to be pointed at the 'o' */
                {
diff --git a/toke.c b/toke.c
index 49d1b22..96b0274 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3762,7 +3762,7 @@ S_scan_const(pTHX_ char *start)
                *d++ = ASCII_TO_NEED(has_utf8,'\033');
                break;
            case 'a':
-               *d++ = ASCII_TO_NEED(has_utf8,'\007');
+               *d++ = NATIVE_TO_NEED(has_utf8,'\a');
                break;
            } /* end switch */