From d0fb66e4dd07da2a32d4da479eecdd70515e9f20 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Sat, 6 Aug 2011 20:59:16 +0100 Subject: [PATCH] toke.c: S_checkcomma, "No comma allowed after %s" cleanup --- t/uni/parser.t | 8 +++++++- toke.c | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/t/uni/parser.t b/t/uni/parser.t index e67871e..256864c 100644 --- a/t/uni/parser.t +++ b/t/uni/parser.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan (tests => 44); +plan (tests => 45); use utf8; use open qw( :utf8 :std ); @@ -132,3 +132,9 @@ is ${"main::\345\225\217"}, undef, "..and using the encoded form doesn't"; like $@, qr!"$_" variable \$::\x{30cb} can't be in a package!, qq!'"$_" variable %s can't be in a package' is UTF-8 clean!; } } + +{ + local $@; + eval qq!print \x{30cb}, "comma""!; + like $@, qr/No comma allowed after filehandle/, "No comma allowed after filehandle triggers correctly for UTF-8 filehandles."; +} diff --git a/toke.c b/toke.c index 1696e24..0e6bc4d 100644 --- a/toke.c +++ b/toke.c @@ -8623,9 +8623,10 @@ S_checkcomma(pTHX_ const char *s, const char *name, const char *what) while (s < PL_bufend && isSPACE(*s)) s++; if (isIDFIRST_lazy_if(s,UTF)) { - const char * const w = s++; + const char * const w = s; + s += UTF ? UTF8SKIP(s) : 1; while (isALNUM_lazy_if(s,UTF)) - s++; + s += UTF ? UTF8SKIP(s) : 1; while (s < PL_bufend && isSPACE(*s)) s++; if (*s == ',') { -- 1.8.3.1