On Thu, Aug 5, 2010 at 2:43 PM, Tyler Curtis <ekir...@gmail.com> wrote:

> On Thu, Aug 5, 2010 at 12:28 PM, Aaron Sherman <a...@ajs.com> wrote:
> > While that's a nifty special case (I'm sure it will surprise me someday,
> and
> > I'll spend a half hour debugging before I remember this mail), it doesn't
> > help in the general case (see my example grammar, below).
>
> In the general case, no. In the case of your grammar, and all
> grammars, it does help.
>
> All regex routines, when called standalone, are anchored to the
> beginning and end of the string. So, having "^" and "$" at the
> beginning and end of your TOP is a no-op unless some other rule calls
> it as a subrule.
>

There's something deeply disturbing to me in that... but I can't fully
express what it is. It just feels like I'm going to end up debugging
mountains of code, written by people who didn't understand that that was the
case.

Several times over the past few weeks, I've mentioned something on this list
only to find that, buried somewhere deep in a synopsis, there was a special
case I was unaware of.

The sheer volume of silent special cases in Perl 6 appears to be dwarfing
that of Perl 5, but perhaps that's just because I know Perl 5 far better
than I know Perl 6.

Mind you, I'm not complaining, so much as working out how I feel out
loud.... Am I the only one who feels this way at this point?



> :oneline or similar might be useful. I'm not sure about :rootedend and
> :rootedstart.


Are you saying that you can't think of examples of where you want to root a
regex only to the start or end, or that you just don't think you need an
adverb to do it? If the former, then I submit the 1536 examples of matching
only at the end of strings in my local Perl library (mostly for matching
whitespace or filename extensions it looks like) and the 3199 examples of
matching only at the start which includes headers of all types (RFC2822 and
friends, HTTP, CPAN configs, etc.), whitespace, command sequence matching
(e.g. /^GET /) and so on.

If the latter, then I guess you and I just have a different take, here, and
that's fine. I respect your opinion, but in this case, I happen to disagree.

PS: You can also search through any typical python install for "\.match"
which will yield quite a lot of additional examples. I don't know Ruby or
Java very well, or I'd go looking for examples there too.

-- 
Aaron Sherman
Email or GTalk: a...@ajs.com
http://www.ajs.com/~ajs

Reply via email to