diff options
author | Adrian M. Enache <enache@rdslink.ro> | 2003-02-13 06:52:21 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-02-19 20:55:09 +0000 |
commit | 7df0d0422c26edcc954b82bd79e461b99b3c4092 (patch) | |
tree | 5431632cfc3961abf098a51dd59a5c6ce342fe31 | |
parent | fe581ec7e70f830119f2a196166efcfaafaf0a43 (diff) | |
download | perl-7df0d0422c26edcc954b82bd79e461b99b3c4092.tar.gz |
Re: [perl #20716] scope error with brackets
Message-ID: <20030213025221.GA1215@ratsnest.hole>
(better version of change #18687)
p4raw-link: @18687 on //depot/perl: 437fd2104756c25dedf68c6e31cd29ecbf0e2569
p4raw-id: //depot/perl@18753
-rw-r--r-- | t/comp/parser.t | 26 | ||||
-rw-r--r-- | toke.c | 6 |
2 files changed, 23 insertions, 9 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t index 88f933c7a6..ad1c5b80bd 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } require "./test.pl"; -plan( tests => 15 ); +plan( tests => 20 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -68,9 +68,23 @@ eval { is( $@, '', 'PL_lex_brackstack' ); { - undef $a; - undef @b; - my $a="a"; is("${a}{", "a{", "scope error #20716"); - my $a="a"; is("${a}[", "a[", "scope error #20716"); - my @b=("b"); is("@{b}{", "b{", "scope error #20716"); + # tests for bug #20716 + undef $a; + undef @b; + my $a="A"; + is("${a}{", "A{", "interpolation, qq//"); + is("${a}[", "A[", "interpolation, qq//"); + my @b=("B"); + is("@{b}{", "B{", "interpolation, qq//"); + is(qr/${a}{/, '(?-xism:A{)', "interpolation, qr//"); + my $c = "A{"; + $c =~ /${a}{/; + is($&, 'A{', "interpolation, m//"); + $c =~ s/${a}{/foo/; + is($c, 'foo', "interpolation, s/...//"); + $c =~ s/foo/${a}{/; + is($c, 'A{', "interpolation, s//.../"); + is(<<"${a}{", "A{ A[ B{\n", "interpolation, here doc"); +${a}{ ${a}[ @{b}{ +${a}{ } @@ -6276,8 +6276,10 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des } if (*s == '}') { s++; - if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) + if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) { PL_lex_state = LEX_INTERPEND; + PL_expect = XREF; + } if (funny == '#') funny = '@'; if (PL_lex_state == LEX_NORMAL) { @@ -6289,8 +6291,6 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des funny, dest, funny, dest); } } - if (PL_lex_inwhat == OP_STRINGIFY) - PL_expect = XREF; } else { s = bracket; /* let the parser handle it */ |