develooper Front page | perl.perl6.language | Postings from May 2005

Re: C<::> in rules

Thread Previous | Thread Next
Jonathan Scott Duff
May 12, 2005 10:34
Re: C<::> in rules
Message ID:
On Thu, May 12, 2005 at 12:53:46PM -0400, Aaron Sherman wrote:
> On Thu, 2005-05-12 at 10:33, Patrick R. Michaud wrote:
> > Next on my list, S05 says "It is illegal to use :: outside of 
> > an alternation", but A05 has
> > 
> >     /[:w::foo bar]/
> I can't even figure out what that means. :w turns on word mode
> (lexically scoped per S05) and "::" is a group-level commit. What are we
> committing exactly? Looks like a noop to me, which actually might not be
> so bad. However, you're right: this is an error as there are no
> alternations.

I think the definition of :: needs to be changed slightly.  You even
used a phrase that isn't exactly true according to spec but would be
if :: meant what I think it should mean.   That phrase is ":: is a
group-level commit".  This isn't how I read S05 (and apparently how
you and others read it as well, hence your comment to Pm that there
are no alternations).  S05 says:

        Backtracking over a double colon causes the surrounding group of
        alternations to immediately fail:

I think it should simply read:

        Backtracking over a double colon causes the surrounding group to
        immediately fail:

In other words, the phrase "of alternations" is a red herring.

> > which leads me to believe that :: isn't illegal here even though there's
> > no alternation.  I'd like to strike that sentence from S05.
> I don't think it should be removed. You can always use ::: if that's
> what you wanted.

I too think it should be stricken.

> >     /[:w\bfoo bar]/    # not exactly the same as above
> No, I think that's exactly the same.

What does \b mean again?  I assume it's no longer backspace?

> > So, now then, on to the item that got me here in the first place.
> > The upshot of all of the above is that 
> > 
> >     rx :w /foo bar/
> > 
> > is not equivalent to
> > 
> >     rx /:w::foo bar/
> If we feel strongly, it could be special-cased, but your <null> solution
> seems fine to me.

If :: were to fail the surrounding group we can say that a rule
without [] or () is an implicit group for :: purposes.

Jonathan Scott Duff

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About