summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-12-11 20:38:16 +0000
committerZefram <zefram@fysh.org>2010-12-12 08:34:44 +0000
commit09b1cffef8cddfec3f726ac733cd648d5b6c28c6 (patch)
tree1592bd93f97b4bfba0b3f9751475acddff8888c7 /perly.y
parentaa93e3ab0fc02f21191620115a7249537d740cd6 (diff)
downloadperl-09b1cffef8cddfec3f726ac733cd648d5b6c28c6.tar.gz
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.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y40
1 files changed, 20 insertions, 20 deletions
diff --git a/perly.y b/perly.y
index ab146274ed..5ebee60ab8 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; }