Skip to content
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

$/ constructed just once in [REGEX] #4596

Closed
p6rt opened this issue Oct 2, 2015 · 6 comments
Closed

$/ constructed just once in [REGEX] #4596

p6rt opened this issue Oct 2, 2015 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Oct 2, 2015

Migrated from rt.perl.org#126249 (status was 'resolved')

Searchable as RT126249$

@p6rt
Copy link
Author

p6rt commented Oct 2, 2015

From @ShimmerFairy

$ perl6 -e 'my token foo { foo { say $/.to } }; "foo" ~~ /<foo>/'
3
$ perl6 -e 'my token foo { {} foo { say $/.to } }; "foo" ~~ /<foo>/'
0

It seems that $/ is constructed only in the first code block of a regex, and not reconstructed for subsequent blocks. Compare to $¢, which reports the right position in any case​:

$ perl6 -e 'my token foo { foo { say $¢.pos } }; "foo" ~~ /<foo>/'
3
$ perl6 -e 'my token foo { {} foo { say $¢.pos } }; "foo" ~~ /<foo>/'
3

Note that trying to construct a Match from the Cursor doesn't work around the issue​:

$ perl6 -e 'my token foo { {} foo { say $¢.MATCH.to } }; "foo" ~~ /<foo>/'
0

@p6rt
Copy link
Author

p6rt commented Sep 21, 2016

From @smls

This bug is still present in​:

  Rakudo version 2016.09-21-g3ed51de built on MoarVM version 2016.09
  implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Sep 21, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 31, 2017

From @smls

This has been fixed by TimToday in April, in one of these commits​:

  https://gist.github.com/Whateverable/23122ebe34ebeccfdfc3cd04845c54f4
  https://gist.github.com/smls/aff6a56c1cfcce5c7779251aee394e42

Tests needed.

@p6rt
Copy link
Author

p6rt commented Sep 21, 2017

From @zoffixznet

Tests added​: Raku/roast@c8a7565a68

@p6rt
Copy link
Author

p6rt commented Sep 21, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 21, 2017
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant