New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: list slices to the end #12981
Comments
From @epaCreated by @epaSometimes you want to slice a list from some index to the end. my @end_part = @a[ 1 .. $#a ]; But this becomes more difficult when the list is an intermediate my @end_part = @a[ 1 .. ]; Here only the left part of the '..' is given and the end of the my @start_part = @a[ .. 5 ]; If overloading the .. operator in this way is too yucky, you Perl Info
|
From j.imrie1@virginmedia.comOn 21/05/2013 15:15, Ed Avis (via RT) wrote:
As we have removed $# can we use it for the end of the current list now. my @end_part = @a[ 1 .. $# ]; Thus making $# the number of elements in the current list. John |
The RT System itself - Status changed from 'new' to 'open' |
From @rjbsFor the record, I am open to a patch to provide this kind of change, and am not -- |
From @cpansproutOn Sun Jun 09 06:55:59 2013, perl.p5p@rjbs.manxome.org wrote:
Of the two suggestions, I think $# is best. If list and array slices That would make all three of these work: # Omit the first element Do we want that? As for the [1..] suggestion, would that be a postfix .. operator applied -- Father Chrysostomos |
From @epaIn the @a[1..] form I envisaged that 1.. would be syntax valid only inside list slices - not adding a .. postfix operator to the language in general. (Similarly the $# proposal adds a variable valid only inside list slices.) How about going with the ______________________________________________________________________ |
From @druud62On 21/05/2013 16:15, Ed Avis wrote:
Or support negative indexes inside slicers: my @end_part = @a[ 1 .. _(-1) ]; (the _() to express topical run time action) Or a topical $# alias, like $_#. my @end_part = @a[ 1 .. $_# ]; -- |
From @davidnicolOn Sun, Jul 7, 2013 at 1:51 AM, Dr.Ruud <rvtol+usenet@isolution.nl> wrote:
since negative numbers already represent counting from the end of an array, a magical $# clearly allows the most flexibility -- there's no way to my @right_half = @a[ (0.5 + is that really an improvement over my @right_half = @a[ (0.5 + ? having a magic variable that is localized in this new way will be tricky, Allowing a malformed range operation, like C< 3 .. -2 >, within slicing if the range operator when appearing inside a slice stops being just an my %Ns = %Phonebook{ 'N' .. 'NZZZ' }; # might resolve to one SELECT call dln |
From @ikegamiOn Sat, Jul 6, 2013 at 8:36 PM, Father Chrysostomos via RT <
Small note: Right now, the index expression is evaluated before the list |
From @druud62On 08/07/2013 07:00, David Nicol wrote:
Well sure, but it 'calls' _(), so I meant no actual negative number -- |
From @cpansproutOn Mon Jul 08 06:43:06 2013, ikegami@adaelis.com wrote:
Of course, I had forgotten about that. I should know, considering that $ ./perl -Ilib -MO=Concise,CORE::__PACKAGE__ -e0 I was not sure whether I was entirely comfortable with the proposed -- Father Chrysostomos |
From @davidnicolOn Mon, Jul 8, 2013 at 3:45 PM, Father Chrysostomos via RT <
it isn't possible to recognize range-in-slice-indices at parse time and this is what's in perly.y | ary '[' expr ']' /* array slice */ so I'm talking about adding something like this | ary '[' term DOTDOT term ']' /* array before that, and creating OP_ASLICE_RANGE. which might mean making a second "expr" that doesn't include DOTDOT in its |
From j.imrie1@virginmedia.comOn 08/07/2013 19:41, Dr.Ruud wrote:
Isn't _() all ready a valid sub call, being as $_, @_ and _ (the default John |
From @cpansproutOn Mon Jul 08 14:20:45 2013, davidnicol@gmail.com wrote:
If that is to apply to list slices as well, then it would mean slight I don’t feel comfortable with that at all. -- Father Chrysostomos |
From @davidnicolOn Mon, Jul 8, 2013 at 8:00 PM, Father Chrysostomos via RT <
The change in undocumented evaluation order is required for a $ perl -wle 'sub A { print "A"; 0..9 } sub L { print "L"; 2 } sub R { print With a new operator solution, there is no reason for the evaluation order I don't know all the tools available within the blocks emitted by perly.y. Are you saying that we currently lack a framework for invoking a new Surely you aren't. |
From @rjbs* John Imrie <j.imrie1@virginmedia.com> [2013-07-08T18:43:25]
Yes, and it's occasionally used because of its package-transcending property: package X { sub _ { warn "called by " . caller; } } -- |
From @ap* John Imrie <j.imrie1@virginmedia.com> [2013-07-09 00:45]:
You think so? :-) -- |
From @druud62On 09/07/2013 00:43, John Imrie wrote:
Nobody is married to the _() looks. It is about the topicalizing. For a scalar topicalizer, maybe pick $_(). -- |
From @epaAdding a variant of DOTDOT that works only inside list slices is tricky for the reasons Fr C. suggests. -- ______________________________________________________________________ |
From @cpansproutOn Mon Jul 08 19:20:00 2013, davidnicol@gmail.com wrote:
OK, I misunderstood. Yes, if the .. is part of the slice operator ( a )[ b..c, d.., e..] but no parentheses allowed around the [d..]. -- Father Chrysostomos |
From @cpansproutOn Tue Jul 09 01:44:34 2013, eda@waniasset.com wrote:
I don’t know Python. Could you summarise its slices? -- Father Chrysostomos |
From @epahttp://stackoverflow.com/questions/509211/the-python-slice-notation summarizes Python's list slices. a[start:end] # items start through end-1 So the current @a[ 1 .. $#a ] would become @a[ 1 : ] Admittedly in perl, writing scalar(@a) for the number of elements in the array is more typing than $#a -- ______________________________________________________________________ |
From @cpansproutOn Tue Jul 09 04:42:42 2013, sprout wrote:
But low-precedence operators like ‘or’ and ‘and’ complicate things ( a )[$b or $c..] Having the lexer and parser treat postfix .. as a special operator that But then branch folding will change the meaning in cases like this: ( a )[$0 or $2..] # compile-time error -- Father Chrysostomos |
From @davidnicolTLDR: David Nicol openly and cheerfully struggles with concepts of yacc On Tue, Jul 9, 2013 at 10:31 AM, Father Chrysostomos via RT <
Python's range operator implies the starting 0 or the ending -1. Perl's
I'm imagining the rangey slice only happening when the rangey slice syntax
if a new clause in perly.y will work, then so will three new clauses, one How do we guard against [ a .. b , c .. d ] triggering the new syntax? It range_slice_expression: term DOTDOT term range_slice_expression: range_slice_expression ',' ary '[' range_slice_expression ']' I don't think it can be made to work without more than one token of @array[ !( should match '[' expr ']' and not match '[' term DOTDOT term ']' because the token after the second notted modulo term is a hook, not a but to realize this, the parser must maintain ambiguity for longer than one And that leaves, examining the emitted expression tree of the slice indices |
From aaron@priven.comHmm. @a[qs/new slice syntax, whatever it is/] Then the syntax doesn't get evaluated until the slicing actually happens. (Personally I like inclusive ranges.) -- -- |
From tchrist@perl.com
What a curious way to spell "ABSTRACT"! :)
--tom |
From @cpansproutWe seem to be talking past each other somewhat.... But this On Tue Jul 09 12:55:04 2013, davidnicol@gmail.com wrote:
I think it *would* be a problem. It would be too surprising. (I know,
I don’t see why we need special handling for [ term .. term ], since it Having a special rule for parsing [ term .. ] rules out things like [
The only thing we need special handling for is postfix C<..>. If we The op.c can weed out illegal uses of it in finalize_op. -- Father Chrysostomos |
From @cpansproutOn Tue Jul 09 21:27:33 2013, sprout wrote:
Additionally, (foo)[substr $bar,0,1, .. 5] is already valid syntax. -- Father Chrysostomos |
From @davidnicolOn Tue, Jul 9, 2013 at 11:27 PM, Father Chrysostomos via RT <
Yes indeed, starting with different visions of the goal.
The ending index is also always known: it's -1. If we're implying -1 to The only thing we need special handling for is postfix C<..>. If we
so you wouldn't support @some = @array[ 0 .. -3 ] as a clearer way of writing splice @some = @array, -2; Instead of slicing to the end when the RHS of DOTDOT is empty, I envision What if the DOTDOT operator produces a "range object" that can be treated start is non-negative when all three of those are true, the range object accesses the target And then, the TIEARRAY and TIEHASH interfaces can get more complicated, by |
From @davidnicolOn Wed, Jul 10, 2013 at 12:00 AM, David Nicol <davidnicol@gmail.com> wrote:
such as, a sparse array could return existing elements only, when sliced |
From @cpansproutOn Tue Jul 09 22:01:01 2013, davidnicol@gmail.com wrote:
No, not for that reason. Forget Python. :-) But because it is
I was going to say ‘Definitely not’, but then, as I started to explain That is perhaps not such a bad idea, but for backward compatibility it With that, we don’t even need open-ended ranges, so we don’t have to If this range syntax only works that way directly inside a slice (not as
If slices can propagate ‘range context’ to their operands the way other
Yes, that all works out nicely.
Stop it! You’re making my head spin! -- Father Chrysostomos |
From aaron@priven.comHow would new slicing syntax work with object methods and other times you'd want to pass a slice specification to a sub? I can see how you could redefine stuff inside @a[in_here], but not $obj->slice(in_here). Obviously if it's just an accessor you can do (@{$obj->elements})(slice), but if something else happens in the method that doesn't work. -- |
From @davidnicolOn Wed, Jul 10, 2013 at 7:03 PM, Aaron Priven <aaron@priven.com> wrote:
It wouldn't. That's another fine argument against introducing situational If ranges were to defer their expansion as long as possible, a range such |
From aaron@priven.comOn Wed, Jul 10, 2013 at 7:03 PM, Aaron Priven <aaron@priven.com> wrote: On Jul 10, 2013, at 5:41 PM, David Nicol wrote:
Yes, this is what I meant by suggesting a new slice syntax with a quote-like operator. So: @ary[qs/slice syntax goes here/] or $obj->slice(qs/slice syntax goes here/) And it would become a slice object of some sort or other, that would not be processed until the slice actually occurred. Like regex syntax, it could have basically nothing to do with regular perl syntax. (I had this whole idea of using Set::IntSpan objects before realizing that negative numbers mean something completely different to Set::IntSpan. Still, there's something about using hyphens instead of dots for ranges that appeals to me) Of course, [qs/3-/] probably wouldn't satisfy people looking to make [3..] work. I'm not sure how to introduce it more succinctly given the paucity of ASCII characters. @a:[3-5] ? With Unicode we could have @a⁅3-5⁆ or something. Or perhaps none of this makes any sense at all. -- |
From @ap* Aaron Priven <aaron@priven.com> [2013-07-11 08:20]:
C.f. List::Maker maybe. -- |
From @cpansproutI started to implement two of the suggestions in this ticket, but then -- Father Chrysostomos |
From @cpansproutOn Wed Jul 10 23:17:35 2013, aaron@priven.com wrote:
I started to implement [1..] and found myself liking your idea more and A CPAN module could provide a function that allows slice(@array, Anyway, my unfinished work is on the sprout/slice branch. -- Father Chrysostomos |
From @cpansproutOn Mon Aug 19 07:30:09 2013, sprout wrote:
And also attached, but without the perly.* regenerated. Including the -- Father Chrysostomos |
From @cpansproutFrom b3fb563 Mon Sep 17 00:00:00 2001 Only array slices (not list slices) are handled so far, and they are buggy: Inline Patchdiff --git a/embed.h b/embed.h
index d89782f..51cd616 100644
--- a/embed.h
+++ b/embed.h
@@ -1056,6 +1056,7 @@
#define ck_sassign(a) Perl_ck_sassign(aTHX_ a)
#define ck_select(a) Perl_ck_select(aTHX_ a)
#define ck_shift(a) Perl_ck_shift(aTHX_ a)
+#define ck_slice(a) Perl_ck_slice(aTHX_ a)
#define ck_smartmatch(a) Perl_ck_smartmatch(aTHX_ a)
#define ck_sort(a) Perl_ck_sort(aTHX_ a)
#define ck_spair(a) Perl_ck_spair(aTHX_ a)
diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm
index f71e700..7593117 100644
--- a/ext/Opcode/Opcode.pm
+++ b/ext/Opcode/Opcode.pm
@@ -6,7 +6,7 @@ use strict;
our($VERSION, @ISA, @EXPORT_OK);
-$VERSION = "1.25";
+$VERSION = "1.26";
use Carp;
use Exporter ();
@@ -350,7 +350,7 @@ These memory related ops are not included in :base_core because they
can easily be used to implement a resource attack (e.g., consume all
available memory).
- concat repeat join range
+ concat repeat join range postdotdot
anonlist anonhash
diff --git a/op.c b/op.c
index fd8868f..83d3e1d 100644
--- a/op.c
+++ b/op.c
@@ -1752,7 +1752,7 @@ S_finalize_op(pTHX_ OP* o)
/* Relocate sv to the pad for thread safety.
* Despite being a "constant", the SV is written to,
* for reference counts, sv_upgrade() etc. */
- if (cSVOPo->op_sv) {
+ if (cSVOPo->op_sv && cSVOPo->op_sv != &PL_sv_placeholder) {
const PADOFFSET ix = pad_alloc(OP_CONST, SVf_READONLY);
if (o->op_type != OP_METHOD_NAMED
&& cSVOPo->op_sv == &PL_sv_undef) {
@@ -1881,6 +1881,8 @@ S_finalize_op(pTHX_ OP* o)
break;
}
+ case OP_POSTDOTDOT: Perl_croak(aTHX_ "Postfix .. outside of slice");
+
case OP_SUBST: {
if (cPMOPo->op_pmreplrootu.op_pmreplroot)
finalize_op(cPMOPo->op_pmreplrootu.op_pmreplroot);
@@ -9603,6 +9605,28 @@ Perl_ck_shift(pTHX_ OP *o)
}
OP *
+Perl_ck_slice(pTHX_ OP *o)
+{
+ dVAR;
+ OP *kid;
+
+ PERL_ARGS_ASSERT_CK_SLICE;
+
+ kid = cBINOPo->op_first;
+ if (kid->op_type != OP_PUSHMARK && kid->op_flags & OPf_KIDS)
+ kid = kUNOP->op_first;
+
+ for (kid = kid->op_sibling; kid; kid = kid->op_sibling) {
+ if (kid->op_type == OP_POSTDOTDOT) {
+ kid->op_type = OP_CONST;
+ kid->op_ppaddr = PL_ppaddr[OP_CONST];
+ }
+ }
+
+ return o;
+}
+
+OP *
Perl_ck_sort(pTHX_ OP *o)
{
dVAR;
diff --git a/opcode.h b/opcode.h
index 540dc0b..c159e1a 100644
--- a/opcode.h
+++ b/opcode.h
@@ -142,6 +142,7 @@
#define Perl_pp_custom Perl_unimplemented_op
#define Perl_pp_reach Perl_pp_rkeys
#define Perl_pp_rvalues Perl_pp_rkeys
+#define Perl_pp_postdotdot Perl_unimplemented_op
START_EXTERN_C
#ifndef DOINIT
@@ -525,6 +526,7 @@ EXTCONST char* const PL_op_name[] = {
"introcv",
"clonecv",
"padrange",
+ "postdotdot",
"freed",
};
#endif
@@ -910,6 +912,7 @@ EXTCONST char* const PL_op_desc[] = {
"private subroutine",
"private subroutine",
"list of private variables",
+ "postfix .. in slice",
"freed op",
};
#endif
@@ -1309,6 +1312,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
Perl_pp_introcv,
Perl_pp_clonecv,
Perl_pp_padrange,
+ Perl_pp_postdotdot, /* implemented by Perl_unimplemented_op */
}
#endif
#ifdef PERL_PPADDR_INITED
@@ -1458,7 +1462,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
Perl_ck_null, /* aelemfast */
Perl_ck_null, /* aelemfast_lex */
Perl_ck_null, /* aelem */
- Perl_ck_null, /* aslice */
+ Perl_ck_slice, /* aslice */
Perl_ck_each, /* aeach */
Perl_ck_each, /* akeys */
Perl_ck_each, /* avalues */
@@ -1475,7 +1479,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
Perl_ck_split, /* split */
Perl_ck_join, /* join */
Perl_ck_null, /* list */
- Perl_ck_null, /* lslice */
+ Perl_ck_slice, /* lslice */
Perl_ck_fun, /* anonlist */
Perl_ck_fun, /* anonhash */
Perl_ck_fun, /* splice */
@@ -1704,6 +1708,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
Perl_ck_null, /* introcv */
Perl_ck_null, /* clonecv */
Perl_ck_null, /* padrange */
+ Perl_ck_null, /* postdotdot */
}
#endif
#ifdef PERL_CHECK_INITED
@@ -2093,6 +2098,7 @@ EXTCONST U32 PL_opargs[] = {
0x00000040, /* introcv */
0x00000040, /* clonecv */
0x00000040, /* padrange */
+ 0x00000600, /* postdotdot */
};
#endif
diff --git a/opnames.h b/opnames.h
index 5502ba4..9ef8118 100644
--- a/opnames.h
+++ b/opnames.h
@@ -391,10 +391,11 @@ typedef enum opcode {
OP_INTROCV = 374,
OP_CLONECV = 375,
OP_PADRANGE = 376,
+ OP_POSTDOTDOT = 377,
OP_max
} opcode;
-#define MAXO 377
+#define MAXO 378
#define OP_FREED MAXO
/* the OP_IS_* macros are optimized to a simple range check because
diff --git a/perly.y b/perly.y
index 0f98f59..1c99024 100644
--- a/perly.y
+++ b/perly.y
@@ -80,7 +80,7 @@
%token <i_tkval> FORMAT SUB ANONSUB PACKAGE USE
%token <i_tkval> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
%token <i_tkval> GIVEN WHEN DEFAULT
-%token <i_tkval> LOOPEX DOTDOT YADAYADA
+%token <i_tkval> LOOPEX DOTDOT YADAYADA POSTDOTDOT
%token <i_tkval> FUNC0 FUNC1 FUNC UNIOP LSTOP
%token <i_tkval> RELOP EQOP MULOP ADDOP
%token <i_tkval> DOLSHARP DO HASHBRACK NOAMP
@@ -111,7 +111,7 @@
%left <i_tkval> ','
%right <i_tkval> ASSIGNOP
%right <i_tkval> '?' ':'
-%nonassoc DOTDOT YADAYADA
+%nonassoc DOTDOT YADAYADA POSTDOTDOT
%left <i_tkval> OROR DORDOR
%left <i_tkval> ANDAND
%left <i_tkval> BITOROP
@@ -1001,6 +1001,13 @@ termbinop: term ASSIGNOP term /* $x = $y */
token_getmad($2,(OP*)op,'o');
});
}
+ | term POSTDOTDOT /* $x.. in slice */
+ {
+ $$ = op_append_elem(OP_LIST,scalar($1),
+ newSVOP(OP_POSTDOTDOT, 0,
+ &PL_sv_placeholder));
+ TOKEN_GETMAD($2,$$,'o');
+ }
| term ANDAND term /* $x && $y */
{ $$ = newLOGOP(OP_AND, 0, $1, $3);
TOKEN_GETMAD($2,$$,'o');
diff --git a/pp.c b/pp.c
index b61192d..9a95850 100644
--- a/pp.c
+++ b/pp.c
@@ -4296,6 +4296,7 @@ PP(pp_aslice)
if (SvTYPE(av) == SVt_PVAV) {
const bool localizing = PL_op->op_private & OPpLVAL_INTRO;
bool can_preserve = FALSE;
+ SV **dst = MARK;
if (localizing) {
MAGIC *mg;
@@ -4317,8 +4318,26 @@ PP(pp_aslice)
}
while (++MARK <= SP) {
+ I32 elem = SvIV(*MARK);
+ I32 count;
+ if (MARK < SP && MARK[1] == &PL_sv_placeholder) {
+ count = AvFILL(av) - elem + 1;
+ if (count < 0) count = 0;
+ else if (count > 1) {
+ I32 off = MARK - PL_stack_base;
+ I32 doff = dst - PL_stack_base;
+ EXTEND(SP, count-1);
+ MARK = PL_stack_base + off;
+ dst = PL_stack_base + doff;
+ Move(MARK, MARK+count-1, SP-MARK+1, SV *);
+ SP += count-1;
+ MARK += count-1;
+ }
+ MARK++; /* skip placeholder */
+ }
+ else count = 1;
+ while (count) {
SV **svp;
- I32 elem = SvIV(*MARK);
bool preeminent = TRUE;
if (localizing && can_preserve) {
@@ -4340,8 +4359,12 @@ PP(pp_aslice)
SAVEADELETE(av, elem);
}
}
- *MARK = svp ? *svp : &PL_sv_undef;
+ *++dst = svp ? *svp : &PL_sv_undef;
+
+ count--, elem++;
+ }
}
+ SP = dst;
}
if (GIMME != G_ARRAY) {
MARK = ORIGMARK;
diff --git a/proto.h b/proto.h
index e027627..600031b 100644
--- a/proto.h
+++ b/proto.h
@@ -580,6 +580,12 @@ PERL_CALLCONV OP * Perl_ck_shift(pTHX_ OP *o)
#define PERL_ARGS_ASSERT_CK_SHIFT \
assert(o)
+PERL_CALLCONV OP * Perl_ck_slice(pTHX_ OP *o)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_CK_SLICE \
+ assert(o)
+
PERL_CALLCONV OP * Perl_ck_smartmatch(pTHX_ OP *o)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
diff --git a/regen/opcode.pl b/regen/opcode.pl
index a081c64..69f013a 100755
--- a/regen/opcode.pl
+++ b/regen/opcode.pl
@@ -67,7 +67,8 @@ my %alias;
# Format is "this function" => "does these op names"
my @raw_alias = (
Perl_do_kv => [qw( keys values )],
- Perl_unimplemented_op => [qw(padany mapstart custom)],
+ Perl_unimplemented_op => [qw(padany mapstart custom
+ postdotdot)],
# All the ops with a body of { return NORMAL; }
Perl_pp_null => [qw(scalar regcmaybe lineseq scope)],
diff --git a/regen/opcodes b/regen/opcodes
index 9c86d69..61d69b0 100644
--- a/regen/opcodes
+++ b/regen/opcodes
@@ -216,7 +216,7 @@ rv2av array dereference ck_rvconst dt1
aelemfast constant array element ck_null s$ A S
aelemfast_lex constant lexical array element ck_null d0 A S
aelem array element ck_null s2 A S
-aslice array slice ck_null m@ A L
+aslice array slice ck_slice m@ A L
aeach each on array ck_each % A
akeys keys on array ck_each t% A
@@ -243,7 +243,7 @@ join join or string ck_join mst@ S L
# List operators.
list list ck_null m@ L
-lslice list slice ck_null 2 H L L
+lslice list slice ck_slice 2 H L L
anonlist anonymous list ([]) ck_fun ms@ L
anonhash anonymous hash ({}) ck_fun ms@ L
@@ -551,3 +551,4 @@ padcv private subroutine ck_null d0
introcv private subroutine ck_null d0
clonecv private subroutine ck_null d0
padrange list of private variables ck_null d0
+postdotdot postfix .. in slice ck_null $
diff --git a/toke.c b/toke.c
index 4f3eee9..339eb16 100644
--- a/toke.c
+++ b/toke.c
@@ -377,6 +377,7 @@ static struct debug_tokens {
{ PLUGSTMT, TOKENTYPE_OPVAL, "PLUGSTMT" },
{ PMFUNC, TOKENTYPE_OPVAL, "PMFUNC" },
{ POSTDEC, TOKENTYPE_NONE, "POSTDEC" },
+ { POSTDOTDOT, TOKENTYPE_NONE, "POSTDOTDOT" },
{ POSTINC, TOKENTYPE_NONE, "POSTINC" },
{ POWOP, TOKENTYPE_OPNUM, "POWOP" },
{ PREDEC, TOKENTYPE_NONE, "PREDEC" },
@@ -6776,7 +6777,13 @@ Perl_yylex(pTHX)
pl_yylval.ival = OPf_SPECIAL;
}
else
+ {
+ char * const s2 = skipspace(s);
+ if (*s2 == ',' || *s2 == ']'
+ || (*s2 == '=' && s2[1] == '>'))
+ OPERATOR(POSTDOTDOT);
pl_yylval.ival = 0;
+ }
OPERATOR(DOTDOT);
}
if (*s == '=' && !PL_lex_allbrackets && |
From @epaThanks for your work on this. -- |
From @cpansproutOn Mon Aug 19 07:30:09 2013, sprout wrote:
The reason I posted this is that I’m not sure whether it would be Is there enough support for this that it would be worthwhile to continue -- Father Chrysostomos |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
I'd also prefer to see it on CPAN in some form than to further complicate -zefram |
Migrated from rt.perl.org#118089 (status was 'open')
Searchable as RT118089$
The text was updated successfully, but these errors were encountered: