This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
a2py.c: Use isWORDCHAR() instead of individ components
authorKarl Williamson <public@khwilliamson.com>
Sat, 5 May 2012 14:04:39 +0000 (08:04 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sun, 17 Jun 2012 17:35:05 +0000 (11:35 -0600)
isWORDCHAR() is a single macro (and array lookup) that is the equivalent
of the OR of the three macros previously used.

x2p/a2py.c

index 286f7cc..f6944b9 100644 (file)
@@ -399,7 +399,7 @@ yylex(void)
 
 #define SNARFWORD \
        d = tokenbuf; \
-       while (isALPHA(*s) || isDIGIT(*s) || *s == '_') \
+       while (isWORDCHAR(*s)) \
            *d++ = *s++; \
        *d = '\0'; \
        d = tokenbuf; \
@@ -426,7 +426,7 @@ yylex(void)
                maxfld = tmp;
            XOP(FIELD);
        }
-       for (d = s; isALPHA(*s) || isDIGIT(*s) || *s == '_'; )
+       for (d = s; isWORDCHAR(*s); )
            s++;
        split_to_array = TRUE;
        if (d != s)