On Fri, Jun 11, 2010 at 02:16:28PM -0700, Moritz Lenz via RT wrote: > On Thu Jun 10 21:11:42 2010, rir...@comcast.net wrote:
> > 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