summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2022-06-27 21:21:22 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2022-06-28 10:52:33 +0100
commitb179236d59d4d0be43d9307d30b9e97609c9f96d (patch)
treea0f5a47df38fde36becb67dbc8aa0985792de804 /perly.y
parent1e45e087ebebb524df3c2247e485d7d6aebcd6f0 (diff)
downloadperl-b179236d59d4d0be43d9307d30b9e97609c9f96d.tar.gz
Rename some grammar rules/tokens to avoid 'method'
These token names are shared between perl.y and toke.c, to communicate on the nature of various tokens parsed from perl source. The name FUNCMETH used to refer to a method call with possible arguments ->NAME(...) whereas METHOD referred to one without even the parens ->NAME These names are a little confusing, and most importantly, METHOD was in the way of my adding a new `method` keyword as part of the upcoming work on 'use feature "class"'. As such, this simple rename moves them out of the way and makes them slightly more consistent and easier to read/remember, by calling them METHCALL and METHCALL0. This commit also renames the `method` grammar rule to `methodname`, for similar reasons. As all of these names are entirely internal to the tokenizer/parser, there is not expected to be any upstream CPAN incompatibility, or other issues, caused by these renames.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y22
1 files changed, 11 insertions, 11 deletions
diff --git a/perly.y b/perly.y
index db1daf7747..5b6ff930fa 100644
--- a/perly.y
+++ b/perly.y
@@ -62,7 +62,7 @@
%token <ival> PERLY_SNAIL
%token <ival> PERLY_STAR
-%token <opval> BAREWORD METHOD FUNCMETH THING PMFUNC PRIVATEREF QWLIST
+%token <opval> BAREWORD METHCALL0 METHCALL THING PMFUNC PRIVATEREF QWLIST
%token <opval> FUNC0OP FUNC0SUB UNIOPSUB LSTOPSUB
%token <opval> PLUGEXPR PLUGSTMT
%token <opval> LABEL
@@ -91,7 +91,7 @@
%type <opval> empty
%type <opval> sliceme kvslice gelem
%type <opval> listexpr nexpr texpr iexpr mexpr mnexpr
-%type <opval> optlistexpr optexpr optrepl indirob listop method
+%type <opval> optlistexpr optexpr optrepl indirob listop methodname
%type <opval> formname subname proto cont my_scalar my_var
%type <opval> list_of_scalars my_list_of_scalars refgen_topic formblock
%type <opval> subattrlist myattrlist myattrterm myterm
@@ -980,28 +980,28 @@ listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */
{ $$ = op_convert_list($FUNC, OPf_STACKED,
op_prepend_elem(OP_LIST, newGVREF($FUNC,$indirob), $expr) );
}
- | term ARROW method PERLY_PAREN_OPEN optexpr PERLY_PAREN_CLOSE /* $foo->bar(list) */
+ | term ARROW methodname PERLY_PAREN_OPEN optexpr PERLY_PAREN_CLOSE /* $foo->bar(list) */
{ $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, scalar($term), $optexpr),
- newMETHOP(OP_METHOD, 0, $method)));
+ newMETHOP(OP_METHOD, 0, $methodname)));
}
- | term ARROW method /* $foo->bar */
+ | term ARROW methodname /* $foo->bar */
{ $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST, scalar($term),
- newMETHOP(OP_METHOD, 0, $method)));
+ newMETHOP(OP_METHOD, 0, $methodname)));
}
- | METHOD indirob optlistexpr /* new Class @args */
+ | METHCALL0 indirob optlistexpr /* new Class @args */
{ $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, $indirob, $optlistexpr),
- newMETHOP(OP_METHOD, 0, $METHOD)));
+ newMETHOP(OP_METHOD, 0, $METHCALL0)));
}
- | FUNCMETH indirob PERLY_PAREN_OPEN optexpr PERLY_PAREN_CLOSE /* method $object (@args) */
+ | METHCALL indirob PERLY_PAREN_OPEN optexpr PERLY_PAREN_CLOSE /* method $object (@args) */
{ $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, $indirob, $optexpr),
- newMETHOP(OP_METHOD, 0, $FUNCMETH)));
+ newMETHOP(OP_METHOD, 0, $METHCALL)));
}
| LSTOP optlistexpr /* print @args */
{ $$ = op_convert_list($LSTOP, 0, $optlistexpr); }
@@ -1020,7 +1020,7 @@ listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */
;
/* Names of methods. May use $object->$methodname */
-method : METHOD
+methodname: METHCALL0
| scalar
;