From: Nicholas Clark Date: Thu, 9 Mar 2006 20:48:18 +0000 (+0000) Subject: Add the madly parser. I believe that this is all the C code. Now to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=00e74f145ac4513e21f301b1f6ee9d0075465ab5;p=p5sagit%2Fp5-mst-13.2.git Add the madly parser. I believe that this is all the C code. Now to find the bugs that stowed away. p4raw-id: //depot/perl@27447 --- diff --git a/Configure b/Configure index 6505174..68dc00e 100755 --- a/Configure +++ b/Configure @@ -966,6 +966,9 @@ mad='' make_set_make='' d_mymalloc='' freetype='' +madlyh='' +madlyobj='' +madlysrc='' mallocobj='' mallocsrc='' malloctype='' @@ -18978,8 +18981,14 @@ EOM rp='Build Perl with MAD?' . ./myread case "$ans" in -y|Y) val="$define" ;; -*) val="$undef" ;; +y|Y) val="$define" + madlyh='madly.h madly.act madly.tab' + madlysrc='madly.c' + madlyobj="madly$_o" ;; +*) val="$undef" + madlyh='' + madlysrc='' + madlyobj='' ;; esac set mad eval $setvar @@ -21902,6 +21911,9 @@ make='$make' make_set_make='$make_set_make' mallocobj='$mallocobj' mallocsrc='$mallocsrc' +madlyh='$madlyh' +madlyobj='$madlyobj' +madlysrc='$madlysrc' malloctype='$malloctype' man1dir='$man1dir' man1direxp='$man1direxp' diff --git a/MANIFEST b/MANIFEST index 6ae4262..d1cf7ce 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2621,6 +2621,11 @@ lib/warnings.pm For "use warnings" lib/warnings/register.pm For "use warnings::register" lib/warnings.t See if warning controls work locale.c locale-specific utility functions +madly.act parser actions; derived from madly.y +madly.c parser code (NOT derived from madly.y) +madly.h header file for madly.c; derived from madly.y +madly.tab parser state tables; derived from madly.y +madly.y Yacc grammar for MAD makeaperl.SH perl script that produces a new perl binary makedef.pl Create symbol export lists for linking makedepend.SH Precursor to makedepend @@ -3025,6 +3030,7 @@ regcomp.h Private declarations for above regcomp.pl Builder of regnodes.h regcomp.sym Data for regnodes.h regen_lib.pl Common file routines for generator scripts +regen_madly.pl generate madly.{act,h,tab} from madly.y regen_perly.pl generate perly.{act,h,tab} from perly.y regen.pl Run all scripts that (re)generate files regexec.c Regular expression evaluator diff --git a/Makefile.SH b/Makefile.SH index 498440d..d794bee 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -189,6 +189,9 @@ CLDFLAGS = $ldflags mallocsrc = $mallocsrc mallocobj = $mallocobj +madlyh = $madlyh +madlysrc = $madlysrc +madlyobj = $madlyobj LNS = $lns # NOTE: some systems don't grok "cp -f". XXX Configure test needed? CPS = $cp @@ -342,17 +345,18 @@ h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h -h5 = utf8.h warnings.h +h5 = utf8.h warnings.h $(madlyh) h = $(h1) $(h2) $(h3) $(h4) $(h5) -c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c reentr.c -c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c -c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c -c4 = globals.c perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c +c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c perl.c +c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c +c3 = taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c globals.c +c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c +c5 = $(madlysrc) $(mallocsrc) -c = $(c1) $(c2) $(c3) $(c4) miniperlmain.c perlmain.c opmini.c +c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c perlmain.c opmini.c -obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) +obj1 = $(madlyobj) $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) xsutils$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) @@ -898,6 +902,13 @@ perly.c: perly.y perly.h: perly.y -@sh -c true +# Similary for madly. +madly.c: madly.y + -@sh -c true + +madly.h: madly.y + -@sh -c true + # No compat3.sym here since and including the 5.004_50. # No interp.sym since 5.005_03. SYM = global.sym globvar.sym perlio.sym pp.sym diff --git a/embed.fnc b/embed.fnc index 2c4bb51..cd67051 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1708,6 +1708,7 @@ s |void |start_force |int where s |void |curmad |char slot|NULLOK SV *sv # endif Mp |int |madlex +Mp |int |madparse #endif END_EXTERN_C diff --git a/embed.h b/embed.h index 92b175e..9b19829 100644 --- a/embed.h +++ b/embed.h @@ -1794,6 +1794,7 @@ # endif #ifdef PERL_CORE #define madlex Perl_madlex +#define madparse Perl_madparse #endif #endif #define ck_anoncode Perl_ck_anoncode @@ -3942,6 +3943,7 @@ # endif #ifdef PERL_CORE #define madlex() Perl_madlex(aTHX) +#define madparse() Perl_madparse(aTHX) #endif #endif #define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a) diff --git a/madly.act b/madly.act new file mode 100644 index 0000000..29b0e08 --- /dev/null +++ b/madly.act @@ -0,0 +1,1456 @@ +case 2: +#line 96 "madly.y" + { (yyval.ival) = (yyvsp[-1].ival); newPROG(block_end((yyvsp[-1].ival),(yyvsp[0].opval))); ;} + break; + + case 3: +#line 101 "madly.y" + { if (PL_copline > (line_t)((yyvsp[-3].tkval))->tk_lval.ival) + PL_copline = (line_t)((yyvsp[-3].tkval))->tk_lval.ival; + (yyval.opval) = block_end((yyvsp[-2].ival), (yyvsp[-1].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 4: +#line 110 "madly.y" + { (yyval.ival) = block_start(TRUE); ;} + break; + + case 5: +#line 114 "madly.y" + { + PL_expect = XSTATE; (yyval.ival) = block_start(TRUE); + ;} + break; + + case 6: +#line 121 "madly.y" + { if (PL_copline > (line_t)((yyvsp[-3].tkval))->tk_lval.ival) + PL_copline = (line_t)((yyvsp[-3].tkval))->tk_lval.ival; + (yyval.opval) = block_end((yyvsp[-2].ival), (yyvsp[-1].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 7: +#line 130 "madly.y" + { (yyval.ival) = block_start(FALSE); ;} + break; + + case 8: +#line 134 "madly.y" + { (yyval.ival) = PL_savestack_ix; ;} + break; + + case 9: +#line 138 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 10: +#line 141 "madly.y" + { (yyval.opval) = append_list(OP_LINESEQ, + (LISTOP*)(yyvsp[-1].opval), (LISTOP*)(yyvsp[0].opval)); ;} + break; + + case 11: +#line 144 "madly.y" + { LEAVE_SCOPE((yyvsp[-1].ival)); + (yyval.opval) = append_list(OP_LINESEQ, + (LISTOP*)(yyvsp[-2].opval), (LISTOP*)(yyvsp[0].opval)); + PL_pad_reset_pending = TRUE; + if ((yyvsp[-2].opval) && (yyvsp[0].opval)) PL_hints |= HINT_BLOCK_SCOPE; ;} + break; + + case 12: +#line 153 "madly.y" + { (yyval.opval) = newSTATEOP(0, ((yyvsp[-1].tkval))->tk_lval.pval, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),((LISTOP*)(yyval.opval))->op_first,'L'); ;} + break; + + case 14: +#line 157 "madly.y" + { + if (((yyvsp[-1].tkval))->tk_lval.pval) { + (yyval.opval) = newSTATEOP(0, ((yyvsp[-1].tkval))->tk_lval.pval, newOP(OP_NULL, 0)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'L'); + token_getmad((yyvsp[0].tkval),((LISTOP*)(yyval.opval))->op_first,';'); + } + else { + (yyval.opval) = newOP(OP_NULL, 0); + PL_copline = NOLINE; + token_free((yyvsp[-1].tkval)); + token_getmad((yyvsp[0].tkval),(yyval.opval),';'); + } + PL_expect = XSTATE; + ;} + break; + + case 15: +#line 172 "madly.y" + { OP* op; + (yyval.opval) = newSTATEOP(0, ((yyvsp[-2].tkval))->tk_lval.pval, (yyvsp[-1].opval)); + PL_expect = XSTATE; + /* sideff might already have a nexstate */ + op = ((LISTOP*)(yyval.opval))->op_first; + if (op) { + while (op->op_sibling && + op->op_sibling->op_type == OP_NEXTSTATE) + op = op->op_sibling; + token_getmad((yyvsp[-2].tkval),op,'L'); + token_getmad((yyvsp[0].tkval),op,';'); + } + ;} + break; + + case 16: +#line 189 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 17: +#line 191 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 18: +#line 193 "madly.y" + { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[0].opval), (yyvsp[-2].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'i'); + ;} + break; + + case 19: +#line 197 "madly.y" + { (yyval.opval) = newLOGOP(OP_OR, 0, (yyvsp[0].opval), (yyvsp[-2].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'i'); + ;} + break; + + case 20: +#line 201 "madly.y" + { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, scalar((yyvsp[0].opval)), (yyvsp[-2].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'w'); + ;} + break; + + case 21: +#line 205 "madly.y" + { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, (yyvsp[0].opval), (yyvsp[-2].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'w'); + ;} + break; + + case 22: +#line 209 "madly.y" + { (yyval.opval) = newFOROP(0, Nullch, (line_t)((yyvsp[-1].tkval))->tk_lval.ival, + Nullop, (yyvsp[0].opval), (yyvsp[-2].opval), Nullop); + token_getmad((yyvsp[-1].tkval),((LISTOP*)(yyval.opval))->op_first->op_sibling,'w'); + ;} + break; + + case 23: +#line 217 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 24: +#line 219 "madly.y" + { ((yyvsp[0].opval))->op_flags |= OPf_PARENS; (yyval.opval) = scope((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 25: +#line 223 "madly.y" + { PL_copline = (line_t)((yyvsp[-5].tkval))->tk_lval.ival; + (yyval.opval) = newCONDOP(0, (yyvsp[-3].opval), scope((yyvsp[-1].opval)), (yyvsp[0].opval)); + PL_hints |= HINT_BLOCK_SCOPE; + token_getmad((yyvsp[-5].tkval),(yyval.opval),'I'); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'('); + token_getmad((yyvsp[-2].tkval),(yyval.opval),')'); + ;} + break; + + case 26: +#line 234 "madly.y" + { PL_copline = (line_t)((yyvsp[-6].tkval))->tk_lval.ival; + (yyval.opval) = block_end((yyvsp[-4].ival), + newCONDOP(0, (yyvsp[-3].opval), scope((yyvsp[-1].opval)), (yyvsp[0].opval))); + token_getmad((yyvsp[-6].tkval),(yyval.opval),'I'); + token_getmad((yyvsp[-5].tkval),(yyval.opval),'('); + token_getmad((yyvsp[-2].tkval),(yyval.opval),')'); + ;} + break; + + case 27: +#line 242 "madly.y" + { PL_copline = (line_t)((yyvsp[-6].tkval))->tk_lval.ival; + (yyval.opval) = block_end((yyvsp[-4].ival), + newCONDOP(0, (yyvsp[-3].opval), scope((yyvsp[-1].opval)), (yyvsp[0].opval))); + token_getmad((yyvsp[-6].tkval),(yyval.opval),'I'); + token_getmad((yyvsp[-5].tkval),(yyval.opval),'('); + token_getmad((yyvsp[-2].tkval),(yyval.opval),')'); + ;} + break; + + case 28: +#line 253 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 29: +#line 255 "madly.y" + { (yyval.opval) = scope((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 30: +#line 262 "madly.y" + { OP *innerop; + PL_copline = (line_t)(yyvsp[-7].tkval); + (yyval.opval) = block_end((yyvsp[-5].ival), + newSTATEOP(0, ((yyvsp[-8].tkval))->tk_lval.pval, + innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + ((yyvsp[-7].tkval))->tk_lval.ival, (yyvsp[-4].opval), (yyvsp[-1].opval), (yyvsp[0].opval), (yyvsp[-2].ival)))); + token_getmad((yyvsp[-8].tkval),innerop,'L'); + token_getmad((yyvsp[-7].tkval),innerop,'W'); + token_getmad((yyvsp[-6].tkval),innerop,'('); + token_getmad((yyvsp[-3].tkval),innerop,')'); + ;} + break; + + case 31: +#line 274 "madly.y" + { OP *innerop; + PL_copline = (line_t)(yyvsp[-7].tkval); + (yyval.opval) = block_end((yyvsp[-5].ival), + newSTATEOP(0, ((yyvsp[-8].tkval))->tk_lval.pval, + innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + ((yyvsp[-7].tkval))->tk_lval.ival, (yyvsp[-4].opval), (yyvsp[-1].opval), (yyvsp[0].opval), (yyvsp[-2].ival)))); + token_getmad((yyvsp[-8].tkval),innerop,'L'); + token_getmad((yyvsp[-7].tkval),innerop,'W'); + token_getmad((yyvsp[-6].tkval),innerop,'('); + token_getmad((yyvsp[-3].tkval),innerop,')'); + ;} + break; + + case 32: +#line 286 "madly.y" + { OP *innerop; + (yyval.opval) = block_end((yyvsp[-6].ival), + innerop = newFOROP(0, ((yyvsp[-9].tkval))->tk_lval.pval, (line_t)((yyvsp[-8].tkval))->tk_lval.ival, (yyvsp[-5].opval), (yyvsp[-3].opval), (yyvsp[-1].opval), (yyvsp[0].opval))); + token_getmad((yyvsp[-9].tkval),((LISTOP*)innerop)->op_first,'L'); + token_getmad((yyvsp[-8].tkval),((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad((yyvsp[-7].tkval),((LISTOP*)innerop)->op_first->op_sibling,'d'); + token_getmad((yyvsp[-4].tkval),((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad((yyvsp[-2].tkval),((LISTOP*)innerop)->op_first->op_sibling,')'); + ;} + break; + + case 33: +#line 296 "madly.y" + { OP *innerop; + (yyval.opval) = block_end((yyvsp[-4].ival), + innerop = newFOROP(0, ((yyvsp[-8].tkval))->tk_lval.pval, (line_t)((yyvsp[-7].tkval))->tk_lval.ival, mod((yyvsp[-6].opval), OP_ENTERLOOP), + (yyvsp[-3].opval), (yyvsp[-1].opval), (yyvsp[0].opval))); + token_getmad((yyvsp[-8].tkval),((LISTOP*)innerop)->op_first,'L'); + token_getmad((yyvsp[-7].tkval),((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad((yyvsp[-5].tkval),((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad((yyvsp[-2].tkval),((LISTOP*)innerop)->op_first->op_sibling,')'); + ;} + break; + + case 34: +#line 306 "madly.y" + { OP *innerop; + (yyval.opval) = block_end((yyvsp[-4].ival), + innerop = newFOROP(0, ((yyvsp[-7].tkval))->tk_lval.pval, (line_t)((yyvsp[-6].tkval))->tk_lval.ival, Nullop, (yyvsp[-3].opval), (yyvsp[-1].opval), (yyvsp[0].opval))); + token_getmad((yyvsp[-7].tkval),((LISTOP*)innerop)->op_first,'L'); + token_getmad((yyvsp[-6].tkval),((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad((yyvsp[-5].tkval),((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad((yyvsp[-2].tkval),((LISTOP*)innerop)->op_first->op_sibling,')'); + ;} + break; + + case 35: +#line 316 "madly.y" + { OP *forop; + PL_copline = (line_t)((yyvsp[-10].tkval))->tk_lval.ival; + forop = newSTATEOP(0, ((yyvsp[-11].tkval))->tk_lval.pval, + newWHILEOP(0, 1, (LOOP*)Nullop, + ((yyvsp[-10].tkval))->tk_lval.ival, scalar((yyvsp[-5].opval)), + (yyvsp[0].opval), (yyvsp[-2].opval), (yyvsp[-3].ival))); + if (!(yyvsp[-7].opval)) + (yyvsp[-7].opval) = newOP(OP_NULL, 0); + forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ, + newSTATEOP(0, + (((yyvsp[-11].tkval))->tk_lval.pval + ?savepv(((yyvsp[-11].tkval))->tk_lval.pval):Nullch), + (yyvsp[-7].opval)), + forop)); + + token_getmad((yyvsp[-10].tkval),forop,'3'); + token_getmad((yyvsp[-9].tkval),forop,'('); + token_getmad((yyvsp[-6].tkval),forop,'1'); + token_getmad((yyvsp[-4].tkval),forop,'2'); + token_getmad((yyvsp[-1].tkval),forop,')'); + token_getmad((yyvsp[-11].tkval),forop,'L'); + (yyval.opval) = block_end((yyvsp[-8].ival), forop); + ;} + break; + + case 36: +#line 340 "madly.y" + { (yyval.opval) = newSTATEOP(0, ((yyvsp[-2].tkval))->tk_lval.pval, + newWHILEOP(0, 1, (LOOP*)Nullop, + NOLINE, Nullop, (yyvsp[-1].opval), (yyvsp[0].opval), 0)); + token_getmad((yyvsp[-2].tkval),((LISTOP*)(yyval.opval))->op_first,'L'); ;} + break; + + case 37: +#line 348 "madly.y" + { (yyval.ival) = (PL_min_intro_pending && + PL_max_intro_pending >= PL_min_intro_pending); + intro_my(); ;} + break; + + case 38: +#line 355 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 40: +#line 361 "madly.y" + { YYSTYPE tmplval; + (void)scan_num("1", &tmplval); + (yyval.opval) = tmplval.opval; ;} + break; + + case 42: +#line 369 "madly.y" + { (yyval.opval) = invert(scalar((yyvsp[0].opval))); ;} + break; + + case 43: +#line 374 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); intro_my(); ;} + break; + + case 44: +#line 378 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); intro_my(); ;} + break; + + case 45: +#line 382 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); intro_my(); ;} + break; + + case 46: +#line 387 "madly.y" + { YYSTYPE tmplval; + tmplval.pval = Nullch; + (yyval.tkval) = newTOKEN(OP_NULL, tmplval, 0); ;} + break; + + case 48: +#line 395 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 49: +#line 397 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 50: +#line 399 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 51: +#line 401 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 52: +#line 403 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 53: +#line 405 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 54: +#line 409 "madly.y" + { (yyval.opval) = newOP(OP_NULL,0); + token_getmad((yyvsp[0].tkval),(yyval.opval),'p'); + ;} + break; + + case 55: +#line 415 "madly.y" + { (yyval.opval) = newFORM((yyvsp[-2].ival), (yyvsp[-1].opval), (yyvsp[0].opval)); + prepend_madprops((yyvsp[-3].tkval)->tk_mad, (yyval.opval), 'F'); + (yyvsp[-3].tkval)->tk_mad = 0; + token_free((yyvsp[-3].tkval)); + ;} + break; + + case 56: +#line 422 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 57: +#line 423 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 58: +#line 428 "madly.y" + { (yyval.opval) = newMYSUB((yyvsp[-4].ival), (yyvsp[-3].opval), (yyvsp[-2].opval), (yyvsp[-1].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-5].tkval),(yyval.opval),'d'); + ;} + break; + + case 59: +#line 435 "madly.y" + { OP* o = newSVOP(OP_ANONCODE, 0, + (SV*)newATTRSUB((yyvsp[-4].ival), (yyvsp[-3].opval), (yyvsp[-2].opval), (yyvsp[-1].opval), (yyvsp[0].opval))); + (yyval.opval) = newOP(OP_NULL,0); + op_getmad(o,(yyval.opval),'&'); + op_getmad((yyvsp[-3].opval),(yyval.opval),'n'); + op_getmad((yyvsp[-2].opval),(yyval.opval),'s'); + op_getmad((yyvsp[-1].opval),(yyval.opval),'a'); + token_getmad((yyvsp[-5].tkval),(yyval.opval),'d'); + append_madprops((yyvsp[0].opval)->op_madprop, (yyval.opval), 0); + (yyvsp[0].opval)->op_madprop = 0; + ;} + break; + + case 60: +#line 449 "madly.y" + { (yyval.ival) = start_subparse(FALSE, 0); ;} + break; + + case 61: +#line 453 "madly.y" + { (yyval.ival) = start_subparse(FALSE, CVf_ANON); ;} + break; + + case 62: +#line 457 "madly.y" + { (yyval.ival) = start_subparse(TRUE, 0); ;} + break; + + case 63: +#line 461 "madly.y" + { STRLEN n_a; char *name = SvPV(((SVOP*)(yyvsp[0].opval))->op_sv,n_a); + if (strEQ(name, "BEGIN") || strEQ(name, "END") + || strEQ(name, "INIT") || strEQ(name, "CHECK")) + CvSPECIAL_on(PL_compcv); + (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 64: +#line 470 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 66: +#line 476 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 67: +#line 478 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); + token_getmad((yyvsp[-1].tkval),(yyval.opval),':'); + ;} + break; + + case 68: +#line 482 "madly.y" + { (yyval.opval) = newOP(OP_NULL, 0); + token_getmad((yyvsp[0].tkval),(yyval.opval),':'); + ;} + break; + + case 69: +#line 489 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); + token_getmad((yyvsp[-1].tkval),(yyval.opval),':'); + ;} + break; + + case 70: +#line 493 "madly.y" + { (yyval.opval) = newOP(OP_NULL, 0); + token_getmad((yyvsp[0].tkval),(yyval.opval),':'); + ;} + break; + + case 71: +#line 499 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 72: +#line 500 "madly.y" + { (yyval.opval) = newOP(OP_NULL,0); PL_expect = XSTATE; + token_getmad((yyvsp[0].tkval),(yyval.opval),';'); + ;} + break; + + case 73: +#line 506 "madly.y" + { (yyval.opval) = package((yyvsp[-1].opval)); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[0].tkval),(yyval.opval),';'); + ;} + break; + + case 74: +#line 513 "madly.y" + { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ ;} + break; + + case 75: +#line 515 "madly.y" + { (yyval.opval) = utilize(((yyvsp[-6].tkval))->tk_lval.ival, (yyvsp[-5].ival), (yyvsp[-3].opval), (yyvsp[-2].opval), (yyvsp[-1].opval)); + token_getmad((yyvsp[-6].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[0].tkval),(yyval.opval),';'); + if (PL_rsfp_filters && AvFILLp(PL_rsfp_filters) >= 0) + append_madprops(newMADPROP('!', MAD_PV, "", 0), (yyval.opval), 0); + ;} + break; + + case 76: +#line 525 "madly.y" + { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 77: +#line 529 "madly.y" + { (yyval.opval) = newLOGOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 78: +#line 533 "madly.y" + { (yyval.opval) = newLOGOP(OP_DOR, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 80: +#line 541 "madly.y" + { OP* op = newNULLLIST(); + token_getmad((yyvsp[0].tkval),op,','); + (yyval.opval) = append_elem(OP_LIST, (yyvsp[-1].opval), op); + ;} + break; + + case 81: +#line 546 "madly.y" + { + (yyvsp[0].opval) = newUNOP(OP_NULL, 0, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyvsp[0].opval),','); + (yyval.opval) = append_elem(OP_LIST, (yyvsp[-2].opval), (yyvsp[0].opval)); + ;} + break; + + case 83: +#line 556 "madly.y" + { (yyval.opval) = convert(((yyvsp[-2].tkval))->tk_lval.ival, OPf_STACKED, + prepend_elem(OP_LIST, newGVREF(((yyvsp[-2].tkval))->tk_lval.ival,(yyvsp[-1].opval)), (yyvsp[0].opval)) ); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'o'); + ;} + break; + + case 84: +#line 561 "madly.y" + { (yyval.opval) = convert(((yyvsp[-4].tkval))->tk_lval.ival, OPf_STACKED, + prepend_elem(OP_LIST, newGVREF(((yyvsp[-4].tkval))->tk_lval.ival,(yyvsp[-2].opval)), (yyvsp[-1].opval)) ); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 85: +#line 568 "madly.y" + { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, scalar((yyvsp[-5].opval)), (yyvsp[-1].opval)), + newUNOP(OP_METHOD, 0, (yyvsp[-3].opval)))); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'A'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 86: +#line 577 "madly.y" + { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, scalar((yyvsp[-2].opval)), + newUNOP(OP_METHOD, 0, (yyvsp[0].opval)))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'A'); + ;} + break; + + case 87: +#line 583 "madly.y" + { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, (yyvsp[-1].opval), (yyvsp[0].opval)), + newUNOP(OP_METHOD, 0, (yyvsp[-2].opval)))); + ;} + break; + + case 88: +#line 589 "madly.y" + { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, (yyvsp[-3].opval), (yyvsp[-1].opval)), + newUNOP(OP_METHOD, 0, (yyvsp[-4].opval)))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 89: +#line 597 "madly.y" + { (yyval.opval) = convert(((yyvsp[-1].tkval))->tk_lval.ival, 0, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 90: +#line 601 "madly.y" + { (yyval.opval) = convert(((yyvsp[-3].tkval))->tk_lval.ival, 0, (yyvsp[-1].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 91: +#line 607 "madly.y" + { (yyvsp[0].opval) = newANONATTRSUB((yyvsp[-1].ival), 0, Nullop, (yyvsp[0].opval)); ;} + break; + + case 92: +#line 609 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, (yyvsp[-2].opval), (yyvsp[0].opval)), (yyvsp[-4].opval))); + ;} + break; + + case 95: +#line 624 "madly.y" + { (yyval.opval) = newBINOP(OP_GELEM, 0, (yyvsp[-4].opval), scalar((yyvsp[-2].opval))); + PL_expect = XOPERATOR; + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 96: +#line 631 "madly.y" + { (yyval.opval) = newBINOP(OP_AELEM, 0, oopsAV((yyvsp[-3].opval)), scalar((yyvsp[-1].opval))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 97: +#line 636 "madly.y" + { (yyval.opval) = newBINOP(OP_AELEM, 0, + ref(newAVREF((yyvsp[-4].opval)),OP_RV2AV), + scalar((yyvsp[-1].opval))); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'a'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 98: +#line 644 "madly.y" + { (yyval.opval) = newBINOP(OP_AELEM, 0, + ref(newAVREF((yyvsp[-3].opval)),OP_RV2AV), + scalar((yyvsp[-1].opval))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 99: +#line 651 "madly.y" + { (yyval.opval) = newBINOP(OP_HELEM, 0, oopsHV((yyvsp[-4].opval)), jmaybe((yyvsp[-2].opval))); + PL_expect = XOPERATOR; + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 100: +#line 658 "madly.y" + { (yyval.opval) = newBINOP(OP_HELEM, 0, + ref(newHVREF((yyvsp[-5].opval)),OP_RV2HV), + jmaybe((yyvsp[-2].opval))); + PL_expect = XOPERATOR; + token_getmad((yyvsp[-4].tkval),(yyval.opval),'a'); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 101: +#line 668 "madly.y" + { (yyval.opval) = newBINOP(OP_HELEM, 0, + ref(newHVREF((yyvsp[-4].opval)),OP_RV2HV), + jmaybe((yyvsp[-2].opval))); + PL_expect = XOPERATOR; + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 102: +#line 677 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + newCVREF(0, scalar((yyvsp[-3].opval)))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'a'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 103: +#line 684 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, (yyvsp[-1].opval), + newCVREF(0, scalar((yyvsp[-4].opval))))); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'a'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 104: +#line 693 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, (yyvsp[-1].opval), + newCVREF(0, scalar((yyvsp[-3].opval))))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 105: +#line 700 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + newCVREF(0, scalar((yyvsp[-2].opval)))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 106: +#line 709 "madly.y" + { (yyval.opval) = newASSIGNOP(OPf_STACKED, (yyvsp[-2].opval), ((yyvsp[-1].tkval))->tk_lval.ival, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 107: +#line 713 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 108: +#line 717 "madly.y" + { if (((yyvsp[-1].tkval))->tk_lval.ival != OP_REPEAT) + scalar((yyvsp[-2].opval)); + (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, (yyvsp[-2].opval), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 109: +#line 723 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 110: +#line 727 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 111: +#line 731 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 112: +#line 735 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 113: +#line 739 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 114: +#line 743 "madly.y" + { (yyval.opval) = newBINOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 115: +#line 747 "madly.y" + { UNOP *op; + (yyval.opval) = newRANGE(((yyvsp[-1].tkval))->tk_lval.ival, scalar((yyvsp[-2].opval)), scalar((yyvsp[0].opval))); + op = (UNOP*)(yyval.opval); + op = (UNOP*)op->op_first; /* get to flop */ + op = (UNOP*)op->op_first; /* get to flip */ + op = (UNOP*)op->op_first; /* get to range */ + token_getmad((yyvsp[-1].tkval),(OP*)op,'o'); + ;} + break; + + case 116: +#line 756 "madly.y" + { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 117: +#line 760 "madly.y" + { (yyval.opval) = newLOGOP(OP_OR, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 118: +#line 764 "madly.y" + { (yyval.opval) = newLOGOP(OP_DOR, 0, (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 119: +#line 768 "madly.y" + { (yyval.opval) = bind_match(((yyvsp[-1].tkval))->tk_lval.ival, (yyvsp[-2].opval), (yyvsp[0].opval)); + if ((yyval.opval)->op_type == OP_NOT) + token_getmad((yyvsp[-1].tkval),((UNOP*)(yyval.opval))->op_first,'~'); + else + token_getmad((yyvsp[-1].tkval),(yyval.opval),'~'); + ;} + break; + + case 120: +#line 778 "madly.y" + { (yyval.opval) = newUNOP(OP_NEGATE, 0, scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 121: +#line 782 "madly.y" + { (yyval.opval) = newUNOP(OP_NULL, 0, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'+'); + ;} + break; + + case 122: +#line 786 "madly.y" + { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 123: +#line 790 "madly.y" + { (yyval.opval) = newUNOP(OP_COMPLEMENT, 0, scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 124: +#line 794 "madly.y" + { (yyval.opval) = newUNOP(OP_POSTINC, 0, + mod(scalar((yyvsp[-1].opval)), OP_POSTINC)); + token_getmad((yyvsp[0].tkval),(yyval.opval),'o'); + ;} + break; + + case 125: +#line 799 "madly.y" + { (yyval.opval) = newUNOP(OP_POSTDEC, 0, + mod(scalar((yyvsp[-1].opval)), OP_POSTDEC)); + token_getmad((yyvsp[0].tkval),(yyval.opval),'o'); + ;} + break; + + case 126: +#line 804 "madly.y" + { (yyval.opval) = newUNOP(OP_PREINC, 0, + mod(scalar((yyvsp[0].opval)), OP_PREINC)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 127: +#line 809 "madly.y" + { (yyval.opval) = newUNOP(OP_PREDEC, 0, + mod(scalar((yyvsp[0].opval)), OP_PREDEC)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 128: +#line 818 "madly.y" + { (yyval.opval) = newANONLIST((yyvsp[-1].opval)); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 129: +#line 823 "madly.y" + { (yyval.opval) = newANONLIST(Nullop); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 130: +#line 828 "madly.y" + { (yyval.opval) = newANONHASH((yyvsp[-2].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 131: +#line 834 "madly.y" + { (yyval.opval) = newANONHASH(Nullop); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 132: +#line 840 "madly.y" + { (yyval.opval) = newANONATTRSUB((yyvsp[-3].ival), (yyvsp[-2].opval), (yyvsp[-1].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'o'); + op_getmad((yyvsp[-2].opval),(yyval.opval),'s'); + op_getmad((yyvsp[-1].opval),(yyval.opval),'a'); + ;} + break; + + case 133: +#line 850 "madly.y" + { (yyval.opval) = dofile((yyvsp[0].opval), (yyvsp[-1].tkval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 134: +#line 854 "madly.y" + { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'D'); + ;} + break; + + case 135: +#line 858 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, + OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + scalar(newCVREF( + (OPpENTERSUB_AMPER<<8), + scalar((yyvsp[-2].opval)) + )),Nullop)); dep(); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 136: +#line 870 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, + OPf_SPECIAL|OPf_STACKED, + append_elem(OP_LIST, + (yyvsp[-1].opval), + scalar(newCVREF( + (OPpENTERSUB_AMPER<<8), + scalar((yyvsp[-3].opval)) + )))); dep(); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 137: +#line 883 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + scalar(newCVREF(0,scalar((yyvsp[-2].opval)))), Nullop)); dep(); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 138: +#line 891 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + (yyvsp[-1].opval), + scalar(newCVREF(0,scalar((yyvsp[-3].opval)))))); dep(); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 143: +#line 907 "madly.y" + { (yyval.opval) = newCONDOP(0, (yyvsp[-4].opval), (yyvsp[-2].opval), (yyvsp[0].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'?'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),':'); + ;} + break; + + case 144: +#line 912 "madly.y" + { (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((yyvsp[0].opval),OP_REFGEN)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 145: +#line 916 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 146: +#line 918 "madly.y" + { (yyval.opval) = localize((yyvsp[0].opval),((yyvsp[-1].tkval))->tk_lval.ival); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'d'); + ;} + break; + + case 147: +#line 922 "madly.y" + { (yyval.opval) = sawparens(newUNOP(OP_NULL,0,(yyvsp[-1].opval))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 148: +#line 927 "madly.y" + { (yyval.opval) = sawparens(newNULLLIST()); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 149: +#line 932 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 150: +#line 934 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 151: +#line 936 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 152: +#line 938 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 153: +#line 940 "madly.y" + { (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((yyvsp[0].opval), OP_AV2ARYLEN));;} + break; + + case 154: +#line 942 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 155: +#line 944 "madly.y" + { (yyval.opval) = newSLICEOP(0, (yyvsp[-1].opval), (yyvsp[-4].opval)); + token_getmad((yyvsp[-5].tkval),(yyval.opval),'('); + token_getmad((yyvsp[-3].tkval),(yyval.opval),')'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 156: +#line 951 "madly.y" + { (yyval.opval) = newSLICEOP(0, (yyvsp[-1].opval), Nullop); + token_getmad((yyvsp[-4].tkval),(yyval.opval),'('); + token_getmad((yyvsp[-3].tkval),(yyval.opval),')'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 157: +#line 958 "madly.y" + { (yyval.opval) = prepend_elem(OP_ASLICE, + newOP(OP_PUSHMARK, 0), + newLISTOP(OP_ASLICE, 0, + list((yyvsp[-1].opval)), + ref((yyvsp[-3].opval), OP_ASLICE))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'['); + token_getmad((yyvsp[0].tkval),(yyval.opval),']'); + ;} + break; + + case 158: +#line 967 "madly.y" + { (yyval.opval) = prepend_elem(OP_HSLICE, + newOP(OP_PUSHMARK, 0), + newLISTOP(OP_HSLICE, 0, + list((yyvsp[-2].opval)), + ref(oopsHV((yyvsp[-4].opval)), OP_HSLICE))); + PL_expect = XOPERATOR; + token_getmad((yyvsp[-3].tkval),(yyval.opval),'{'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),';'); + token_getmad((yyvsp[0].tkval),(yyval.opval),'}'); + ;} + break; + + case 159: +#line 978 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 160: +#line 980 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((yyvsp[0].opval))); ;} + break; + + case 161: +#line 982 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((yyvsp[-2].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 162: +#line 987 "madly.y" + { OP* op; + (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, (yyvsp[-1].opval), scalar((yyvsp[-3].opval)))); + op = (yyval.opval); + if (op->op_type == OP_CONST) { /* defeat const fold */ + op = (OP*)op->op_madprop->mad_val; + } + token_getmad((yyvsp[-2].tkval),op,'('); + token_getmad((yyvsp[0].tkval),op,')'); + ;} + break; + + case 163: +#line 998 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, (yyvsp[0].opval), scalar((yyvsp[-1].opval)))); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'o'); + ;} + break; + + case 164: +#line 1003 "madly.y" + { (yyval.opval) = newOP(((yyvsp[0].tkval))->tk_lval.ival, OPf_SPECIAL); + PL_hints |= HINT_BLOCK_SCOPE; + token_getmad((yyvsp[0].tkval),(yyval.opval),'o'); + ;} + break; + + case 165: +#line 1008 "madly.y" + { (yyval.opval) = newLOOPEX(((yyvsp[-1].tkval))->tk_lval.ival,(yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 166: +#line 1012 "madly.y" + { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((yyvsp[0].opval))); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 167: +#line 1016 "madly.y" + { (yyval.opval) = newOP(((yyvsp[0].tkval))->tk_lval.ival, 0); + token_getmad((yyvsp[0].tkval),(yyval.opval),'o'); + ;} + break; + + case 168: +#line 1020 "madly.y" + { (yyval.opval) = newUNOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 169: +#line 1024 "madly.y" + { (yyval.opval) = newUNOP(((yyvsp[-1].tkval))->tk_lval.ival, 0, (yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'o'); + ;} + break; + + case 170: +#line 1028 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, (yyvsp[0].opval), scalar((yyvsp[-1].opval)))); + ;} + break; + + case 171: +#line 1032 "madly.y" + { (yyval.opval) = newOP(((yyvsp[0].tkval))->tk_lval.ival, 0); + token_getmad((yyvsp[0].tkval),(yyval.opval),'o'); + ;} + break; + + case 172: +#line 1036 "madly.y" + { (yyval.opval) = newOP(((yyvsp[-2].tkval))->tk_lval.ival, 0); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 173: +#line 1042 "madly.y" + { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, + scalar((yyvsp[0].opval))); ;} + break; + + case 174: +#line 1045 "madly.y" + { (yyval.opval) = newOP(((yyvsp[-2].tkval))->tk_lval.ival, OPf_SPECIAL); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 175: +#line 1051 "madly.y" + { (yyval.opval) = newUNOP(((yyvsp[-3].tkval))->tk_lval.ival, 0, (yyvsp[-1].opval)); + token_getmad((yyvsp[-3].tkval),(yyval.opval),'o'); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 176: +#line 1057 "madly.y" + { (yyval.opval) = pmruntime((yyvsp[-3].opval), (yyvsp[-1].opval), 1); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 179: +#line 1067 "madly.y" + { (yyval.opval) = my_attrs((yyvsp[-1].opval),(yyvsp[0].opval)); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'d'); + append_madprops((yyvsp[0].opval)->op_madprop, (yyval.opval), 'a'); + (yyvsp[0].opval)->op_madprop = 0; + ;} + break; + + case 180: +#line 1073 "madly.y" + { (yyval.opval) = localize((yyvsp[0].opval),((yyvsp[-1].tkval))->tk_lval.ival); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'d'); + ;} + break; + + case 181: +#line 1080 "madly.y" + { (yyval.opval) = sawparens((yyvsp[-1].opval)); + token_getmad((yyvsp[-2].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 182: +#line 1085 "madly.y" + { (yyval.opval) = sawparens(newNULLLIST()); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'('); + token_getmad((yyvsp[0].tkval),(yyval.opval),')'); + ;} + break; + + case 183: +#line 1090 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 184: +#line 1092 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 185: +#line 1094 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 186: +#line 1099 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 187: +#line 1101 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 188: +#line 1105 "madly.y" + { (yyval.opval) = Nullop; ;} + break; + + case 189: +#line 1107 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + case 190: +#line 1109 "madly.y" + { OP* op = newNULLLIST(); + token_getmad((yyvsp[0].tkval),op,','); + (yyval.opval) = append_elem(OP_LIST, (yyvsp[-1].opval), op); + ;} + break; + + case 191: +#line 1118 "madly.y" + { PL_in_my = 0; (yyval.opval) = my((yyvsp[0].opval)); ;} + break; + + case 192: +#line 1122 "madly.y" + { (yyval.opval) = newCVREF(((yyvsp[-1].tkval))->tk_lval.ival,(yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'&'); + ;} + break; + + case 193: +#line 1128 "madly.y" + { (yyval.opval) = newSVREF((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'$'); + ;} + break; + + case 194: +#line 1134 "madly.y" + { (yyval.opval) = newAVREF((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'@'); + ;} + break; + + case 195: +#line 1140 "madly.y" + { (yyval.opval) = newHVREF((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'%'); + ;} + break; + + case 196: +#line 1146 "madly.y" + { (yyval.opval) = newAVREF((yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'l'); + ;} + break; + + case 197: +#line 1152 "madly.y" + { (yyval.opval) = newGVREF(0,(yyvsp[0].opval)); + token_getmad((yyvsp[-1].tkval),(yyval.opval),'*'); + ;} + break; + + case 198: +#line 1159 "madly.y" + { (yyval.opval) = scalar((yyvsp[0].opval)); ;} + break; + + case 199: +#line 1161 "madly.y" + { (yyval.opval) = scalar((yyvsp[0].opval)); ;} + break; + + case 200: +#line 1163 "madly.y" + { (yyval.opval) = scope((yyvsp[0].opval)); ;} + break; + + case 201: +#line 1166 "madly.y" + { (yyval.opval) = (yyvsp[0].opval); ;} + break; + + + default: break; + diff --git a/madly.h b/madly.h new file mode 100644 index 0000000..72299ea --- /dev/null +++ b/madly.h @@ -0,0 +1,188 @@ +#ifdef PERL_CORE +/* A Bison parser, made by GNU Bison 2.1. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + WORD = 258, + METHOD = 259, + FUNCMETH = 260, + THING = 261, + PMFUNC = 262, + PRIVATEREF = 263, + FUNC0SUB = 264, + UNIOPSUB = 265, + LSTOPSUB = 266, + LABEL = 267, + FORMAT = 268, + SUB = 269, + ANONSUB = 270, + PACKAGE = 271, + USE = 272, + WHILE = 273, + UNTIL = 274, + IF = 275, + UNLESS = 276, + ELSE = 277, + ELSIF = 278, + CONTINUE = 279, + FOR = 280, + LOOPEX = 281, + DOTDOT = 282, + FUNC0 = 283, + FUNC1 = 284, + FUNC = 285, + UNIOP = 286, + LSTOP = 287, + RELOP = 288, + EQOP = 289, + MULOP = 290, + ADDOP = 291, + DOLSHARP = 292, + DO = 293, + HASHBRACK = 294, + NOAMP = 295, + LOCAL = 296, + MY = 297, + MYSUB = 298, + COLONATTR = 299, + PREC_LOW = 300, + DOROP = 301, + OROP = 302, + ANDOP = 303, + NOTOP = 304, + ASSIGNOP = 305, + DORDOR = 306, + OROR = 307, + ANDAND = 308, + BITOROP = 309, + BITANDOP = 310, + SHIFTOP = 311, + MATCHOP = 312, + REFGEN = 313, + UMINUS = 314, + POWOP = 315, + POSTDEC = 316, + POSTINC = 317, + PREDEC = 318, + PREINC = 319, + ARROW = 320, + PEG = 321 + }; +#endif +/* Tokens. */ +#define WORD 258 +#define METHOD 259 +#define FUNCMETH 260 +#define THING 261 +#define PMFUNC 262 +#define PRIVATEREF 263 +#define FUNC0SUB 264 +#define UNIOPSUB 265 +#define LSTOPSUB 266 +#define LABEL 267 +#define FORMAT 268 +#define SUB 269 +#define ANONSUB 270 +#define PACKAGE 271 +#define USE 272 +#define WHILE 273 +#define UNTIL 274 +#define IF 275 +#define UNLESS 276 +#define ELSE 277 +#define ELSIF 278 +#define CONTINUE 279 +#define FOR 280 +#define LOOPEX 281 +#define DOTDOT 282 +#define FUNC0 283 +#define FUNC1 284 +#define FUNC 285 +#define UNIOP 286 +#define LSTOP 287 +#define RELOP 288 +#define EQOP 289 +#define MULOP 290 +#define ADDOP 291 +#define DOLSHARP 292 +#define DO 293 +#define HASHBRACK 294 +#define NOAMP 295 +#define LOCAL 296 +#define MY 297 +#define MYSUB 298 +#define COLONATTR 299 +#define PREC_LOW 300 +#define DOROP 301 +#define OROP 302 +#define ANDOP 303 +#define NOTOP 304 +#define ASSIGNOP 305 +#define DORDOR 306 +#define OROR 307 +#define ANDAND 308 +#define BITOROP 309 +#define BITANDOP 310 +#define SHIFTOP 311 +#define MATCHOP 312 +#define REFGEN 313 +#define UMINUS 314 +#define POWOP 315 +#define POSTDEC 316 +#define POSTINC 317 +#define PREDEC 318 +#define PREINC 319 +#define ARROW 320 +#define PEG 321 + + + + +#endif /* PERL_CORE */ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 21 "madly.y" +typedef union YYSTYPE { + I32 ival; + char *pval; + TOKEN* tkval; + OP *opval; + GV *gvval; +} YYSTYPE; +/* Line 1447 of yacc.c. */ +#line 178 "madly.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + + + diff --git a/madly.tab b/madly.tab new file mode 100644 index 0000000..b9b5944 --- /dev/null +++ b/madly.tab @@ -0,0 +1,851 @@ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1925 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 86 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 63 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 201 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 401 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 321 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 73, 2, 2, 9, 11, 55, 2, + 84, 83, 12, 8, 62, 7, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 65, 56, + 2, 2, 2, 64, 10, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 5, 2, 6, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 2, 4, 74, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 57, 58, 59, 60, 61, 63, 66, 67, 68, 69, + 70, 71, 72, 75, 76, 77, 78, 79, 80, 81, + 82, 85 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short int yyprhs[] = +{ + 0, 0, 3, 6, 11, 12, 13, 18, 19, 20, + 21, 24, 28, 31, 33, 36, 40, 42, 44, 48, + 52, 56, 60, 64, 65, 68, 75, 83, 91, 92, + 95, 105, 115, 126, 136, 145, 158, 162, 163, 164, + 166, 167, 169, 171, 173, 175, 177, 178, 180, 182, + 184, 186, 188, 190, 192, 194, 199, 201, 202, 209, + 216, 217, 218, 219, 221, 222, 224, 225, 228, 230, + 233, 235, 237, 239, 243, 244, 252, 256, 260, 264, + 266, 269, 273, 275, 279, 285, 292, 296, 300, 306, + 309, 314, 315, 321, 323, 325, 331, 336, 342, 347, + 353, 360, 366, 371, 377, 382, 386, 390, 394, 398, + 402, 406, 410, 414, 418, 422, 426, 430, 434, 438, + 442, 445, 448, 451, 454, 457, 460, 463, 466, 470, + 473, 478, 482, 488, 491, 494, 499, 505, 510, 516, + 518, 520, 522, 524, 530, 533, 535, 538, 542, 545, + 547, 549, 551, 553, 555, 557, 564, 570, 575, 581, + 583, 585, 589, 594, 598, 600, 603, 606, 608, 611, + 614, 617, 619, 623, 625, 629, 634, 639, 641, 643, + 647, 650, 654, 657, 659, 661, 663, 664, 666, 667, + 669, 672, 674, 677, 680, 683, 686, 689, 692, 694, + 696, 698 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = +{ + 87, 0, -1, 90, 94, -1, 3, 89, 94, 4, + -1, -1, -1, 3, 92, 94, 4, -1, -1, -1, + -1, 94, 109, -1, 94, 93, 95, -1, 108, 98, + -1, 100, -1, 108, 56, -1, 108, 96, 56, -1, + 1, -1, 126, -1, 126, 30, 126, -1, 126, 31, + 126, -1, 126, 28, 126, -1, 126, 29, 104, -1, + 126, 35, 126, -1, -1, 32, 91, -1, 33, 84, + 105, 83, 91, 97, -1, 30, 84, 89, 105, 83, + 91, 97, -1, 31, 84, 89, 107, 83, 91, 97, + -1, -1, 34, 88, -1, 108, 28, 84, 89, 103, + 83, 101, 91, 99, -1, 108, 29, 84, 89, 104, + 83, 101, 91, 99, -1, 108, 35, 52, 89, 141, + 84, 105, 83, 91, 99, -1, 108, 35, 143, 84, + 89, 105, 83, 91, 99, -1, 108, 35, 84, 89, + 105, 83, 91, 99, -1, 108, 35, 84, 89, 106, + 56, 103, 56, 101, 106, 83, 91, -1, 108, 88, + 99, -1, -1, -1, 96, -1, -1, 126, -1, 126, + -1, 126, -1, 102, -1, 104, -1, -1, 22, -1, + 111, -1, 114, -1, 113, -1, 123, -1, 124, -1, + 110, -1, 85, -1, 23, 117, 112, 88, -1, 13, + -1, -1, 53, 115, 118, 119, 120, 122, -1, 24, + 115, 118, 119, 120, 122, -1, -1, -1, -1, 13, + -1, -1, 16, -1, -1, 54, 16, -1, 54, -1, + 54, 16, -1, 54, -1, 88, -1, 56, -1, 26, + 13, 56, -1, -1, 27, 115, 125, 13, 13, 139, + 56, -1, 126, 60, 126, -1, 126, 59, 126, -1, + 126, 58, 126, -1, 127, -1, 127, 62, -1, 127, + 62, 136, -1, 136, -1, 42, 148, 127, -1, 40, + 84, 148, 126, 83, -1, 136, 82, 130, 84, 140, + 83, -1, 136, 82, 130, -1, 14, 148, 139, -1, + 15, 148, 84, 140, 83, -1, 42, 139, -1, 40, + 84, 140, 83, -1, -1, 21, 116, 88, 129, 139, + -1, 14, -1, 143, -1, 147, 3, 126, 56, 4, + -1, 143, 5, 126, 6, -1, 136, 82, 5, 126, + 6, -1, 131, 5, 126, 6, -1, 143, 3, 126, + 56, 4, -1, 136, 82, 3, 126, 56, 4, -1, + 131, 3, 126, 56, 4, -1, 136, 82, 84, 83, + -1, 136, 82, 84, 126, 83, -1, 131, 84, 126, + 83, -1, 131, 84, 83, -1, 136, 63, 136, -1, + 136, 77, 136, -1, 136, 45, 136, -1, 136, 46, + 136, -1, 136, 71, 136, -1, 136, 43, 136, -1, + 136, 44, 136, -1, 136, 70, 136, -1, 136, 69, + 136, -1, 136, 37, 136, -1, 136, 68, 136, -1, + 136, 67, 136, -1, 136, 66, 136, -1, 136, 72, + 136, -1, 7, 136, -1, 8, 136, -1, 73, 136, + -1, 74, 136, -1, 136, 79, -1, 136, 78, -1, + 81, 136, -1, 80, 136, -1, 5, 126, 6, -1, + 5, 6, -1, 49, 126, 56, 4, -1, 49, 56, + 4, -1, 25, 116, 119, 120, 88, -1, 48, 136, + -1, 48, 88, -1, 48, 13, 84, 83, -1, 48, + 13, 84, 126, 83, -1, 48, 143, 84, 83, -1, + 48, 143, 84, 126, 83, -1, 132, -1, 133, -1, + 134, -1, 135, -1, 136, 64, 136, 65, 136, -1, + 75, 136, -1, 137, -1, 51, 136, -1, 84, 126, + 83, -1, 84, 83, -1, 143, -1, 147, -1, 145, + -1, 144, -1, 146, -1, 131, -1, 84, 126, 83, + 5, 126, 6, -1, 84, 83, 5, 126, 6, -1, + 144, 5, 126, 6, -1, 144, 3, 126, 56, 4, + -1, 16, -1, 142, -1, 142, 84, 83, -1, 142, + 84, 126, 83, -1, 50, 13, 139, -1, 36, -1, + 36, 136, -1, 61, 127, -1, 41, -1, 41, 88, + -1, 41, 136, -1, 20, 136, -1, 38, -1, 38, + 84, 83, -1, 19, -1, 39, 84, 83, -1, 39, + 84, 126, 83, -1, 17, 84, 127, 83, -1, 13, + -1, 128, -1, 52, 138, 121, -1, 52, 138, -1, + 84, 126, 83, -1, 84, 83, -1, 143, -1, 145, + -1, 144, -1, -1, 127, -1, -1, 126, -1, 126, + 62, -1, 143, -1, 55, 148, -1, 9, 148, -1, + 10, 148, -1, 11, 148, -1, 47, 148, -1, 12, + 148, -1, 13, -1, 143, -1, 88, -1, 18, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 94, 94, 100, 110, 114, 120, 130, 134, 138, + 139, 143, 152, 155, 156, 171, 188, 190, 192, 196, + 200, 204, 208, 217, 218, 222, 233, 241, 253, 254, + 261, 273, 285, 295, 305, 314, 339, 348, 355, 356, + 361, 364, 368, 373, 377, 381, 387, 390, 394, 396, + 398, 400, 402, 404, 408, 414, 422, 423, 427, 434, + 449, 453, 457, 461, 470, 471, 476, 477, 481, 488, + 492, 499, 500, 505, 513, 512, 524, 528, 532, 536, + 540, 545, 551, 555, 560, 567, 576, 582, 588, 596, + 600, 607, 606, 616, 617, 621, 630, 635, 643, 650, + 657, 667, 676, 683, 692, 699, 708, 712, 716, 722, + 726, 730, 734, 738, 742, 746, 755, 759, 763, 767, + 777, 781, 785, 789, 793, 798, 803, 808, 817, 822, + 827, 833, 839, 849, 853, 857, 869, 882, 890, 902, + 903, 904, 905, 906, 911, 915, 917, 921, 926, 931, + 933, 935, 937, 939, 941, 943, 950, 957, 966, 977, + 979, 981, 986, 997, 1002, 1007, 1011, 1015, 1019, 1023, + 1027, 1031, 1035, 1041, 1044, 1050, 1056, 1061, 1062, 1066, + 1072, 1079, 1084, 1089, 1091, 1093, 1098, 1100, 1105, 1106, + 1108, 1117, 1121, 1127, 1133, 1139, 1145, 1151, 1158, 1160, + 1162, 1165 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "'{'", "'}'", "'['", "']'", "'-'", "'+'", + "'$'", "'@'", "'%'", "'*'", "WORD", "METHOD", "FUNCMETH", "THING", + "PMFUNC", "PRIVATEREF", "FUNC0SUB", "UNIOPSUB", "LSTOPSUB", "LABEL", + "FORMAT", "SUB", "ANONSUB", "PACKAGE", "USE", "WHILE", "UNTIL", "IF", + "UNLESS", "ELSE", "ELSIF", "CONTINUE", "FOR", "LOOPEX", "DOTDOT", + "FUNC0", "FUNC1", "FUNC", "UNIOP", "LSTOP", "RELOP", "EQOP", "MULOP", + "ADDOP", "DOLSHARP", "DO", "HASHBRACK", "NOAMP", "LOCAL", "MY", "MYSUB", + "COLONATTR", "'&'", "';'", "PREC_LOW", "DOROP", "OROP", "ANDOP", "NOTOP", + "','", "ASSIGNOP", "'?'", "':'", "DORDOR", "OROR", "ANDAND", "BITOROP", + "BITANDOP", "SHIFTOP", "MATCHOP", "'!'", "'~'", "REFGEN", "UMINUS", + "POWOP", "POSTDEC", "POSTINC", "PREDEC", "PREINC", "ARROW", "')'", "'('", + "PEG", "$accept", "prog", "block", "remember", "progstart", "mblock", + "mremember", "savescope", "lineseq", "line", "sideff", "else", "cond", + "cont", "loop", "mintro", "nexpr", "texpr", "iexpr", "mexpr", "mnexpr", + "miexpr", "label", "decl", "peg", "format", "formname", "mysubrout", + "subrout", "startsub", "startanonsub", "startformsub", "subname", + "proto", "subattrlist", "myattrlist", "subbody", "package", "use", "@1", + "expr", "argexpr", "listop", "@2", "method", "subscripted", "termbinop", + "termunop", "anonymous", "termdo", "term", "myattrterm", "myterm", + "listexpr", "listexprcom", "my_scalar", "amper", "scalar", "ary", "hsh", + "arylen", "star", "indirob", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 123, 125, 91, 93, 45, 43, 36, + 64, 37, 42, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 38, 59, 300, 301, 302, + 303, 304, 44, 305, 63, 58, 306, 307, 308, 309, + 310, 311, 312, 33, 126, 313, 314, 315, 316, 317, + 318, 319, 320, 41, 40, 321 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 94, 94, 95, 95, 95, 95, 96, 96, 96, 96, + 96, 96, 96, 97, 97, 97, 98, 98, 99, 99, + 100, 100, 100, 100, 100, 100, 100, 101, 102, 102, + 103, 103, 104, 105, 106, 107, 108, 108, 109, 109, + 109, 109, 109, 109, 110, 111, 112, 112, 113, 114, + 115, 116, 117, 118, 119, 119, 120, 120, 120, 121, + 121, 122, 122, 123, 125, 124, 126, 126, 126, 126, + 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, + 128, 129, 128, 130, 130, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, + 134, 134, 134, 135, 135, 135, 135, 135, 135, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, + 137, 138, 138, 138, 138, 138, 139, 139, 140, 140, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, + 148, 148 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 4, 0, 0, 4, 0, 0, 0, + 2, 3, 2, 1, 2, 3, 1, 1, 3, 3, + 3, 3, 3, 0, 2, 6, 7, 7, 0, 2, + 9, 9, 10, 9, 8, 12, 3, 0, 0, 1, + 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 1, 0, 6, 6, + 0, 0, 0, 1, 0, 1, 0, 2, 1, 2, + 1, 1, 1, 3, 0, 7, 3, 3, 3, 1, + 2, 3, 1, 3, 5, 6, 3, 3, 5, 2, + 4, 0, 5, 1, 1, 5, 4, 5, 4, 5, + 6, 5, 4, 5, 4, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, + 4, 3, 5, 2, 2, 4, 5, 4, 5, 1, + 1, 1, 1, 5, 2, 1, 2, 3, 2, 1, + 1, 1, 1, 1, 1, 6, 5, 4, 5, 1, + 1, 3, 4, 3, 1, 2, 2, 1, 2, 2, + 2, 1, 3, 1, 3, 4, 4, 1, 1, 3, + 2, 3, 2, 1, 1, 1, 0, 1, 0, 1, + 2, 1, 2, 2, 2, 2, 2, 2, 1, 1, + 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 5, 0, 9, 1, 8, 62, 60, 0, 60, 60, + 54, 46, 10, 53, 48, 50, 49, 51, 52, 57, + 0, 0, 74, 0, 47, 11, 13, 0, 56, 0, + 63, 64, 73, 0, 64, 16, 4, 0, 0, 0, + 0, 0, 0, 0, 177, 0, 0, 159, 0, 173, + 0, 61, 61, 0, 0, 0, 0, 0, 164, 171, + 0, 0, 167, 186, 0, 0, 0, 0, 0, 0, + 0, 14, 0, 0, 0, 0, 0, 0, 0, 28, + 0, 12, 17, 79, 178, 154, 139, 140, 141, 142, + 82, 145, 160, 149, 152, 151, 153, 150, 55, 65, + 66, 0, 66, 9, 129, 0, 120, 121, 198, 201, + 200, 199, 193, 194, 195, 197, 186, 0, 0, 170, + 0, 64, 4, 4, 4, 4, 4, 4, 0, 165, + 0, 0, 188, 168, 169, 198, 187, 89, 199, 0, + 196, 177, 134, 133, 149, 0, 0, 186, 146, 0, + 180, 183, 185, 184, 192, 166, 122, 123, 144, 127, + 126, 148, 0, 0, 36, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 125, 124, 0, 0, 0, 0, 0, + 0, 0, 68, 0, 186, 0, 8, 128, 87, 188, + 0, 91, 66, 40, 0, 0, 0, 0, 0, 4, + 172, 174, 0, 189, 0, 0, 83, 0, 0, 131, + 0, 163, 182, 0, 70, 179, 0, 147, 29, 20, + 21, 42, 18, 19, 22, 78, 77, 76, 81, 0, + 0, 105, 0, 115, 111, 112, 108, 109, 106, 0, + 118, 117, 116, 114, 113, 110, 119, 107, 0, 0, + 93, 0, 86, 94, 161, 0, 0, 0, 0, 0, + 0, 67, 72, 71, 59, 0, 58, 3, 0, 176, + 186, 0, 0, 41, 0, 0, 43, 45, 0, 0, + 191, 39, 44, 0, 0, 17, 0, 175, 190, 90, + 0, 135, 0, 137, 0, 130, 181, 69, 0, 0, + 0, 98, 104, 0, 0, 0, 102, 0, 188, 162, + 0, 96, 0, 157, 0, 75, 88, 92, 132, 37, + 37, 0, 0, 0, 0, 40, 0, 84, 136, 138, + 156, 0, 101, 143, 0, 97, 103, 0, 99, 158, + 95, 0, 0, 7, 23, 23, 0, 28, 0, 0, + 155, 100, 85, 28, 28, 9, 0, 0, 26, 27, + 0, 34, 37, 28, 30, 31, 8, 24, 0, 28, + 0, 33, 6, 0, 32, 0, 0, 0, 23, 35, + 25 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 1, 110, 103, 2, 364, 375, 11, 4, 25, + 301, 378, 81, 164, 26, 361, 302, 292, 240, 295, + 304, 298, 27, 12, 13, 14, 29, 15, 16, 20, + 120, 19, 31, 100, 203, 235, 284, 17, 18, 33, + 296, 83, 84, 290, 272, 85, 86, 87, 88, 89, + 90, 91, 150, 137, 224, 299, 92, 93, 94, 95, + 96, 97, 112 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -337 +static const short int yypact[] = +{ + -337, 30, -337, -337, 203, -337, -337, 20, -337, -337, + -337, 41, -337, -337, -337, -337, -337, -337, -337, 72, + 83, 63, -337, 83, -337, -337, -337, 319, -337, 97, + -337, 119, -337, 124, 119, -337, -337, 853, 1649, 1649, + 112, 112, 112, 112, -337, 112, 112, -337, 77, -337, + 1649, -337, -337, 78, 84, 94, 100, 8, 1649, 101, + 104, 108, 637, 557, 112, 717, 931, 143, 1649, 67, + 112, -337, 1649, 1649, 1649, 1649, 1649, 1649, 1009, 133, + 134, -337, 930, 131, -337, 18, -337, -337, -337, -337, + 1783, -337, 111, 19, 45, -337, -337, 194, -337, -337, + 148, 197, 148, -337, -337, 74, 98, 98, -337, -337, + -337, -337, -337, -337, -337, -337, 1649, 150, 1649, 306, + 97, 119, -337, -337, -337, -337, -337, -337, 151, 1783, + 149, 1089, 557, -337, 306, 1697, 131, -337, 774, 1649, + -337, 156, -337, 306, 44, 242, -22, 1649, 306, 1169, + 195, -337, -337, -337, -337, 131, 98, 98, 98, 35, + 35, 248, 236, 97, -337, -337, 1649, 1649, 1649, 1649, + 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1249, 1649, 1649, + 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, + 1649, 1649, 1649, -337, -337, 115, 1329, 1649, 1649, 1649, + 1649, 1649, 241, 11, 1649, 11, 31, -337, -337, 1649, + -10, -337, 148, 1649, 1649, 1649, 1649, 246, 397, -337, + -337, -337, 337, 216, 176, 1649, 131, 1409, 1489, -337, + 265, -337, -337, 367, 254, -337, 1649, 275, -337, 205, + -337, 205, 205, 205, 205, 221, 221, -337, 1783, 244, + 106, -337, 382, 1843, 804, 622, 834, 744, 1783, 1740, + 463, 463, 385, 543, 704, 81, 98, 98, 1649, 1649, + -337, 1569, 209, -337, -337, 415, 257, 146, 331, 202, + 525, -337, -337, -337, -337, 231, -337, -337, 206, -337, + 1649, 97, 222, 205, 238, 240, 205, -337, 258, 230, + -337, -337, -337, 259, 269, 208, 1649, -337, -337, -337, + 445, -337, 460, -337, 576, -337, -337, -337, 225, 1649, + 304, -337, -337, 1649, 568, 239, -337, 612, 1649, -337, + 333, -337, 339, -337, 341, -337, -337, -337, -337, -337, + -337, 343, 343, 1649, 343, 1649, 270, -337, -337, -337, + -337, 252, -337, 1826, 358, -337, -337, 281, -337, -337, + -337, 343, 343, -337, 42, 42, 282, 133, 316, 343, + -337, -337, -337, 133, 133, -337, 343, 289, -337, -337, + 343, -337, -337, 133, -337, -337, 224, -337, 1649, 133, + 475, -337, -337, 293, -337, 296, 343, 343, 42, -337, + -337 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -337, -337, -9, -81, -337, -90, -337, -337, -102, -337, + 354, -336, -337, 227, -337, -312, -337, 37, -135, -207, + -4, -337, -337, -337, -337, -337, -337, -337, -337, 80, + 349, -337, 392, -18, -89, -337, 214, -337, -337, -337, + -27, -57, -337, -337, -337, -337, -337, -337, -337, -337, + 33, -337, -337, -107, -197, -337, -337, -38, 352, 355, + -337, -337, 23 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -178 +static const short int yytable[] = +{ + 82, 206, 111, 111, 111, 111, 136, 111, 111, 208, + 105, 303, 288, 205, 36, 155, 102, 40, 79, 128, + 98, 175, 197, 176, 198, 138, 111, 144, 362, 379, + 3, 151, 111, 21, 230, 287, 171, 172, 173, 146, + 231, 213, 214, 215, 216, 217, 218, 197, 199, 198, + 200, 162, 174, 133, 5, 6, 142, 7, 8, 136, + 126, 210, 400, 24, 113, 114, 115, 282, 116, 117, + 390, 106, 107, 289, 376, 377, 40, 41, 42, 294, + 207, 297, 226, 119, 9, 28, 139, 140, 22, 23, + 136, 129, 127, 154, 138, 134, 30, 285, 143, 346, + 36, 148, 177, 212, 222, 223, 156, 157, 158, 159, + 160, 211, 321, -178, -178, 36, 10, 195, 268, 32, + 269, 40, 233, 291, 40, 108, 181, 182, 228, 270, + 109, 357, 171, 172, 173, 99, 366, 101, 306, 239, + 241, 242, 243, 244, 245, 246, 247, 136, 249, 250, + 252, 149, 331, 191, 238, 225, 147, 273, 192, 193, + 194, 118, 122, 195, 171, 172, 173, 163, 123, 275, + 276, 277, 278, 279, 280, 192, 193, 194, 124, 300, + 195, 393, 223, 337, 125, 130, 293, 241, 131, 241, + 165, 305, 132, 174, 283, 196, 283, 201, 310, 271, + 312, 314, 202, -2, 171, 172, 173, 248, 333, 318, + 204, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 5, 6, 392, 7, + 8, 350, 220, 136, 209, 219, 166, 167, 168, 169, + 227, 324, 325, 170, 327, 355, 229, 5, 6, 234, + 7, 8, 365, 236, 367, 40, 9, 281, 370, 309, + 171, 172, 173, 171, 172, 173, 171, 172, 173, 315, + 317, 373, 374, 386, 171, 172, 173, 9, 308, 383, + 319, 173, 338, 171, 172, 173, 387, 335, 10, 336, + 389, -43, 351, 328, 171, 172, 173, 171, 172, 173, + 320, 223, 171, 172, 173, 339, 398, 399, 352, 10, + 171, 172, 173, 330, 343, 171, 172, 173, 293, 237, + 35, 340, 36, 341, 37, 345, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 358, 49, 50, + 51, 342, 344, 359, 52, 360, 363, 53, 54, 55, + 56, 181, 182, 369, 57, 58, 353, 59, 60, 61, + 62, 63, 371, 82, 372, 380, 64, 65, 66, 67, + 68, 69, 382, 388, 70, 71, 396, 190, 191, 397, + 72, 80, 368, 192, 193, 194, 395, 332, 195, 171, + 172, 173, 73, 74, 75, 171, 172, 173, 35, 76, + 77, 121, 37, 78, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 34, 49, 50, 51, 286, + 307, 152, 52, 0, 153, 171, 172, 173, 179, 180, + 181, 182, 0, 58, 0, 59, 60, 61, 62, 63, + 171, 172, 173, 0, 64, 65, 66, 67, 68, 69, + 316, 0, 70, -38, 188, 189, 190, 191, 72, 0, + 0, 0, 192, 193, 194, 322, 0, 195, 0, 0, + 73, 74, 75, 171, 172, 173, 35, 76, 77, 0, + 37, 78, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 0, 49, 50, 51, 0, 329, 0, + 52, 0, 0, 171, 172, 173, 179, 180, 181, 182, + 0, 58, 0, 59, 60, 61, 62, 63, 171, 172, + 173, 0, 64, 65, 66, 67, 68, 69, 347, 0, + 70, 187, 188, 189, 190, 191, 72, 0, 0, 0, + 192, 193, 194, 348, 0, 195, 0, 0, 73, 74, + 75, 0, 0, 0, 0, 76, 77, 0, -38, 78, + 36, 0, 37, 0, 38, 39, 40, 41, 42, 43, + 135, 45, 46, 47, 48, 109, 49, 50, 51, 0, + 0, 334, 52, 171, 172, 173, 179, 180, 181, 182, + 0, 0, 0, 58, 381, 59, 60, 61, 62, 63, + 384, 385, 0, 0, 64, 65, 66, 67, 68, 69, + 391, 0, 70, 189, 190, 191, 394, 0, 72, 0, + 192, 193, 194, 0, 354, 195, 171, 172, 173, 0, + 73, 74, 75, 0, 171, 172, 173, 76, 77, 0, + 36, 78, 37, 0, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 0, 49, 50, 51, 349, + 0, 0, 52, 0, 0, 179, -178, 181, 182, 0, + 171, 172, 173, 58, 0, 59, 60, 61, 62, 63, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 190, 191, 356, 0, 0, 72, 192, + 193, 194, 0, 0, 195, 0, 0, 0, 0, 0, + 73, 74, 75, 0, 0, 0, 0, 76, 77, 0, + 36, 78, 37, 0, 38, 39, 40, 41, 42, 43, + 141, 45, 46, 47, 48, 0, 49, 50, 51, 0, + 0, 0, 52, 0, 0, 0, 0, 179, 180, 181, + 182, 0, 0, 58, 0, 59, 60, 61, 62, 63, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 0, 0, 190, 191, 197, 72, 198, + -149, 192, 193, 194, 0, 0, 195, 0, 0, 181, + 73, 74, 75, 0, 0, 0, 0, 76, 77, 0, + 0, 78, -149, -149, -149, -149, 0, 0, 0, -149, + 0, -149, 0, 0, 0, 0, 191, -149, -149, -149, + -149, 192, 193, 194, 0, 0, 195, 0, 0, 0, + -149, 0, -149, -149, -149, 0, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -178, 0, 181, + 182, -149, -149, -149, 0, 0, -149, -149, 37, 104, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 0, 49, 50, 51, 190, 191, 0, 52, 0, + 0, 192, 193, 194, 0, 0, 195, 0, 0, 58, + 0, 59, 60, 61, 62, 63, 0, 0, 0, 0, + 64, 65, 66, 67, 68, 69, 191, 0, 70, 0, + 0, 192, 193, 194, 72, 0, 195, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 73, 74, 75, 0, + 0, 0, 0, 76, 77, 0, 37, 78, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, + 49, 50, 51, 0, 0, 0, 52, 0, 166, 167, + 168, 169, 0, 0, 0, 170, 0, 58, 0, 59, + 60, 61, 62, 63, 0, 0, 0, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 145, 171, 172, + 173, 0, 72, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 74, 75, 0, 0, 0, + 0, 76, 77, 0, 37, 78, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 161, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 221, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 232, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 251, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 274, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 311, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 313, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, 0, 0, 0, 0, 76, + 77, 0, 326, 78, 37, 0, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 49, 50, + 51, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 59, 60, 61, + 62, 63, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, -177, 70, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 74, 75, -177, -177, -177, -177, 76, + 77, 0, -177, 78, -177, 0, 0, 0, 0, 0, + -177, -177, -177, -177, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -177, 0, -177, -177, -177, 0, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + 0, 0, 0, 0, -177, -177, -177, 178, 0, -177, + -177, 0, 0, 179, 180, 181, 182, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 183, 184, 323, 185, 186, 187, 188, + 189, 190, 191, 0, 0, 0, 0, 192, 193, 194, + 178, 0, 195, 0, 0, 0, 179, 180, 181, 182, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 183, 184, 0, 185, + 186, 187, 188, 189, 190, 191, 0, 0, 0, 0, + 192, 193, 194, 178, 0, 195, 0, 0, 0, 179, + 180, 181, 182, 0, 0, 0, 0, 0, 0, 0, + -178, 0, 0, 0, 0, 0, 179, 180, 181, 182, + 184, 0, 185, 186, 187, 188, 189, 190, 191, 0, + 0, 0, 0, 192, 193, 194, 0, 0, 195, 185, + 186, 187, 188, 189, 190, 191, 0, 0, 0, 0, + 192, 193, 194, 0, 0, 195 +}; + +static const short int yycheck[] = +{ + 27, 103, 40, 41, 42, 43, 63, 45, 46, 116, + 37, 218, 209, 102, 3, 72, 34, 9, 27, 57, + 29, 3, 3, 5, 5, 63, 64, 65, 340, 365, + 0, 69, 70, 13, 56, 4, 58, 59, 60, 66, + 147, 122, 123, 124, 125, 126, 127, 3, 3, 5, + 5, 78, 62, 62, 23, 24, 65, 26, 27, 116, + 52, 118, 398, 22, 41, 42, 43, 56, 45, 46, + 382, 38, 39, 83, 32, 33, 9, 10, 11, 214, + 6, 216, 139, 50, 53, 13, 63, 64, 8, 9, + 147, 58, 84, 70, 132, 62, 13, 204, 65, 306, + 3, 68, 84, 121, 131, 132, 73, 74, 75, 76, + 77, 120, 6, 78, 79, 3, 85, 82, 3, 56, + 5, 9, 149, 212, 9, 13, 45, 46, 84, 14, + 18, 328, 58, 59, 60, 16, 343, 13, 219, 166, + 167, 168, 169, 170, 171, 172, 173, 204, 175, 176, + 177, 84, 6, 72, 163, 132, 13, 195, 77, 78, + 79, 84, 84, 82, 58, 59, 60, 34, 84, 196, + 197, 198, 199, 200, 201, 77, 78, 79, 84, 217, + 82, 388, 209, 290, 84, 84, 213, 214, 84, 216, + 56, 218, 84, 62, 203, 84, 205, 3, 225, 84, + 227, 228, 54, 0, 58, 59, 60, 174, 6, 236, + 13, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 23, 24, 4, 26, + 27, 6, 83, 290, 84, 84, 28, 29, 30, 31, + 84, 268, 269, 35, 271, 6, 4, 23, 24, 54, + 26, 27, 342, 5, 344, 9, 53, 16, 6, 83, + 58, 59, 60, 58, 59, 60, 58, 59, 60, 4, + 16, 361, 362, 375, 58, 59, 60, 53, 62, 369, + 5, 60, 291, 58, 59, 60, 376, 56, 85, 83, + 380, 83, 319, 84, 58, 59, 60, 58, 59, 60, + 56, 328, 58, 59, 60, 83, 396, 397, 4, 85, + 58, 59, 60, 56, 84, 58, 59, 60, 345, 83, + 1, 83, 3, 83, 5, 56, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 4, 19, 20, + 21, 83, 83, 4, 25, 4, 3, 28, 29, 30, + 31, 45, 46, 83, 35, 36, 323, 38, 39, 40, + 41, 42, 4, 390, 83, 83, 47, 48, 49, 50, + 51, 52, 56, 84, 55, 56, 83, 71, 72, 83, + 61, 27, 345, 77, 78, 79, 390, 56, 82, 58, + 59, 60, 73, 74, 75, 58, 59, 60, 1, 80, + 81, 52, 5, 84, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 23, 19, 20, 21, 205, + 83, 69, 25, -1, 69, 58, 59, 60, 43, 44, + 45, 46, -1, 36, -1, 38, 39, 40, 41, 42, + 58, 59, 60, -1, 47, 48, 49, 50, 51, 52, + 83, -1, 55, 56, 69, 70, 71, 72, 61, -1, + -1, -1, 77, 78, 79, 83, -1, 82, -1, -1, + 73, 74, 75, 58, 59, 60, 1, 80, 81, -1, + 5, 84, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, 21, -1, 83, -1, + 25, -1, -1, 58, 59, 60, 43, 44, 45, 46, + -1, 36, -1, 38, 39, 40, 41, 42, 58, 59, + 60, -1, 47, 48, 49, 50, 51, 52, 83, -1, + 55, 68, 69, 70, 71, 72, 61, -1, -1, -1, + 77, 78, 79, 83, -1, 82, -1, -1, 73, 74, + 75, -1, -1, -1, -1, 80, 81, -1, 83, 84, + 3, -1, 5, -1, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, + -1, 56, 25, 58, 59, 60, 43, 44, 45, 46, + -1, -1, -1, 36, 367, 38, 39, 40, 41, 42, + 373, 374, -1, -1, 47, 48, 49, 50, 51, 52, + 383, -1, 55, 70, 71, 72, 389, -1, 61, -1, + 77, 78, 79, -1, 56, 82, 58, 59, 60, -1, + 73, 74, 75, -1, 58, 59, 60, 80, 81, -1, + 3, 84, 5, -1, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, 21, 83, + -1, -1, 25, -1, -1, 43, 44, 45, 46, -1, + 58, 59, 60, 36, -1, 38, 39, 40, 41, 42, + -1, -1, -1, -1, 47, 48, 49, 50, 51, 52, + -1, -1, 55, 71, 72, 83, -1, -1, 61, 77, + 78, 79, -1, -1, 82, -1, -1, -1, -1, -1, + 73, 74, 75, -1, -1, -1, -1, 80, 81, -1, + 3, 84, 5, -1, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, 21, -1, + -1, -1, 25, -1, -1, -1, -1, 43, 44, 45, + 46, -1, -1, 36, -1, 38, 39, 40, 41, 42, + -1, -1, -1, -1, 47, 48, 49, 50, 51, 52, + -1, -1, 55, -1, -1, 71, 72, 3, 61, 5, + 6, 77, 78, 79, -1, -1, 82, -1, -1, 45, + 73, 74, 75, -1, -1, -1, -1, 80, 81, -1, + -1, 84, 28, 29, 30, 31, -1, -1, -1, 35, + -1, 37, -1, -1, -1, -1, 72, 43, 44, 45, + 46, 77, 78, 79, -1, -1, 82, -1, -1, -1, + 56, -1, 58, 59, 60, -1, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 43, -1, 45, + 46, 77, 78, 79, -1, -1, 82, 83, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, 21, 71, 72, -1, 25, -1, + -1, 77, 78, 79, -1, -1, 82, -1, -1, 36, + -1, 38, 39, 40, 41, 42, -1, -1, -1, -1, + 47, 48, 49, 50, 51, 52, 72, -1, 55, -1, + -1, 77, 78, 79, 61, -1, 82, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 73, 74, 75, -1, + -1, -1, -1, 80, 81, -1, 5, 84, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, 21, -1, -1, -1, 25, -1, 28, 29, + 30, 31, -1, -1, -1, 35, -1, 36, -1, 38, + 39, 40, 41, 42, -1, -1, -1, -1, 47, 48, + 49, 50, 51, 52, -1, -1, 55, 56, 58, 59, + 60, -1, 61, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 73, 74, 75, -1, -1, -1, + -1, 80, 81, -1, 5, 84, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, -1, -1, -1, 80, + 81, -1, 83, 84, 5, -1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, -1, -1, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, 38, 39, 40, + 41, 42, -1, -1, -1, -1, 47, 48, 49, 50, + 51, 52, -1, 6, 55, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, 28, 29, 30, 31, 80, + 81, -1, 35, 84, 37, -1, -1, -1, -1, -1, + 43, 44, 45, 46, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 56, -1, 58, 59, 60, -1, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + -1, -1, -1, -1, 77, 78, 79, 37, -1, 82, + 83, -1, -1, 43, 44, 45, 46, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, -1, -1, -1, -1, 77, 78, 79, + 37, -1, 82, -1, -1, -1, 43, 44, 45, 46, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 63, 64, -1, 66, + 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, + 77, 78, 79, 37, -1, 82, -1, -1, -1, 43, + 44, 45, 46, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, 43, 44, 45, 46, + 64, -1, 66, 67, 68, 69, 70, 71, 72, -1, + -1, -1, -1, 77, 78, 79, -1, -1, 82, 66, + 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, + 77, 78, 79, -1, -1, 82 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 87, 90, 0, 94, 23, 24, 26, 27, 53, + 85, 93, 109, 110, 111, 113, 114, 123, 124, 117, + 115, 13, 115, 115, 22, 95, 100, 108, 13, 112, + 13, 118, 56, 125, 118, 1, 3, 5, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, + 20, 21, 25, 28, 29, 30, 31, 35, 36, 38, + 39, 40, 41, 42, 47, 48, 49, 50, 51, 52, + 55, 56, 61, 73, 74, 75, 80, 81, 84, 88, + 96, 98, 126, 127, 128, 131, 132, 133, 134, 135, + 136, 137, 142, 143, 144, 145, 146, 147, 88, 16, + 119, 13, 119, 89, 6, 126, 136, 136, 13, 18, + 88, 143, 148, 148, 148, 148, 148, 148, 84, 136, + 116, 116, 84, 84, 84, 84, 52, 84, 143, 136, + 84, 84, 84, 88, 136, 13, 127, 139, 143, 148, + 148, 13, 88, 136, 143, 56, 126, 13, 136, 84, + 138, 143, 144, 145, 148, 127, 136, 136, 136, 136, + 136, 83, 126, 34, 99, 56, 28, 29, 30, 31, + 35, 58, 59, 60, 62, 3, 5, 84, 37, 43, + 44, 45, 46, 63, 64, 66, 67, 68, 69, 70, + 71, 72, 77, 78, 79, 82, 84, 3, 5, 3, + 5, 3, 54, 120, 13, 120, 94, 6, 139, 84, + 127, 88, 119, 89, 89, 89, 89, 89, 89, 84, + 83, 83, 126, 126, 140, 148, 127, 84, 84, 4, + 56, 139, 83, 126, 54, 121, 5, 83, 88, 126, + 104, 126, 126, 126, 126, 126, 126, 126, 136, 126, + 126, 83, 126, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 3, 5, + 14, 84, 130, 143, 83, 126, 126, 126, 126, 126, + 126, 16, 56, 88, 122, 139, 122, 4, 140, 83, + 129, 120, 103, 126, 104, 105, 126, 104, 107, 141, + 143, 96, 102, 105, 106, 126, 89, 83, 62, 83, + 126, 83, 126, 83, 126, 4, 83, 16, 126, 5, + 56, 6, 83, 65, 126, 126, 83, 126, 84, 83, + 56, 6, 56, 6, 56, 56, 83, 139, 88, 83, + 83, 83, 83, 84, 83, 56, 105, 83, 83, 83, + 6, 126, 4, 136, 56, 6, 83, 140, 4, 4, + 4, 101, 101, 3, 91, 91, 105, 91, 103, 83, + 6, 4, 83, 91, 91, 92, 32, 33, 97, 97, + 83, 99, 56, 91, 99, 99, 94, 91, 84, 91, + 101, 99, 4, 105, 99, 106, 83, 83, 91, 91, + 97 +}; diff --git a/madly.y b/madly.y new file mode 100644 index 0000000..576319f --- /dev/null +++ b/madly.y @@ -0,0 +1,1167 @@ +/* perly.y + * + * Copyright (c) 1991-2002, 2003, 2004 Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * 'I see,' laughed Strider. 'I look foul and feel fair. Is that it? + * All that is gold does not glitter, not all those who wander are lost.' + */ + +/* Make the parser re-entrant. */ + +%pure_parser + +%start prog + +%union { + I32 ival; + char *pval; + TOKEN* tkval; + OP *opval; + GV *gvval; +} + +%token '{' '}' '[' ']' '-' '+' '$' '@' '%' '*' + +%token WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF +%token FUNC0SUB UNIOPSUB LSTOPSUB +%token LABEL +%token FORMAT SUB ANONSUB PACKAGE USE +%token WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR +%token LOOPEX DOTDOT +%token FUNC0 FUNC1 FUNC UNIOP LSTOP +%token RELOP EQOP MULOP ADDOP +%token DOLSHARP DO HASHBRACK NOAMP +%token LOCAL MY MYSUB +%token COLONATTR + +%type prog progstart remember mremember savescope +%type startsub startanonsub startformsub mintro + +%type '&' ';' + +%type decl format subrout mysubrout package use peg + +%type block mblock lineseq line loop cond else +%type expr term subscripted scalar ary hsh arylen star amper sideff +%type argexpr nexpr texpr iexpr mexpr mnexpr miexpr +%type listexpr listexprcom indirob listop method +%type formname subname proto subbody cont my_scalar +%type subattrlist myattrlist myattrterm myterm +%type termbinop termunop anonymous termdo +%type label + +%nonassoc PREC_LOW +%nonassoc LOOPEX + +%left OROP DOROP +%left ANDOP +%right NOTOP +%nonassoc LSTOP LSTOPSUB +%left ',' +%right ASSIGNOP +%right '?' ':' +%nonassoc DOTDOT +%left OROR DORDOR +%left ANDAND +%left BITOROP +%left BITANDOP +%nonassoc EQOP +%nonassoc RELOP +%nonassoc UNIOP UNIOPSUB +%left SHIFTOP +%left ADDOP +%left MULOP +%left MATCHOP +%right '!' '~' UMINUS REFGEN +%right POWOP +%nonassoc PREINC PREDEC POSTINC POSTDEC +%left ARROW +%nonassoc ')' +%left '(' +%left '[' '{' + +%token PEG + +%% /* RULES */ + +/* The whole program */ +prog : progstart + /*CONTINUED*/ lineseq + { $$ = $1; newPROG(block_end($1,$2)); } + ; + +/* An ordinary block */ +block : '{' remember lineseq '}' + { if (PL_copline > (line_t)($1)->tk_lval.ival) + PL_copline = (line_t)($1)->tk_lval.ival; + $$ = block_end($2, $3); + token_getmad($1,$$,'{'); + token_getmad($4,$$,'}'); + } + ; + +remember: /* NULL */ /* start a full lexical scope */ + { $$ = block_start(TRUE); } + ; + +progstart: + { + PL_expect = XSTATE; $$ = block_start(TRUE); + } + ; + + +mblock : '{' mremember lineseq '}' + { if (PL_copline > (line_t)($1)->tk_lval.ival) + PL_copline = (line_t)($1)->tk_lval.ival; + $$ = block_end($2, $3); + token_getmad($1,$$,'{'); + token_getmad($4,$$,'}'); + } + ; + +mremember: /* NULL */ /* start a partial lexical scope */ + { $$ = block_start(FALSE); } + ; + +savescope: /* NULL */ /* remember stack pos in case of error */ + { $$ = PL_savestack_ix; } + +/* A collection of "lines" in the program */ +lineseq : /* NULL */ + { $$ = Nullop; } + | lineseq decl +/* { $$ = $1 } */ + { $$ = append_list(OP_LINESEQ, + (LISTOP*)$1, (LISTOP*)$2); } + | lineseq savescope line + { LEAVE_SCOPE($2); + $$ = append_list(OP_LINESEQ, + (LISTOP*)$1, (LISTOP*)$3); + PL_pad_reset_pending = TRUE; + if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; } + ; + +/* A "line" in the program */ +line : label cond + { $$ = newSTATEOP(0, ($1)->tk_lval.pval, $2); + token_getmad($1,((LISTOP*)$$)->op_first,'L'); } + | loop /* loops add their own labels */ + | label ';' + { + if (($1)->tk_lval.pval) { + $$ = newSTATEOP(0, ($1)->tk_lval.pval, newOP(OP_NULL, 0)); + token_getmad($1,$$,'L'); + token_getmad($2,((LISTOP*)$$)->op_first,';'); + } + else { + $$ = newOP(OP_NULL, 0); + PL_copline = NOLINE; + token_free($1); + token_getmad($2,$$,';'); + } + PL_expect = XSTATE; + } + | label sideff ';' + { OP* op; + $$ = newSTATEOP(0, ($1)->tk_lval.pval, $2); + PL_expect = XSTATE; + /* sideff might already have a nexstate */ + op = ((LISTOP*)$$)->op_first; + if (op) { + while (op->op_sibling && + op->op_sibling->op_type == OP_NEXTSTATE) + op = op->op_sibling; + token_getmad($1,op,'L'); + token_getmad($3,op,';'); + } + } + ; + +/* An expression which may have a side-effect */ +sideff : error + { $$ = Nullop; } + | expr + { $$ = $1; } + | expr IF expr + { $$ = newLOGOP(OP_AND, 0, $3, $1); + token_getmad($2,$$,'i'); + } + | expr UNLESS expr + { $$ = newLOGOP(OP_OR, 0, $3, $1); + token_getmad($2,$$,'i'); + } + | expr WHILE expr + { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); + token_getmad($2,$$,'w'); + } + | expr UNTIL iexpr + { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1); + token_getmad($2,$$,'w'); + } + | expr FOR expr + { $$ = newFOROP(0, Nullch, (line_t)($2)->tk_lval.ival, + Nullop, $3, $1, Nullop); + token_getmad($2,((LISTOP*)$$)->op_first->op_sibling,'w'); + } + ; + +/* else and elsif blocks */ +else : /* NULL */ + { $$ = Nullop; } + | ELSE mblock + { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); + token_getmad($1,$$,'o'); + } + | ELSIF '(' mexpr ')' mblock else + { PL_copline = (line_t)($1)->tk_lval.ival; + $$ = newCONDOP(0, $3, scope($5), $6); + PL_hints |= HINT_BLOCK_SCOPE; + token_getmad($1,$$,'I'); + token_getmad($2,$$,'('); + token_getmad($4,$$,')'); + } + ; + +/* Real conditional expressions */ +cond : IF '(' remember mexpr ')' mblock else + { PL_copline = (line_t)($1)->tk_lval.ival; + $$ = block_end($3, + newCONDOP(0, $4, scope($6), $7)); + token_getmad($1,$$,'I'); + token_getmad($2,$$,'('); + token_getmad($5,$$,')'); + } + | UNLESS '(' remember miexpr ')' mblock else + { PL_copline = (line_t)($1)->tk_lval.ival; + $$ = block_end($3, + newCONDOP(0, $4, scope($6), $7)); + token_getmad($1,$$,'I'); + token_getmad($2,$$,'('); + token_getmad($5,$$,')'); + } + ; + +/* Continue blocks */ +cont : /* NULL */ + { $$ = Nullop; } + | CONTINUE block + { $$ = scope($2); + token_getmad($1,$$,'o'); + } + ; + +/* Loops: while, until, for, and a bare block */ +loop : label WHILE '(' remember texpr ')' mintro mblock cont + { OP *innerop; + PL_copline = (line_t)$2; + $$ = block_end($4, + newSTATEOP(0, ($1)->tk_lval.pval, + innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + ($2)->tk_lval.ival, $5, $8, $9, $7))); + token_getmad($1,innerop,'L'); + token_getmad($2,innerop,'W'); + token_getmad($3,innerop,'('); + token_getmad($6,innerop,')'); + } + | label UNTIL '(' remember iexpr ')' mintro mblock cont + { OP *innerop; + PL_copline = (line_t)$2; + $$ = block_end($4, + newSTATEOP(0, ($1)->tk_lval.pval, + innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + ($2)->tk_lval.ival, $5, $8, $9, $7))); + token_getmad($1,innerop,'L'); + token_getmad($2,innerop,'W'); + token_getmad($3,innerop,'('); + token_getmad($6,innerop,')'); + } + | label FOR MY remember my_scalar '(' mexpr ')' mblock cont + { OP *innerop; + $$ = block_end($4, + innerop = newFOROP(0, ($1)->tk_lval.pval, (line_t)($2)->tk_lval.ival, $5, $7, $9, $10)); + token_getmad($1,((LISTOP*)innerop)->op_first,'L'); + token_getmad($2,((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad($3,((LISTOP*)innerop)->op_first->op_sibling,'d'); + token_getmad($6,((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad($8,((LISTOP*)innerop)->op_first->op_sibling,')'); + } + | label FOR scalar '(' remember mexpr ')' mblock cont + { OP *innerop; + $$ = block_end($5, + innerop = newFOROP(0, ($1)->tk_lval.pval, (line_t)($2)->tk_lval.ival, mod($3, OP_ENTERLOOP), + $6, $8, $9)); + token_getmad($1,((LISTOP*)innerop)->op_first,'L'); + token_getmad($2,((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad($4,((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad($7,((LISTOP*)innerop)->op_first->op_sibling,')'); + } + | label FOR '(' remember mexpr ')' mblock cont + { OP *innerop; + $$ = block_end($4, + innerop = newFOROP(0, ($1)->tk_lval.pval, (line_t)($2)->tk_lval.ival, Nullop, $5, $7, $8)); + token_getmad($1,((LISTOP*)innerop)->op_first,'L'); + token_getmad($2,((LISTOP*)innerop)->op_first->op_sibling,'W'); + token_getmad($3,((LISTOP*)innerop)->op_first->op_sibling,'('); + token_getmad($6,((LISTOP*)innerop)->op_first->op_sibling,')'); + } + | label FOR '(' remember mnexpr ';' texpr ';' mintro mnexpr ')' mblock + /* basically fake up an initialize-while lineseq */ + { OP *forop; + PL_copline = (line_t)($2)->tk_lval.ival; + forop = newSTATEOP(0, ($1)->tk_lval.pval, + newWHILEOP(0, 1, (LOOP*)Nullop, + ($2)->tk_lval.ival, scalar($7), + $12, $10, $9)); + if (!$5) + $5 = newOP(OP_NULL, 0); + forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ, + newSTATEOP(0, + (($1)->tk_lval.pval + ?savepv(($1)->tk_lval.pval):Nullch), + $5), + forop)); + + token_getmad($2,forop,'3'); + token_getmad($3,forop,'('); + token_getmad($6,forop,'1'); + token_getmad($8,forop,'2'); + token_getmad($11,forop,')'); + token_getmad($1,forop,'L'); + $$ = block_end($4, forop); + } + | label block cont /* a block is a loop that happens once */ + { $$ = newSTATEOP(0, ($1)->tk_lval.pval, + newWHILEOP(0, 1, (LOOP*)Nullop, + NOLINE, Nullop, $2, $3, 0)); + token_getmad($1,((LISTOP*)$$)->op_first,'L'); } + ; + +/* determine whether there are any new my declarations */ +mintro : /* NULL */ + { $$ = (PL_min_intro_pending && + PL_max_intro_pending >= PL_min_intro_pending); + intro_my(); } + + +/* Normal expression */ +nexpr : /* NULL */ + { $$ = Nullop; } + | sideff + ; + +/* Boolean expression */ +texpr : /* NULL means true */ + { YYSTYPE tmplval; + (void)scan_num("1", &tmplval); + $$ = tmplval.opval; } + | expr + ; + +/* Inverted boolean expression */ +iexpr : expr + { $$ = invert(scalar($1)); } + ; + +/* Expression with its own lexical scope */ +mexpr : expr + { $$ = $1; intro_my(); } + ; + +mnexpr : nexpr + { $$ = $1; intro_my(); } + ; + +miexpr : iexpr + { $$ = $1; intro_my(); } + ; + +/* Optional "MAIN:"-style loop labels */ +label : /* empty */ + { YYSTYPE tmplval; + tmplval.pval = Nullch; + $$ = newTOKEN(OP_NULL, tmplval, 0); } + | LABEL + ; + +/* Some kind of declaration - just hang on peg in the parse tree */ +decl : format + { $$ = $1; } + | subrout + { $$ = $1; } + | mysubrout + { $$ = $1; } + | package + { $$ = $1; } + | use + { $$ = $1; } + | peg + { $$ = $1; } + ; + +peg : PEG + { $$ = newOP(OP_NULL,0); + token_getmad($1,$$,'p'); + } + ; + +format : FORMAT startformsub formname block + { $$ = newFORM($2, $3, $4); + prepend_madprops($1->tk_mad, $$, 'F'); + $1->tk_mad = 0; + token_free($1); + } + ; + +formname: WORD { $$ = $1; } + | /* NULL */ { $$ = Nullop; } + ; + +/* Unimplemented "my sub foo { }" */ +mysubrout: MYSUB startsub subname proto subattrlist subbody + { $$ = newMYSUB($2, $3, $4, $5, $6); + token_getmad($1,$$,'d'); + } + ; + +/* Subroutine definition */ +subrout : SUB startsub subname proto subattrlist subbody + { OP* o = newSVOP(OP_ANONCODE, 0, + (SV*)newATTRSUB($2, $3, $4, $5, $6)); + $$ = newOP(OP_NULL,0); + op_getmad(o,$$,'&'); + op_getmad($3,$$,'n'); + op_getmad($4,$$,'s'); + op_getmad($5,$$,'a'); + token_getmad($1,$$,'d'); + append_madprops($6->op_madprop, $$, 0); + $6->op_madprop = 0; + } + ; + +startsub: /* NULL */ /* start a regular subroutine scope */ + { $$ = start_subparse(FALSE, 0); } + ; + +startanonsub: /* NULL */ /* start an anonymous subroutine scope */ + { $$ = start_subparse(FALSE, CVf_ANON); } + ; + +startformsub: /* NULL */ /* start a format subroutine scope */ + { $$ = start_subparse(TRUE, 0); } + ; + +/* Name of a subroutine - must be a bareword, could be special */ +subname : WORD { STRLEN n_a; char *name = SvPV(((SVOP*)$1)->op_sv,n_a); + if (strEQ(name, "BEGIN") || strEQ(name, "END") + || strEQ(name, "INIT") || strEQ(name, "CHECK")) + CvSPECIAL_on(PL_compcv); + $$ = $1; } + ; + +/* Subroutine prototype */ +proto : /* NULL */ + { $$ = Nullop; } + | THING + ; + +/* Optional list of subroutine attributes */ +subattrlist: /* NULL */ + { $$ = Nullop; } + | COLONATTR THING + { $$ = $2; + token_getmad($1,$$,':'); + } + | COLONATTR + { $$ = newOP(OP_NULL, 0); + token_getmad($1,$$,':'); + } + ; + +/* List of attributes for a "my" variable declaration */ +myattrlist: COLONATTR THING + { $$ = $2; + token_getmad($1,$$,':'); + } + | COLONATTR + { $$ = newOP(OP_NULL, 0); + token_getmad($1,$$,':'); + } + ; + +/* Subroutine body - either null or a block */ +subbody : block { $$ = $1; } + | ';' { $$ = newOP(OP_NULL,0); PL_expect = XSTATE; + token_getmad($1,$$,';'); + } + ; + +package : PACKAGE WORD ';' + { $$ = package($2); + token_getmad($1,$$,'o'); + token_getmad($3,$$,';'); + } + ; + +use : USE startsub + { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ } + WORD WORD listexpr ';' + { $$ = utilize(($1)->tk_lval.ival, $2, $4, $5, $6); + token_getmad($1,$$,'o'); + token_getmad($7,$$,';'); + if (PL_rsfp_filters && AvFILLp(PL_rsfp_filters) >= 0) + append_madprops(newMADPROP('!', MAD_PV, "", 0), $$, 0); + } + ; + +/* Ordinary expressions; logical combinations */ +expr : expr ANDOP expr + { $$ = newLOGOP(OP_AND, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | expr OROP expr + { $$ = newLOGOP(($2)->tk_lval.ival, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | expr DOROP expr + { $$ = newLOGOP(OP_DOR, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | argexpr %prec PREC_LOW + ; + +/* Expressions are a list of terms joined by commas */ +argexpr : argexpr ',' + { OP* op = newNULLLIST(); + token_getmad($2,op,','); + $$ = append_elem(OP_LIST, $1, op); + } + | argexpr ',' term + { + $3 = newUNOP(OP_NULL, 0, $3); + token_getmad($2,$3,','); + $$ = append_elem(OP_LIST, $1, $3); + } + | term %prec PREC_LOW + ; + +/* List operators */ +listop : LSTOP indirob argexpr /* print $fh @args */ + { $$ = convert(($1)->tk_lval.ival, OPf_STACKED, + prepend_elem(OP_LIST, newGVREF(($1)->tk_lval.ival,$2), $3) ); + token_getmad($1,$$,'o'); + } + | FUNC '(' indirob expr ')' /* print ($fh @args */ + { $$ = convert(($1)->tk_lval.ival, OPf_STACKED, + prepend_elem(OP_LIST, newGVREF(($1)->tk_lval.ival,$3), $4) ); + token_getmad($1,$$,'o'); + token_getmad($2,$$,'('); + token_getmad($5,$$,')'); + } + | term ARROW method '(' listexprcom ')' /* $foo->bar(list) */ + { $$ = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, scalar($1), $5), + newUNOP(OP_METHOD, 0, $3))); + token_getmad($2,$$,'A'); + token_getmad($4,$$,'('); + token_getmad($6,$$,')'); + } + | term ARROW method /* $foo->bar */ + { $$ = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, scalar($1), + newUNOP(OP_METHOD, 0, $3))); + token_getmad($2,$$,'A'); + } + | METHOD indirob listexpr /* new Class @args */ + { $$ = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, $2, $3), + newUNOP(OP_METHOD, 0, $1))); + } + | FUNCMETH indirob '(' listexprcom ')' /* method $object (@args) */ + { $$ = convert(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, $2, $4), + newUNOP(OP_METHOD, 0, $1))); + token_getmad($3,$$,'('); + token_getmad($5,$$,')'); + } + | LSTOP listexpr /* print @args */ + { $$ = convert(($1)->tk_lval.ival, 0, $2); + token_getmad($1,$$,'o'); + } + | FUNC '(' listexprcom ')' /* print (@args) */ + { $$ = convert(($1)->tk_lval.ival, 0, $3); + token_getmad($1,$$,'o'); + token_getmad($2,$$,'('); + token_getmad($4,$$,')'); + } + | LSTOPSUB startanonsub block /* map { foo } ... */ + { $3 = newANONATTRSUB($2, 0, Nullop, $3); } + listexpr %prec LSTOP /* ... @bar */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, + prepend_elem(OP_LIST, $3, $5), $1)); + } + ; + +/* Names of methods. May use $object->$methodname */ +method : METHOD + | scalar + ; + +/* Some kind of subscripted expression */ +subscripted: star '{' expr ';' '}' /* *main::{something} */ + /* In this and all the hash accessors, ';' is + * provided by the tokeniser */ + { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); + PL_expect = XOPERATOR; + token_getmad($2,$$,'{'); + token_getmad($4,$$,';'); + token_getmad($5,$$,'}'); + } + | scalar '[' expr ']' /* $array[$element] */ + { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); + token_getmad($2,$$,'['); + token_getmad($4,$$,']'); + } + | term ARROW '[' expr ']' /* somearef->[$element] */ + { $$ = newBINOP(OP_AELEM, 0, + ref(newAVREF($1),OP_RV2AV), + scalar($4)); + token_getmad($2,$$,'a'); + token_getmad($3,$$,'['); + token_getmad($5,$$,']'); + } + | subscripted '[' expr ']' /* $foo->[$bar]->[$baz] */ + { $$ = newBINOP(OP_AELEM, 0, + ref(newAVREF($1),OP_RV2AV), + scalar($3)); + token_getmad($2,$$,'['); + token_getmad($4,$$,']'); + } + | scalar '{' expr ';' '}' /* $foo->{bar();} */ + { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3)); + PL_expect = XOPERATOR; + token_getmad($2,$$,'{'); + token_getmad($4,$$,';'); + token_getmad($5,$$,'}'); + } + | term ARROW '{' expr ';' '}' /* somehref->{bar();} */ + { $$ = newBINOP(OP_HELEM, 0, + ref(newHVREF($1),OP_RV2HV), + jmaybe($4)); + PL_expect = XOPERATOR; + token_getmad($2,$$,'a'); + token_getmad($3,$$,'{'); + token_getmad($5,$$,';'); + token_getmad($6,$$,'}'); + } + | subscripted '{' expr ';' '}' /* $foo->[bar]->{baz;} */ + { $$ = newBINOP(OP_HELEM, 0, + ref(newHVREF($1),OP_RV2HV), + jmaybe($3)); + PL_expect = XOPERATOR; + token_getmad($2,$$,'{'); + token_getmad($4,$$,';'); + token_getmad($5,$$,'}'); + } + | term ARROW '(' ')' /* $subref->() */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + newCVREF(0, scalar($1))); + token_getmad($2,$$,'a'); + token_getmad($3,$$,'('); + token_getmad($4,$$,')'); + } + | term ARROW '(' expr ')' /* $subref->(@args) */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, $4, + newCVREF(0, scalar($1)))); + token_getmad($2,$$,'a'); + token_getmad($3,$$,'('); + token_getmad($5,$$,')'); + } + + | subscripted '(' expr ')' /* $foo->{bar}->(@args) */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, $3, + newCVREF(0, scalar($1)))); + token_getmad($2,$$,'('); + token_getmad($4,$$,')'); + } + | subscripted '(' ')' /* $foo->{bar}->() */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + newCVREF(0, scalar($1))); + token_getmad($2,$$,'('); + token_getmad($3,$$,')'); + } + ; + +/* Binary operators between terms */ +termbinop: term ASSIGNOP term /* $x = $y */ + { $$ = newASSIGNOP(OPf_STACKED, $1, ($2)->tk_lval.ival, $3); + token_getmad($2,$$,'o'); + } + | term POWOP term /* $x ** $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term MULOP term /* $x * $y, $x x $y */ + { if (($2)->tk_lval.ival != OP_REPEAT) + scalar($1); + $$ = newBINOP(($2)->tk_lval.ival, 0, $1, scalar($3)); + token_getmad($2,$$,'o'); + } + | term ADDOP term /* $x + $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term SHIFTOP term /* $x >> $y, $x << $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term RELOP term /* $x > $y, etc. */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term EQOP term /* $x == $y, $x eq $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term BITANDOP term /* $x & $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term BITOROP term /* $x | $y */ + { $$ = newBINOP(($2)->tk_lval.ival, 0, scalar($1), scalar($3)); + token_getmad($2,$$,'o'); + } + | term DOTDOT term /* $x..$y, $x...$y */ + { UNOP *op; + $$ = newRANGE(($2)->tk_lval.ival, scalar($1), scalar($3)); + op = (UNOP*)$$; + op = (UNOP*)op->op_first; /* get to flop */ + op = (UNOP*)op->op_first; /* get to flip */ + op = (UNOP*)op->op_first; /* get to range */ + token_getmad($2,(OP*)op,'o'); + } + | term ANDAND term /* $x && $y */ + { $$ = newLOGOP(OP_AND, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | term OROR term /* $x || $y */ + { $$ = newLOGOP(OP_OR, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | term DORDOR term /* $x // $y */ + { $$ = newLOGOP(OP_DOR, 0, $1, $3); + token_getmad($2,$$,'o'); + } + | term MATCHOP term /* $x =~ /$y/ */ + { $$ = bind_match(($2)->tk_lval.ival, $1, $3); + if ($$->op_type == OP_NOT) + token_getmad($2,((UNOP*)$$)->op_first,'~'); + else + token_getmad($2,$$,'~'); + } + ; + +/* Unary operators and terms */ +termunop : '-' term %prec UMINUS /* -$x */ + { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); + token_getmad($1,$$,'o'); + } + | '+' term %prec UMINUS /* +$x */ + { $$ = newUNOP(OP_NULL, 0, $2); + token_getmad($1,$$,'+'); + } + | '!' term /* !$x */ + { $$ = newUNOP(OP_NOT, 0, scalar($2)); + token_getmad($1,$$,'o'); + } + | '~' term /* ~$x */ + { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2)); + token_getmad($1,$$,'o'); + } + | term POSTINC /* $x++ */ + { $$ = newUNOP(OP_POSTINC, 0, + mod(scalar($1), OP_POSTINC)); + token_getmad($2,$$,'o'); + } + | term POSTDEC /* $x-- */ + { $$ = newUNOP(OP_POSTDEC, 0, + mod(scalar($1), OP_POSTDEC)); + token_getmad($2,$$,'o'); + } + | PREINC term /* ++$x */ + { $$ = newUNOP(OP_PREINC, 0, + mod(scalar($2), OP_PREINC)); + token_getmad($1,$$,'o'); + } + | PREDEC term /* --$x */ + { $$ = newUNOP(OP_PREDEC, 0, + mod(scalar($2), OP_PREDEC)); + token_getmad($1,$$,'o'); + } + + ; + +/* Constructors for anonymous data */ +anonymous: '[' expr ']' + { $$ = newANONLIST($2); + token_getmad($1,$$,'['); + token_getmad($3,$$,']'); + } + | '[' ']' + { $$ = newANONLIST(Nullop); + token_getmad($1,$$,'['); + token_getmad($2,$$,']'); + } + | HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */ + { $$ = newANONHASH($2); + token_getmad($1,$$,'{'); + token_getmad($3,$$,';'); + token_getmad($4,$$,'}'); + } + | HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */ + { $$ = newANONHASH(Nullop); + token_getmad($1,$$,'{'); + token_getmad($2,$$,';'); + token_getmad($3,$$,'}'); + } + | ANONSUB startanonsub proto subattrlist block %prec '(' + { $$ = newANONATTRSUB($2, $3, $4, $5); + token_getmad($1,$$,'o'); + op_getmad($3,$$,'s'); + op_getmad($4,$$,'a'); + } + + ; + +/* Things called with "do" */ +termdo : DO term %prec UNIOP /* do $filename */ + { $$ = dofile($2, $1); + token_getmad($1,$$,'o'); + } + | DO block %prec '(' /* do { code */ + { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); + token_getmad($1,$$,'D'); + } + | DO WORD '(' ')' /* do somesub() */ + { $$ = newUNOP(OP_ENTERSUB, + OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + scalar(newCVREF( + (OPpENTERSUB_AMPER<<8), + scalar($2) + )),Nullop)); dep(); + token_getmad($1,$$,'o'); + token_getmad($3,$$,'('); + token_getmad($4,$$,')'); + } + | DO WORD '(' expr ')' /* do somesub(@args) */ + { $$ = newUNOP(OP_ENTERSUB, + OPf_SPECIAL|OPf_STACKED, + append_elem(OP_LIST, + $4, + scalar(newCVREF( + (OPpENTERSUB_AMPER<<8), + scalar($2) + )))); dep(); + token_getmad($1,$$,'o'); + token_getmad($3,$$,'('); + token_getmad($5,$$,')'); + } + | DO scalar '(' ')' /* do $subref () */ + { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + scalar(newCVREF(0,scalar($2))), Nullop)); dep(); + token_getmad($1,$$,'o'); + token_getmad($3,$$,'('); + token_getmad($4,$$,')'); + } + | DO scalar '(' expr ')' /* do $subref (@args) */ + { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, + prepend_elem(OP_LIST, + $4, + scalar(newCVREF(0,scalar($2))))); dep(); + token_getmad($1,$$,'o'); + token_getmad($3,$$,'('); + token_getmad($5,$$,')'); + } + + ; + +term : termbinop + | termunop + | anonymous + | termdo + | term '?' term ':' term + { $$ = newCONDOP(0, $1, $3, $5); + token_getmad($2,$$,'?'); + token_getmad($4,$$,':'); + } + | REFGEN term /* \$x, \@y, \%z */ + { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); + token_getmad($1,$$,'o'); + } + | myattrterm %prec UNIOP + { $$ = $1; } + | LOCAL term %prec UNIOP + { $$ = localize($2,($1)->tk_lval.ival); + token_getmad($1,$$,'d'); + } + | '(' expr ')' + { $$ = sawparens(newUNOP(OP_NULL,0,$2)); + token_getmad($1,$$,'('); + token_getmad($3,$$,')'); + } + | '(' ')' + { $$ = sawparens(newNULLLIST()); + token_getmad($1,$$,'('); + token_getmad($2,$$,')'); + } + | scalar %prec '(' + { $$ = $1; } + | star %prec '(' + { $$ = $1; } + | hsh %prec '(' + { $$ = $1; } + | ary %prec '(' + { $$ = $1; } + | arylen %prec '(' /* $#x, $#{ something } */ + { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));} + | subscripted + { $$ = $1; } + | '(' expr ')' '[' expr ']' /* list slice */ + { $$ = newSLICEOP(0, $5, $2); + token_getmad($1,$$,'('); + token_getmad($3,$$,')'); + token_getmad($4,$$,'['); + token_getmad($6,$$,']'); + } + | '(' ')' '[' expr ']' /* empty list slice! */ + { $$ = newSLICEOP(0, $4, Nullop); + token_getmad($1,$$,'('); + token_getmad($2,$$,')'); + token_getmad($3,$$,'['); + token_getmad($5,$$,']'); + } + | ary '[' expr ']' /* array slice */ + { $$ = prepend_elem(OP_ASLICE, + newOP(OP_PUSHMARK, 0), + newLISTOP(OP_ASLICE, 0, + list($3), + ref($1, OP_ASLICE))); + token_getmad($2,$$,'['); + token_getmad($4,$$,']'); + } + | ary '{' expr ';' '}' /* @hash{@keys} */ + { $$ = prepend_elem(OP_HSLICE, + newOP(OP_PUSHMARK, 0), + newLISTOP(OP_HSLICE, 0, + list($3), + ref(oopsHV($1), OP_HSLICE))); + PL_expect = XOPERATOR; + token_getmad($2,$$,'{'); + token_getmad($4,$$,';'); + token_getmad($5,$$,'}'); + } + | THING %prec '(' + { $$ = $1; } + | amper /* &foo; */ + { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); } + | amper '(' ')' /* &foo() */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); + token_getmad($2,$$,'('); + token_getmad($3,$$,')'); + } + | amper '(' expr ')' /* &foo(@args) */ + { OP* op; + $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, $3, scalar($1))); + op = $$; + if (op->op_type == OP_CONST) { /* defeat const fold */ + op = (OP*)op->op_madprop->mad_val; + } + token_getmad($2,op,'('); + token_getmad($4,op,')'); + } + | NOAMP WORD listexpr /* foo(@args) */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, $3, scalar($2))); + token_getmad($1,$$,'o'); + } + | LOOPEX /* loop exiting command (goto, last, dump, etc) */ + { $$ = newOP(($1)->tk_lval.ival, OPf_SPECIAL); + PL_hints |= HINT_BLOCK_SCOPE; + token_getmad($1,$$,'o'); + } + | LOOPEX term + { $$ = newLOOPEX(($1)->tk_lval.ival,$2); + token_getmad($1,$$,'o'); + } + | NOTOP argexpr /* not $foo */ + { $$ = newUNOP(OP_NOT, 0, scalar($2)); + token_getmad($1,$$,'o'); + } + | UNIOP /* Unary op, $_ implied */ + { $$ = newOP(($1)->tk_lval.ival, 0); + token_getmad($1,$$,'o'); + } + | UNIOP block /* eval { foo }, I *think* */ + { $$ = newUNOP(($1)->tk_lval.ival, 0, $2); + token_getmad($1,$$,'o'); + } + | UNIOP term /* Unary op */ + { $$ = newUNOP(($1)->tk_lval.ival, 0, $2); + token_getmad($1,$$,'o'); + } + | UNIOPSUB term /* Sub treated as unop */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + append_elem(OP_LIST, $2, scalar($1))); + } + | FUNC0 /* Nullary operator */ + { $$ = newOP(($1)->tk_lval.ival, 0); + token_getmad($1,$$,'o'); + } + | FUNC0 '(' ')' + { $$ = newOP(($1)->tk_lval.ival, 0); + token_getmad($1,$$,'o'); + token_getmad($2,$$,'('); + token_getmad($3,$$,')'); + } + | FUNC0SUB /* Sub treated as nullop */ + { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, + scalar($1)); } + | FUNC1 '(' ')' /* not () */ + { $$ = newOP(($1)->tk_lval.ival, OPf_SPECIAL); + token_getmad($1,$$,'o'); + token_getmad($2,$$,'('); + token_getmad($3,$$,')'); + } + | FUNC1 '(' expr ')' /* not($foo) */ + { $$ = newUNOP(($1)->tk_lval.ival, 0, $3); + token_getmad($1,$$,'o'); + token_getmad($2,$$,'('); + token_getmad($4,$$,')'); + } + | PMFUNC '(' argexpr ')' /* m//, s///, tr/// */ + { $$ = pmruntime($1, $3, 1); + token_getmad($2,$$,'('); + token_getmad($4,$$,')'); + } + | WORD + | listop + ; + +/* "my" declarations, with optional attributes */ +myattrterm: MY myterm myattrlist + { $$ = my_attrs($2,$3); + token_getmad($1,$$,'d'); + append_madprops($3->op_madprop, $$, 'a'); + $3->op_madprop = 0; + } + | MY myterm + { $$ = localize($2,($1)->tk_lval.ival); + token_getmad($1,$$,'d'); + } + ; + +/* Things that can be "my"'d */ +myterm : '(' expr ')' + { $$ = sawparens($2); + token_getmad($1,$$,'('); + token_getmad($3,$$,')'); + } + | '(' ')' + { $$ = sawparens(newNULLLIST()); + token_getmad($1,$$,'('); + token_getmad($2,$$,')'); + } + | scalar %prec '(' + { $$ = $1; } + | hsh %prec '(' + { $$ = $1; } + | ary %prec '(' + { $$ = $1; } + ; + +/* Basic list expressions */ +listexpr: /* NULL */ %prec PREC_LOW + { $$ = Nullop; } + | argexpr %prec PREC_LOW + { $$ = $1; } + ; + +listexprcom: /* NULL */ + { $$ = Nullop; } + | expr + { $$ = $1; } + | expr ',' + { OP* op = newNULLLIST(); + token_getmad($2,op,','); + $$ = append_elem(OP_LIST, $1, op); + } + ; + +/* A little bit of trickery to make "for my $foo (@bar)" actually be + lexical */ +my_scalar: scalar + { PL_in_my = 0; $$ = my($1); } + ; + +amper : '&' indirob + { $$ = newCVREF(($1)->tk_lval.ival,$2); + token_getmad($1,$$,'&'); + } + ; + +scalar : '$' indirob + { $$ = newSVREF($2); + token_getmad($1,$$,'$'); + } + ; + +ary : '@' indirob + { $$ = newAVREF($2); + token_getmad($1,$$,'@'); + } + ; + +hsh : '%' indirob + { $$ = newHVREF($2); + token_getmad($1,$$,'%'); + } + ; + +arylen : DOLSHARP indirob + { $$ = newAVREF($2); + token_getmad($1,$$,'l'); + } + ; + +star : '*' indirob + { $$ = newGVREF(0,$2); + token_getmad($1,$$,'*'); + } + ; + +/* Indirect objects */ +indirob : WORD + { $$ = scalar($1); } + | scalar %prec PREC_LOW + { $$ = scalar($1); } + | block + { $$ = scope($1); } + + | PRIVATEREF + { $$ = $1; } + ; diff --git a/perly.c b/perly.c index 03d0599..18f8606 100644 --- a/perly.c +++ b/perly.c @@ -297,8 +297,8 @@ Perl_yyparse (pTHX) int yylen; #ifdef PERL_MAD - /*if (PL_madskills) - return madparse();*/ + if (PL_madskills) + return madparse(); #endif YYDPRINTF ((Perl_debug_log, "Starting parse\n")); @@ -409,7 +409,7 @@ Perl_yyparse (pTHX) if (yychar == YYEMPTY) { YYDPRINTF ((Perl_debug_log, "Reading a token: ")); #ifdef PERL_MAD - yychar = /*PL_madskills ? madlex() :*/ yylex(); + yychar = PL_madskills ? madlex() : yylex(); #else yychar = yylex(); #endif diff --git a/proto.h b/proto.h index e5819ab..5208f6f 100644 --- a/proto.h +++ b/proto.h @@ -4369,6 +4369,7 @@ STATIC void S_start_force(pTHX_ int where); STATIC void S_curmad(pTHX_ char slot, SV *sv); # endif PERL_CALLCONV int Perl_madlex(pTHX); +PERL_CALLCONV int Perl_madparse(pTHX); #endif END_EXTERN_C diff --git a/regen_madly.pl b/regen_madly.pl new file mode 100755 index 0000000..e871699 --- /dev/null +++ b/regen_madly.pl @@ -0,0 +1,186 @@ +#!/usr/bin/perl +# +# regen_madly.pl, DAPM 12-Feb-04 +# +# Copyright (c) 2004, 2005 Larry Wall +# +# Given an input file madly.y, run bison on it and produce +# the following output files: +# +# madly.h standard bison header file with minor doctoring of +# #line directives plus adding a #ifdef PERL_CORE +# +# madly.tab the parser table C definitions extracted from the bison output +# +# madly.act the action case statements extracted from the bison output +# +# Note that madly.c is *not* regenerated - this is now a static file which +# is not dependent on madly.y any more. +# +# If a filename of the form foo.y is given on the command line, then +# this is used instead as the basename for all the files mentioned +# above. +# +# Note that temporary files of the form madlytmp.h and madlytmp.c are +# created and then deleted during this process +# +# Note also that this script is intended to be run on a UNIX system; +# it may work elsewhere but no specific attempt has been made to make it +# portable. + +sub usage { die "usage: $0 [ -b bison_executable ] [ file.y ]\n" } + +use warnings; +use strict; + +my $bison = 'bison'; + +if (@ARGV >= 2 and $ARGV[0] eq '-b') { + shift; + $bison = shift; +} + +my $y_file = shift || 'madly.y'; + +usage unless @ARGV==0 && $y_file =~ /\.y$/; + +(my $h_file = $y_file) =~ s/\.y$/.h/; +(my $act_file = $y_file) =~ s/\.y$/.act/; +(my $tab_file = $y_file) =~ s/\.y$/.tab/; +(my $tmpc_file = $y_file) =~ s/\.y$/tmp.c/; +(my $tmph_file = $y_file) =~ s/\.y$/tmp.h/; + +# the yytranslate[] table generated by bison is ASCII/EBCDIC sensitive + +die "$0: must be run on an ASCII system\n" unless ord 'A' == 65; + +# check for correct version number. The constraints are: +# * must be >= 1.24 to avoid licensing issues. +# * it must generate the yystos[] table. Version 1.28 doesn't generate +# this; 1.35+ does +# * Must produce output which is extractable by the regexes below +# * Must produce the right values. +# These last two contstraints may well be met by earlier versions, but +# I simply haven't tested them yet. If it works for you, then modify +# the test below to allow that version too. DAPM Feb 04. + +my $version = `$bison -V`; +unless ($version =~ /\b(1\.875[a-z]?|2\.[01])\b/) { die <; } +die "failed to read $tmpc_file: length mismatch\n" + unless length $clines == -s $tmpc_file; +close CTMPFILE; + +my ($actlines, $tablines) = extract($clines); + +chmod 0644, $act_file; +open ACTFILE, ">$act_file" or die "can't open $act_file: $!\n"; +print ACTFILE $actlines; +close ACTFILE; +chmod 0444, $act_file; + +chmod 0644, $tab_file; +open TABFILE, ">$tab_file" or die "can't open $tab_file: $!\n"; +print TABFILE $tablines; +close TABFILE; +chmod 0444, $tab_file; + +unlink $tmpc_file; + +# Wrap PERL_CORE round the symbol definitions. Also, the +# C<#line 123 "madlytmp.h"> gets picked up by make depend, so change it. + +open TMPH_FILE, $tmph_file or die "Can't open $tmph_file: $!\n"; +chmod 0644, $h_file; +open H_FILE, ">$h_file" or die "Can't open $h_file: $!\n"; +my $endcore_done = 0; +while () { + print H_FILE "#ifdef PERL_CORE\n" if $. == 1; + if (!$endcore_done and /YYSTYPE_IS_DECLARED/) { + print H_FILE "#endif /* PERL_CORE */\n"; + $endcore_done = 1; + } + s/"madlytmp.h"/"madly.h"/; + print H_FILE $_; +} +close TMPH_FILE; +close H_FILE; +chmod 0444, $h_file; +unlink $tmph_file; + +print "rebuilt: $h_file $tab_file $act_file\n"; + +exit 0; + + +sub extract { + my $clines = shift; + my $tablines; + my $actlines; + + $clines =~ m@ + (?: + ^/* YYFINAL[^\n]+\n #optional comment + )? + \# \s* define \s* YYFINAL # first #define + .*? # other defines + most tables + yystos\[\]\s*= # start of last table + .*? + }\s*; # end of last table + @xms + or die "Can't extract tables from $tmpc_file\n"; + $tablines = $&; + + + $clines =~ m@ + switch \s* \( \s* \w+ \s* \) \s* { \s* + ( + case \s* \d+ \s* : \s* + \#line [^\n]+"madly\.y" + .*? + ) + } + \s* + ( \s* /\* .*? \*/ \s* )* # optional C-comments + \s* + ( + \#line[^\n]+\.c" + | + \#line[^\n]+\.simple" + ) + @xms + or die "Can't extract actions from $tmpc_file\n"; + $actlines = $1; + + return $actlines. "\n", $tablines. "\n"; +} + +sub my_system { + system(@_); + if ($? == -1) { + die "failed to execute comamnd '@_': $!\n"; + } + elsif ($? & 127) { + die sprintf "command '@_' died with signal %d\n", + ($? & 127); + } + elsif ($? >> 8) { + die sprintf "command '@_' exited with value %d\n", $? >> 8; + } +}