In
commit a5467733bdab87210a4eae6d3af309a0c3041c87
I think it is a bug that these differ
rule TOP { ^ <tok> }
rule TOP {^ <tok> }
If I'm far from right, let me know so I
won't waste folks time.
Thank you for rakudo.
Be well,
rir
> > I think it is a bug that these differ
> > rule TOP { ^ <tok> }
> > rule TOP {^ <tok> }
> It actually conforms the current spec. Each consecutive run of
> whitespace is replaced by a call to <.ws>. So the first rule is
> equivalent to
> token TOP { <.ws> ^ <.ws> <tok> <.ws> }
>
> When there is leading whitespace in the string, the first <.ws> matches,
> and ^ fails. Since there's no backtracking in a token, the match fails.
> I agree that that it's not obvious or intuitive, but rakudo should only
> special-case it if the spec says so.
Thanks for the reply, I'll be slower to submit bugs.
I get your point. I think the spec may be open to other interpretations
though:
^ and $ now always match the start/end of a string,
How can even a zero-width atom ever match before the start of a string?
What are we matching against?
I think whitespace before a leading/trailing ^/$ needs to be discounted.
Dwimmery and elegance demand.
It is foul if the "formalization" of matching leads us to
rule TOP {
: my $dog = "Magic";
^ <matchme>
}
needing to be
rule TOP {
: my $dog = "Magic";^
<matchme>
}
Either way, the spec needs to be clarified.
Moritz, I appreciate the time you have taken with me. I'm more or less
at 5.005 regarding regexes, so some of the Perl5 refs in the synopses are
not so helpful to me. I'm am excited by grammars; they change
the mentation of matching.
On Perlmonks, I have found your answers satisfying but was disappointed
that we seem to be a party of two (at least there is an audience). I feel
that I could wear you out with my questions. I like Perlmonks, but could
move to another site.
Be well,
rir
A good thing about perlmonks is that your audience is likely to grow,
and those posts will be referenced by future perl6-ers.