On Tue, Jun 10, 2008 at 01:07:45PM -0700, Ron Schmidt wrote:
> Perl 5 allows empty semicolon terminated statements. perl6 currently
> allows for empty closures but treats a semicolon that follows nothing or
> whitespace as a syntax error. The attached patch to grammar.pg provides
> a fix for this discrepancy between perl 5 and perl 6. Also attached is
> an attempt at a test suite for some statement termination cases.
>
> The patch is small and passes "make fulltest" under ubuntu and "make
> spectest", as well as the parts of "make test" in the perl6 directory,
> under cygwin. Modifying statementlist this way does not appear to be
> the most elegant solution to the problem but approaches like
> [<statement>?<.eat_terminator> ]* seemed to fail with relatively serious
> errors.
Thanks for the patch. In cases of changes to the grammar, however,
we're trying to keep Rakudo's grammar as closely aligned to STD.pm
as we can -- here's STD.pm's definition for statementlist (line ~570):
rule statementlist {
:my StrPos $endstmt is context<rw> = -1;
[<statement><.eat_terminator> ]*
{*}
}
So, since Rakudo's current grammar pretty much matches what STD.pm
has here, I'd prefer that we figure out how STD.pm is handling
empty statements and do that.
Thanks again!
Pm