On Fri, 7 Jun 2002, Damian Conway wrote:

> Brent Dax wrote:
> 
> > grammar Perl6::Regex {
> >   rule metachar { <[<{(\[\])}>:*+?\\|]>                    }
> > 
> >   rule ws       { [<[\h\v]>|\#\N*]*                        }
> 
> Or just:
> 
>     rule ws       { [\s|\#\N*]*                              }

Just as a practical matter, given that you tend to have runs of
whitespace,

    rule ws       { [ \s+ | \#\N* ]*                           }

will probably run faster.   At least, that would certainly run
faster with Perl 5's engine.  Can't speak for Perl 6's, of course.

As a different kind of practical matter, if we put spaces around
our square brackets and vertical bars, it won't look so much like
a character class.  I know we're all from the old school, but we
should therefore be even more alert against excessive regex
compaction.

Larry

Reply via email to