On Tue, Nov 09, 2004 at 07:14:27PM -0800, Will Coleda wrote: > # New Ticket Created by Will Coleda > # Please include the string: [perl #32393] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32393 > > > > - the parser doesn't like empty subs or compilation units: > .sub _foo > .end > > .emit > .eom > inserting a 'noop' helps. > > from imcc/BUGS >
modified files: imcc/imcc.y imcc/t/syn/op.t
--- imcc/imcc.y.orig 2004-11-04 09:21:06.000000000 +0100 +++ imcc/imcc.y 2004-11-10 05:32:35.011247240 +0100 @@ -343,10 +343,10 @@ %type <t> type newsub ptr %type <i> program class class_body member_decls member_decl field_decl %type <i> method_decl class_namespace -%type <i> global constdef sub emit pcc_sub sub_body pcc_ret +%type <i> global constdef sub emit pcc_sub pcc_ret %type <i> compilation_units compilation_unit pmc_const %type <s> classname relop -%type <i> labels _labels label statements statement sub_call +%type <i> labels _labels label statement sub_call %type <i> pcc_sub_call %type <sr> sub_param sub_params pcc_arg pcc_result pcc_args pcc_results pcc_params pcc_param %type <sr> pcc_returns pcc_return pcc_call arg the_sub @@ -461,7 +461,7 @@ emit: EMIT { cur_unit = imc_open_unit(interp, IMC_PASM); function = "(emit)"; } - pasmcode + opt_pasmcode EOM { /* if (optimizer_level & OPT_PASM) imc_compile_unit(interp, IMC_INFO(interp)->cur_unit); @@ -470,6 +470,11 @@ $$=0; } ; +opt_pasmcode: + /* empty */ + | pasmcode + ; + class_namespace: NAMESPACE '[' keylist ']' { @@ -562,7 +567,7 @@ i->r[1]->pcc_sub->pragma = $4; } sub_params - sub_body { $$ = 0; } + sub_body ESUB { $$ = 0; } ; sub_params: @@ -577,7 +582,8 @@ ; sub_body: - statements ESUB { $$ = 0; } + /* empty */ + | statements ; pcc_sub: @@ -590,7 +596,7 @@ i->r[1]->pcc_sub->pragma = $4; } pcc_params - sub_body { $$ = 0; } + sub_body ESUB { $$ = 0; } ; pcc_params: --- imcc/t/syn/op.t.orig 2004-11-10 05:45:28.469663688 +0100 +++ imcc/t/syn/op.t 2004-11-10 05:43:50.045626416 +0100 @@ -256,3 +256,12 @@ in sub done OUT + +# ticket 32393 +output_is(<<'CODE', '', "empty sub"); +.sub _foo +.end + +.emit +.eom +CODE