Ticket #1118: add__END__.patch

File add__END__.patch, 1.3 KB (added by mgrimes, 12 years ago)
  • compilers/imcc/imcc.l

     
    671671        return yytext[0]; 
    672672    } 
    673673 
     674<emit>^"__END__"{EOL} { 
     675        BEGIN(INITIAL); 
     676 
     677        if (IMCC_INFO(interp)->frames->s.pasm_file) { 
     678            IMCC_INFO(interp)->frames->s.pasm_file = 2; 
     679            return EOM; 
     680        } 
     681 
     682        return 0; 
     683    } 
     684 
     685<INITIAL>^"__END__"{EOL} yyterminate(); 
     686 
    674687<emit><<EOF>> { 
    675688        BEGIN(INITIAL); 
    676689 
  • t/compilers/imcc/syn/end.t

     
     1#!perl 
     2# Copyright (C) 2001-2008, Parrot Foundation. 
     3# $Id: const.t 37201 2009-03-08 12:07:48Z fperrad $ 
     4 
     5use strict; 
     6use warnings; 
     7use lib qw( . lib ../lib ../../lib ); 
     8 
     9use Test::More; 
     10use Parrot::Test tests => 1; 
     11 
     12pir_output_is( <<'CODE', <<'OUT', "__END__ acts like EOF" ); 
     13.sub 'main' :main 
     14    set $I0, 1 
     15    print "ok 1\n" 
     16.end 
     17 
     18__END__ 
     19this would not compile 
     20CODE 
     21ok 1 
     22OUT 
     23 
     24# Local Variables: 
     25#   mode: cperl 
     26#   cperl-indent-level: 4 
     27#   fill-column: 100 
     28# End: 
     29# vim: expandtab shiftwidth=4: