summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-10-19 23:03:44 -0600
committerKarl Williamson <khw@cpan.org>2014-10-21 09:26:51 -0600
commite92292576e58ce767c60c4cd8ebc1989792659ec (patch)
treea737e7ecd4cd01a47b3c35dff5b394b4e8b09db9 /toke.c
parent4475d0d23c30e1ffbe123b0f5e3b800c0be35f4c (diff)
downloadperl-e92292576e58ce767c60c4cd8ebc1989792659ec.tar.gz
Don't allow literal control chars in var names in EBCDIC
Currently, a variable name of length-1 may have as its name some of the possible control characters, though this usage is deprecated. It is a pain to fix this to work properly on EBCDIC, and since the use of these is deprecated, the pumpking agreed with me to not to bother with doing so.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 51075e5711..b65368715a 100644
--- a/toke.c
+++ b/toke.c
@@ -8562,11 +8562,19 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
* Because all ASCII characters have the same representation whether
* encoded in UTF-8 or not, we can use the foo_A macros below and '\0' and
* '{' without knowing if is UTF-8 or not */
+#ifdef EBCDIC
+# define VALID_LEN_ONE_IDENT(s, is_utf8) \
+ (isGRAPH_A(*(s)) || ((is_utf8) \
+ ? isIDFIRST_utf8((U8*) (s)) \
+ : (isGRAPH_L1(*s) \
+ && LIKELY((U8) *(s) != LATIN1_TO_NATIVE(0xAD)))))
+#else
# define VALID_LEN_ONE_IDENT(s, is_utf8) (! isSPACE_A(*(s)) \
&& LIKELY(*(s) != '\0') \
&& (! is_utf8 \
|| isASCII_utf8((U8*) (s)) \
|| isIDFIRST_utf8((U8*) (s))))
+#endif
if ((s <= PL_bufend - (is_utf8)
? UTF8SKIP(s)
: 1)