[inseparable changes from patch from perl5.003_12 to perl5.003_13]
[p5sagit/p5-mst-13.2.git] / toke.c
diff --git a/toke.c b/toke.c
index 7dd35cb..4c79d7b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1255,7 +1255,7 @@ yylex()
        /* Force them to make up their mind on "@foo". */
        if (pit == '@' && lex_state != LEX_NORMAL && !lex_brackets) {
            GV *gv = gv_fetchpv(tokenbuf+1, FALSE, SVt_PVAV);
-           if (!gv || (tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)) {
+           if (!gv || ((tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv))) {
                char tmpbuf[1024];
                sprintf(tmpbuf, "Literal %s now requires backslash", tokenbuf);
                yyerror(tmpbuf);
@@ -2338,12 +2338,29 @@ yylex()
        if (*s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE"))
            goto just_a_word;
 
+       d = s;
+       while (d < bufend && isSPACE(*d))
+               d++;    /* no comments skipped here, or s### is misparsed */
+
+       /* Is this a label? */
+       if (expect == XSTATE && d < bufend && *d == ':' && *(d + 1) != ':') {
+           if (len == 1 && strchr("syq", tokenbuf[0]) ||
+               len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') ||
+                            (tokenbuf[0] == 'q' &&
+                             strchr("qwx", tokenbuf[1]))))
+               ; /* no */
+           else {
+               s = d + 1;
+               yylval.pval = savepv(tokenbuf);
+               CLINE;
+               TOKEN(LABEL);
+           }
+       }
+
+       /* Check for keywords */
        tmp = keyword(tokenbuf, len);
 
        /* Is this a word before a => operator? */
-       d = s;
-       while (d < bufend && (*d == ' ' || *d == '\t'))
-               d++;    /* no comments skipped here, or s### is misparsed */
        if (strnEQ(d,"=>",2)) {
            CLINE;
            if (dowarn && (tmp || perl_get_cv(tokenbuf, FALSE)))
@@ -2383,18 +2400,7 @@ yylex()
                        croak("Bad name after %s::", tokenbuf);
                }
 
-               /* Do special processing at start of statement. */
-
-               if (expect == XSTATE) {
-                   while (isSPACE(*s)) s++;
-                   if (*s == ':') {    /* It's a label. */
-                       yylval.pval = savepv(tokenbuf);
-                       s++;
-                       CLINE;
-                       TOKEN(LABEL);
-                   }
-               }
-               else if (expect == XOPERATOR) {
+               if (expect == XOPERATOR) {
                    if (bufptr == linestart) {
                        curcop->cop_line--;
                        warn(warn_nosemi);
@@ -2909,7 +2915,7 @@ yylex()
 
        case KEY_if:
            yylval.ival = curcop->cop_line;
-           OPERATOR(IF);
+           PRETERMBLOCK(IF);
 
        case KEY_index:
            LOP(OP_INDEX,XTERM);
@@ -3424,11 +3430,11 @@ yylex()
 
        case KEY_until:
            yylval.ival = curcop->cop_line;
-           OPERATOR(UNTIL);
+           PRETERMBLOCK(UNTIL);
 
        case KEY_unless:
            yylval.ival = curcop->cop_line;
-           OPERATOR(UNLESS);
+           PRETERMBLOCK(UNLESS);
 
        case KEY_unlink:
            LOP(OP_UNLINK,XTERM);
@@ -3480,7 +3486,7 @@ yylex()
 
        case KEY_while:
            yylval.ival = curcop->cop_line;
-           OPERATOR(WHILE);
+           PRETERMBLOCK(WHILE);
 
        case KEY_warn:
            hints |= HINT_BLOCK_SCOPE;
@@ -4341,8 +4347,6 @@ char *start;
     pm = (PMOP*)newPMOP(OP_MATCH, 0);
     if (multi_open == '?')
        pm->op_pmflags |= PMf_ONCE;
-    if (hints & HINT_LOCALE)
-       pm->op_pmflags |= PMf_LOCALE;
     while (*s && strchr("iogmsx", *s))
        pmflag(&pm->op_pmflags,*s++);
     pm->op_pmpermflags = pm->op_pmflags;
@@ -4570,7 +4574,7 @@ register char *s;
     if (!rsfp) {
        d = s;
        while (s < bufend &&
-         (*s != term || memcmp(s,tokenbuf,len) != 0) ) {
+         (*s != term || memNE(s,tokenbuf,len)) ) {
            if (*s++ == '\n')
                curcop->cop_line++;
        }
@@ -4603,7 +4607,7 @@ register char *s;
              (I32)curcop->cop_line,sv);
        }
        bufend = SvPVX(linestr) + SvCUR(linestr);
-       if (*s == term && memcmp(s,tokenbuf,len) == 0) {
+       if (*s == term && memEQ(s,tokenbuf,len)) {
            s = bufend - 1;
            *s = ' ';
            sv_catsv(linestr,herewas);
@@ -4882,7 +4886,7 @@ char *start;
        }
        *d = '\0';
        sv = NEWSV(92,0);
-       NUMERIC_STANDARD();
+       SET_NUMERIC_STANDARD();
        value = atof(tokenbuf);
        tryi32 = I_32(value);
        if (!floatit && (double)tryi32 == value)