define meaning of <prior> in S05 #5

Closed
coke opened this Issue Oct 21, 2011 · 1 comment

Projects

None yet

2 participants

@coke
Contributor
coke commented Oct 21, 2011

Originally opened as https://rt.perl.org/rt3/Ticket/Display.html?id=58290

Subject:    <prior> not implemented in rules in Rakudo
Date:   Sat, 23 Aug 2008 11:26:49 +0200
To: rakudobug@perl.org
From:   "Carl M?sak" <cmasak@gmail.com>
To match whatever the prior successful regex matched, use:

/ <prior> /

r30466:
$ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ /ll/' # works
ll
ll
$ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ / <prior> /'
# not implemented
ll
Unable to find regex 'prior'
Null PMC access in invoke()
[...]

This feature request is perhaps more accurately classified as
pertaining to PGE. Please re-tag as needed.

Subject:    Re: [perl #58290] <prior> not implemented in rules in Rakudo
Date:   Sat, 23 Aug 2008 08:16:43 -0500
To: perl6-compiler@perl.org
From:   "Patrick R. Michaud" <pmichaud@pobox.com>
On Sat, Aug 23, 2008 at 02:27:10AM -0700, Carl M?sak wrote:
> To match whatever the prior successful regex matched, use:
> 
> / <prior> /
> 
> r30466:
> $ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ /ll/' # works
> ll
> ll
> $ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ / <prior> /'
> # not implemented
> ll
> Unable to find regex 'prior'
> Null PMC access in invoke()
> [...]
> 
> This feature request is perhaps more accurately classified as
> pertaining to PGE. Please re-tag as needed.

...correct -- C<< <prior> >> is not yet implemented. I'm not
certain if it belongs in PGE or in Rakudo... I'm guessing that
<prior> needs to refer to the "prior successful regex" in a
statement-level context, as opposed to a regex context. For
example, if we interpret S05 literally then in the regex

/ <foo> <prior> /

it's pretty clear that C<< <foo> >> is the prior successful regex 
matched, and I think that's not what is intended by C<< <prior> >>.
(If it is what is intended, then C<< <prior> >> becomes much
simpler. :-)

Pm

RT-Send-CC: perl6-compiler@perl.org

I've changed this ticket to indicate that it's waiting on spec
clarification as to the exact meaning of <prior> in regexes.

Pm
@TimToady
Member

This relatively useless feature has now been removed (especially since it was never implemented as envisioned, to replace Perl 5's empty // construct, which reruns the original regex rather than matching the matched string).

@TimToady TimToady closed this Dec 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment