Re: [ID 20010809.023] perlre misleads when stating that (?i) should be at front of...
[p5sagit/p5-mst-13.2.git] / toke.c
diff --git a/toke.c b/toke.c
index abb0c2d..52706a3 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -36,11 +36,14 @@ static I32 utf16rev_textfilter(pTHXo_ int idx, SV *sv, int maxlen);
 #define XFAKEBRACK 128
 #define XENUMMASK 127
 
-#ifdef EBCDIC
-/* For now 'use utf8' does not affect tokenizer on EBCDIC */
-#define UTF (PL_linestr && DO_UTF8(PL_linestr))
+#ifdef USE_UTF8_SCRIPTS
+#   define UTF (!IN_BYTES)
 #else
-#define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8))
+#   ifdef EBCDIC /* For now 'use utf8' does not affect tokenizer on EBCDIC */
+#       define UTF (PL_linestr && DO_UTF8(PL_linestr))
+#   else
+#       define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8))
+#   endif
 #endif
 
 /* In variables named $^X, these are the legal values for X.
@@ -6909,8 +6912,7 @@ Perl_scan_num(pTHX_ char *start, YYSTYPE* lvalp)
     register char *e;                  /* end of temp buffer */
     NV nv;                             /* number read, as a double */
     SV *sv = Nullsv;                   /* place to put the converted number */
-    bool floatit,                      /* boolean: int or float? */
-       octal = 0;                      /* Is this an octal number? */
+    bool floatit;                      /* boolean: int or float? */
     char *lastub = 0;                  /* position of last underbar */
     static char number_too_long[] = "Number too long";
 
@@ -6964,7 +6966,6 @@ Perl_scan_num(pTHX_ char *start, YYSTYPE* lvalp)
            /* so it must be octal */
            else {
                shift = 3;
-               octal = 1;
                s++;
            }
 
@@ -7318,11 +7319,8 @@ vstring:
 
     /* make the op for the constant and return */
 
-    if (sv) {
+    if (sv)
        lvalp->opval = newSVOP(OP_CONST, 0, sv);
-       if (octal)
-           ((SVOP *)lvalp->opval)->op_private |= OPpCONST_OCTAL;
-    }
     else
        lvalp->opval = Nullop;
 
@@ -7364,15 +7362,19 @@ S_scan_formline(pTHX_ register char *s)
                if (*t == '@' || *t == '^')
                    needargs = TRUE;
            }
-           sv_catpvn(stuff, s, eol-s);
+           if (eol > s) {
+               sv_catpvn(stuff, s, eol-s);
 #ifndef PERL_STRICT_CR
-           if (eol-s > 1 && eol[-2] == '\r' && eol[-1] == '\n') {
-               char *end = SvPVX(stuff) + SvCUR(stuff);
-               end[-2] = '\n';
-               end[-1] = '\0';
-               SvCUR(stuff)--;
-           }
+               if (eol-s > 1 && eol[-2] == '\r' && eol[-1] == '\n') {
+                   char *end = SvPVX(stuff) + SvCUR(stuff);
+                   end[-2] = '\n';
+                   end[-1] = '\0';
+                   SvCUR(stuff)--;
+               }
 #endif
+           }
+           else
+             break;
        }
        s = eol;
        if (PL_rsfp) {