Index: compilers/imcc/imcc.l =================================================================== --- compilers/imcc/imcc.l (revision 41935) +++ compilers/imcc/imcc.l (working copy) @@ -671,6 +671,19 @@ return yytext[0]; } +^"__END__"{EOL} { + BEGIN(INITIAL); + + if (IMCC_INFO(interp)->frames->s.pasm_file) { + IMCC_INFO(interp)->frames->s.pasm_file = 2; + return EOM; + } + + return 0; + } + +^"__END__"{EOL} yyterminate(); + <> { BEGIN(INITIAL); Index: t/compilers/imcc/syn/end.t =================================================================== --- t/compilers/imcc/syn/end.t (revision 0) +++ t/compilers/imcc/syn/end.t (revision 0) @@ -0,0 +1,29 @@ +#!perl +# Copyright (C) 2001-2008, Parrot Foundation. +# $Id: const.t 37201 2009-03-08 12:07:48Z fperrad $ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); + +use Test::More; +use Parrot::Test tests => 1; + +pir_output_is( <<'CODE', <<'OUT', "__END__ acts like EOF" ); +.sub 'main' :main + set $I0, 1 + print "ok 1\n" +.end + +__END__ +this would not compile +CODE +ok 1 +OUT + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: