In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/09b1cffef8cddfec3f726ac733cd648d5b6c28c6?hp=aa93e3ab0fc02f21191620115a7249537d740cd6>
- Log ----------------------------------------------------------------- commit 09b1cffef8cddfec3f726ac733cd648d5b6c28c6 Author: Zefram <[email protected]> Date: Sat Dec 11 20:38:16 2010 +0000 rename some grammar productions for clarity Some of the names for types of expression were misleading. Rename "listexpr"->"optlistexpr", "listexprcom"->"optexpr", and "argexpr"->"listexpr" to make them more accurately descriptive and more consistent. ----------------------------------------------------------------------- Summary of changes: perly.tab | 4 ++-- perly.y | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/perly.tab b/perly.tab index 1df760e..22d8413 100644 --- a/perly.tab +++ b/perly.tab @@ -219,9 +219,9 @@ static const char *const yytname[] = "@7", "@8", "sideff", "else", "cont", "mintro", "nexpr", "texpr", "iexpr", "mexpr", "mnexpr", "miexpr", "label", "formname", "startsub", "startanonsub", "startformsub", "subname", "proto", "subattrlist", - "myattrlist", "subbody", "expr", "argexpr", "listop", "@9", "method", + "myattrlist", "subbody", "expr", "listexpr", "listop", "@9", "method", "subscripted", "termbinop", "termunop", "anonymous", "termdo", "term", - "myattrterm", "myterm", "listexpr", "listexprcom", "lpar_or_qw", "@10", + "myattrterm", "myterm", "optlistexpr", "optexpr", "lpar_or_qw", "@10", "my_scalar", "amper", "scalar", "ary", "hsh", "arylen", "star", "indirob", 0 }; diff --git a/perly.y b/perly.y index ab14627..5ebee60 100644 --- a/perly.y +++ b/perly.y @@ -96,8 +96,8 @@ %type <opval> stmtseq fullstmt barestmt block mblock else %type <opval> expr term subscripted scalar ary hsh arylen star amper sideff -%type <opval> argexpr nexpr texpr iexpr mexpr mnexpr miexpr -%type <opval> listexpr listexprcom indirob listop method +%type <opval> listexpr nexpr texpr iexpr mexpr mnexpr miexpr +%type <opval> optlistexpr optexpr indirob listop method %type <opval> formname subname proto subbody cont my_scalar %type <opval> subattrlist myattrlist myattrterm myterm %type <opval> termbinop termunop anonymous termdo @@ -152,7 +152,7 @@ grammar : GRAMPROG { parser->expect = XTERM; } - listexprcom + optexpr { PL_eval_root = $3; $$ = 0; @@ -335,7 +335,7 @@ barestmt: PLUGSTMT } | USE startsub { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ } - WORD WORD listexpr ';' + WORD WORD optlistexpr ';' { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD @@ -695,11 +695,11 @@ expr : expr ANDOP expr { $$ = newLOGOP(OP_DOR, 0, $1, $3); TOKEN_GETMAD($2,$$,'o'); } - | argexpr %prec PREC_LOW + | listexpr %prec PREC_LOW ; /* Expressions are a list of terms joined by commas */ -argexpr : argexpr ',' +listexpr: listexpr ',' { #ifdef MAD OP* op = newNULLLIST(); @@ -709,7 +709,7 @@ argexpr : argexpr ',' $$ = $1; #endif } - | argexpr ',' term + | listexpr ',' term { OP* term = $3; DO_MAD( @@ -722,7 +722,7 @@ argexpr : argexpr ',' ; /* List operators */ -listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ +listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */ { $$ = convert(IVAL($1), OPf_STACKED, op_prepend_elem(OP_LIST, newGVREF(IVAL($1),$2), $3) ); TOKEN_GETMAD($1,$$,'o'); @@ -734,7 +734,7 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($5,$$,')'); } - | term ARROW method lpar_or_qw listexprcom ')' /* $foo->bar(list) */ + | term ARROW method lpar_or_qw optexpr ')' /* $foo->bar(list) */ { $$ = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, scalar($1), $5), @@ -749,13 +749,13 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ newUNOP(OP_METHOD, 0, $3))); TOKEN_GETMAD($2,$$,'A'); } - | METHOD indirob listexpr /* new Class @args */ + | METHOD indirob optlistexpr /* new Class @args */ { $$ = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, $2, $3), newUNOP(OP_METHOD, 0, $1))); } - | FUNCMETH indirob '(' listexprcom ')' /* method $object (@args) */ + | FUNCMETH indirob '(' optexpr ')' /* method $object (@args) */ { $$ = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, $2, $4), @@ -763,11 +763,11 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ TOKEN_GETMAD($3,$$,'('); TOKEN_GETMAD($5,$$,')'); } - | LSTOP listexpr /* print @args */ + | LSTOP optlistexpr /* print @args */ { $$ = convert(IVAL($1), 0, $2); TOKEN_GETMAD($1,$$,'o'); } - | FUNC '(' listexprcom ')' /* print (@args) */ + | FUNC '(' optexpr ')' /* print (@args) */ { $$ = convert(IVAL($1), 0, $3); TOKEN_GETMAD($1,$$,'o'); TOKEN_GETMAD($2,$$,'('); @@ -776,7 +776,7 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ | LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */ { SvREFCNT_inc_simple_void(PL_compcv); $<opval>$ = newANONATTRSUB($2, 0, (OP*)NULL, $3); } - listexpr %prec LSTOP /* ... @bar */ + optlistexpr %prec LSTOP /* ... @bar */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, $<opval>4, $5), $1)); @@ -1181,7 +1181,7 @@ term : termbinop token_getmad($4,op,')'); }) } - | NOAMP WORD listexpr /* foo(@args) */ + | NOAMP WORD optlistexpr /* foo(@args) */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, $3, scalar($2))); TOKEN_GETMAD($1,$$,'o'); @@ -1195,7 +1195,7 @@ term : termbinop { $$ = newLOOPEX(IVAL($1),$2); TOKEN_GETMAD($1,$$,'o'); } - | NOTOP argexpr /* not $foo */ + | NOTOP listexpr /* not $foo */ { $$ = newUNOP(OP_NOT, 0, scalar($2)); TOKEN_GETMAD($1,$$,'o'); } @@ -1252,7 +1252,7 @@ term : termbinop TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($4,$$,')'); } - | PMFUNC '(' argexpr ')' /* m//, s///, tr/// */ + | PMFUNC '(' listexpr ')' /* m//, s///, tr/// */ { $$ = pmruntime($1, $3, 1); TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($4,$$,')'); @@ -1303,13 +1303,13 @@ myterm : '(' expr ')' ; /* Basic list expressions */ -listexpr: /* NULL */ %prec PREC_LOW +optlistexpr: /* NULL */ %prec PREC_LOW { $$ = (OP*)NULL; } - | argexpr %prec PREC_LOW + | listexpr %prec PREC_LOW { $$ = $1; } ; -listexprcom: /* NULL */ +optexpr: /* NULL */ { $$ = (OP*)NULL; } | expr { $$ = $1; } -- Perl5 Master Repository
