In the unlikely event that it helps you... it was indeed 17682
--
andreas
Thanks very much. I think I've found the origin of the problem
(around line 3550 in toke.c).
BTW it was sensitive to whitespace.
$ perl5.8.0 -ce 'sub f ($) { } f $x / 2;'
-e syntax OK
$ perl5.8.0 -ce 'sub f ($) { } f $x /2;'
Search pattern not terminated at -e line 1.
I'll have to write more regression tests to restore perl 5.8.0's behaviour
as much as possible.
Which shows the opposite of the original post. Puzzled.
> I'll have to write more regression tests to restore perl 5.8.0's behaviour
> as much as possible.
--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
WinNT 4, Win2K pro & WinCE 2.11. Smoking perl CORE: smo...@perl.org
http://archives.develooper.com/daily...@perl.org/ per...@perl.org
send smoke reports to: smokers...@perl.org, QA: http://qa.perl.org
Read it again.
OK. Understood. (My 5.8.0 has 17682, 17690, and 17777)
l1:/pro/3gl/CPAN 148 > perl5.6.1 -ce 'sub f ($) { } f $x / 2;'
-e syntax OK
l1:/pro/3gl/CPAN 149 > perl5.8.0 -ce 'sub f ($) { } f $x / 2;'
Search pattern not terminated at -e line 1.
Exit 255
l1:/pro/3gl/CPAN 150 > perl5.9.0 -ce 'sub f ($) { } f $x / 2;'
Search pattern not terminated at -e line 1.
Exit 255
l1:/pro/3gl/CPAN 151 > perl5.6.1 -ce 'sub f ($) { } f $x /2;'
Search pattern not terminated at -e line 1.
Exit 255
l1:/pro/3gl/CPAN 152 > perl5.8.0 -ce 'sub f ($) { } f $x /2;'
Search pattern not terminated at -e line 1.
Exit 255
l1:/pro/3gl/CPAN 153 > perl5.9.0 -ce 'sub f ($) { } f $x /2;'
Search pattern not terminated at -e line 1.
Exit 255
l1:/pro/3gl/CPAN 154 > perl5.6.1 -ce 'sub f ($) { } f ($x / 2);'
-e syntax OK
l1:/pro/3gl/CPAN 155 > perl5.8.0 -ce 'sub f ($) { } f ($x / 2);'
-e syntax OK
l1:/pro/3gl/CPAN 156 > perl5.9.0 -ce 'sub f ($) { } f ($x / 2);'
-e syntax OK
l1:/pro/3gl/CPAN 157 > perl5.6.1 -ce 'sub f ($) { } f ($x /2);'
-e syntax OK
l1:/pro/3gl/CPAN 158 > perl5.8.0 -ce 'sub f ($) { } f ($x /2);'
-e syntax OK
l1:/pro/3gl/CPAN 159 > perl5.9.0 -ce 'sub f ($) { } f ($x /2);'
-e syntax OK
l1:/pro/3gl/CPAN 160 >
In (I think) the part of toke.c that handles lookahead after scalars,
there's a big if/else if with lookaheads to decide if the next thing is
a term or an operator (so it can decide if we're using an indirect
object). Apparently another case needs to be added to that.
--Brent Dax <bren...@cpan.org>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
"In other words, it's the 'Blow up this Entire Planet and Possibly One
or Two Others We Noticed on our Way Out Here' operator."
--Damian Conway
You're right. Here's the fix (it mostly restores 5.8.0's behavior.)
Change 17900 by rgs@rgs-home on 2002/09/12 19:33:06
Fix a syntax incompatibility introduced by the // operator.
(Note that C<print $fh //> is still a syntax error, it
wasn't with perl 5.8.0.)
Affected files ...
.... //depot/perl/t/op/dor.t#3 edit
.... //depot/perl/toke.c#442 edit
Differences ...
==== //depot/perl/t/op/dor.t#3 (text) ====
@@ -10,7 +10,7 @@
package main;
require './test.pl';
-plan( tests => 25 );
+plan( tests => 30 );
my($x);
@@ -59,3 +59,16 @@
eval "sub { $_ // 0 }";
is($@, '', "$_ // ... compiles");
}
+
+# Test for some ambiguous syntaxes
+
+eval q# sub f ($) { } f $x / 2; #;
+is( $@, '' );
+eval q# sub f ($):lvalue { $y } f $x /= 2; #;
+is( $@, '' );
+eval q# sub f ($) { } f $x /2; #;
+like( $@, qr/^Search pattern not terminated/ );
+eval q# sub { print $fh / 2 } #;
+is( $@, '' );
+eval q# sub { print $fh /2 } #;
+like( $@, qr/^Search pattern not terminated/ );
==== //depot/perl/toke.c#442 (text) ====
@@ -3554,14 +3554,9 @@
PL_expect = XTERM; /* e.g. print $fh .3 */
else if (strchr("?-+", *s) && !isSPACE(s[1]) && s[1] != '=')
PL_expect = XTERM; /* e.g. print $fh -1 */
- else if (*s == '/') {
- if(s[1] == '/') {
- PL_expect=XOPERATOR;
- }
- else {
- PL_expect=XTERM;
- }
- }
+ else if (*s == '/' && !isSPACE(s[1]) && s[1] != '=' && s[1] != '/')
+ PL_expect = XTERM; /* e.g. print $fh /.../
+ XXX except DORDOR operator */
else if (*s == '<' && s[1] == '<' && !isSPACE(s[2]) && s[2] != '=')
PL_expect = XTERM; /* print $fh <<"EOF" */
}
> "In other words, it's the 'Blow up this Entire Planet and Possibly One
> or Two Others We Noticed on our Way Out Here' operator."
> --Damian Conway
Is it ? ;-)
--
If strain on the lexer were a design criterion, I blew it long ago.
-- Larry Wall
These tests look strange to me: can you explain why C< f $x /2 > should
be a syntax error, but not C< f 1 /2 >?
Hugo
For backward compatibility with the indirect object notation :
(the perl parser has to make some guesses on this rather ambiguous
syntax and this should not be modified in a incompatible way)
$ perl -MO=Deparse -e 'f $x /2/'
$x->f(/2/);