diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-06-19 07:05:07 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-06-19 07:05:07 +0000 |
commit | ecb2f33519ba533cbb8a58944ee243527071ea13 (patch) | |
tree | 59ef33361b8a4ecf54084ee80064e597b9c0ca52 /perly.y | |
parent | 7ebe66711f181a6c6324b370c9025726bf5c8381 (diff) | |
download | perl-ecb2f33519ba533cbb8a58944ee243527071ea13.tar.gz |
Perly.y and related file fixes to keep mainframe yacc (and bison) happy.
p4raw-id: //depot/perl@10707
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -83,7 +83,7 @@ static void yydestruct(pTHXo_ void *ptr); %token COLONATTR %type <ival> prog decl format startsub startanonsub startformsub -%type <ival> remember mremember '&' +%type <ival> progstart remember mremember '&' %type <opval> block mblock lineseq line loop cond else %type <opval> expr term subscripted scalar ary hsh arylen star amper sideff %type <opval> argexpr nexpr texpr iexpr mexpr mnexpr mtexpr miexpr @@ -126,15 +126,9 @@ static void yydestruct(pTHXo_ void *ptr); %% /* RULES */ /* The whole program */ -prog : /* NULL */ - { -#if defined(YYDEBUG) && defined(DEBUGGING) - yydebug = (DEBUG_p_TEST); -#endif - PL_expect = XSTATE; $$ = block_start(TRUE); - } +prog : progstart /*CONTINUED*/ lineseq - { newPROG(block_end($1,$2)); } + { $$ = $1; newPROG(block_end($1,$2)); } ; /* An ordinary block */ @@ -148,6 +142,16 @@ remember: /* NULL */ /* start a full lexical scope */ { $$ = block_start(TRUE); } ; +progstart: + { +#if defined(YYDEBUG) && defined(DEBUGGING) + yydebug = (DEBUG_p_TEST); +#endif + PL_expect = XSTATE; $$ = block_start(TRUE); + } + ; + + mblock : '{' mremember lineseq '}' { if (PL_copline > (line_t)$1) PL_copline = $1; @@ -456,7 +460,7 @@ listop : LSTOP indirob argexpr /* print $fh @args */ { $$ = convert($1, 0, $2); } | FUNC '(' listexprcom ')' /* print (@args) */ { $$ = convert($1, 0, $3); } - | LSTOPSUB startanonsub block /* map { foo } ... */ + | LSTOPSUB startanonsub block /* map { foo } ... */ { $3 = newANONATTRSUB($2, 0, Nullop, $3); } listexpr %prec LSTOP /* ... @bar */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, @@ -575,7 +579,7 @@ anonymous: '[' expr ']' | '[' ']' { $$ = newANONLIST(Nullop); } | HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */ - { $$ = newANONHASH($2); } + { $$ = newANONHASH($2); } | HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */ { $$ = newANONHASH(Nullop); } | ANONSUB startanonsub proto subattrlist block %prec '(' @@ -666,7 +670,7 @@ term : termbinop { $$ = $1; } | amper /* &foo; */ { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); } - | amper '(' ')' /* &foo() */ + | amper '(' ')' /* &foo() */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); } | amper '(' expr ')' /* &foo(@args) */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |