Re: regex args and interpolation

2002-09-06 Thread Nicholas Clark
On Fri, Sep 06, 2002 at 02:49:13PM +0100, Piers Cawley wrote: > Nicholas Clark <[EMAIL PROTECTED]> writes: > > This idea of just switching language syntax in a context-sensitive way is > > trying to make my head explode. > > But you mean that in a good way right? Anyway, he did introduce the Ye

Re: regex args and interpolation

2002-09-06 Thread Mark J. Reed
On Fri, Sep 06, 2002 at 02:34:52PM +0100, Nicholas Clark wrote: > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: > > What is really needed is something that converts the date syntax > > to normal Perl code: > > > >rule iso_date { () - > >() - > >

Re: regex args and interpolation

2002-09-06 Thread Piers Cawley
Nicholas Clark <[EMAIL PROTECTED]> writes: > On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote: >> Nicholas Clark <[EMAIL PROTECTED]> writes: >> >> > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: >> >> What is really needed is something that converts the date syntax >> >> t

Re: regex args and interpolation

2002-09-06 Thread Nicholas Clark
On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote: > Nicholas Clark <[EMAIL PROTECTED]> writes: > > > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: > >> What is really needed is something that converts the date syntax > >> to normal Perl code: > >> > >>rule iso_date { (

Re: regex args and interpolation

2002-09-06 Thread Piers Cawley
Nicholas Clark <[EMAIL PROTECTED]> writes: > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: >> What is really needed is something that converts the date syntax >> to normal Perl code: >> >>rule iso_date { () - >>() - >>() >>

Re: regex args and interpolation

2002-09-06 Thread Nicholas Clark
On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: > What is really needed is something that converts the date syntax > to normal Perl code: > >rule iso_date { () - >() - >() >{ use grammar Perl::AbstractSyntax; >

Re: regex args and interpolation

2002-09-05 Thread Aaron Sherman
On Wed, 2002-09-04 at 22:46, Ken Fox wrote: >rule iso_date { $year:=(\d{4}) - >$month:=(\d{2}) - >$day:=(\d{2}) } You mean C<< \d<4> >>, etc. I presume.

Re: regex args and interpolation

2002-09-04 Thread Ken Fox
David Whipp wrote: > But can I use a non-constant date? You didn't show us the iso_date rule. > Obviously we could put the onus on the module writer to write super-flexible > rules/grammars. But will there be an easy way to force interpolative context > onto this type of regex-valued subroutine

regex args and interpolation

2002-09-04 Thread David Whipp
In Perl5, I might write: sub set_date { my ($self, $date) = @_; $date =~ /(\d{4})-(\d{2})-(\d{2})/ or croak "bad date format"; @$self{qw/year month day/} = ($1,$2,$3); } I could then call: $foo->set_date('2002-09-04') In Perl6 I can write: sub set_date ( $date is rx/