Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Ben Bennett
I know you can mix them, but I would prefer to match completely since as I said there is a decent speed win. The fact that multiple formats can match is irrelevant here (that is dealt with when filtering by type). It might be useful to someone to be able to get the parts of the given string back

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Joshua Hoblitt
On Wed, 25 Jun 2003, Ben Bennett wrote: > All true... but my benchmarking as I wrote my ISO8601 showed that the > speed gained by pre-filtering by length to reduce the number of > regexps that need to be tried is substantial. You can mix length with no-length specrefs. > The other thing that my

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Ben Bennett
All true... but my benchmarking as I wrote my ISO8601 showed that the speed gained by pre-filtering by length to reduce the number of regexps that need to be tried is substantial. I will have to look into the dispatch stuff... The other thing that my ISO8601 parser does is (optionally) return the

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Joshua Hoblitt
On Wed, 25 Jun 2003, Ben Bennett wrote: > On Wed, Jun 25, 2003 at 06:53:10PM +1000, Iain Truskett wrote: > > * Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 17:59]: > > > > > But what if I use /(-?\d\d\d\d)/ as the regex and set the > > > length => [ qw( 4 5 ) ]? :) > > > > cvs update > > > > Yo

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Iain Truskett
* Ben Bennett ([EMAIL PROTECTED]) [25 Jun 2003 23:06]: > On Wed, Jun 25, 2003 at 06:53:10PM +1000, Iain Truskett wrote: > > * Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 17:59]: > > > > > But what if I use /(-?\d\d\d\d)/ as the regex and set the > > > length => [ qw( 4 5 ) ]? :) > > > > cvs u

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Ben Bennett
On Wed, Jun 25, 2003 at 06:53:10PM +1000, Iain Truskett wrote: > * Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 17:59]: > > > But what if I use /(-?\d\d\d\d)/ as the regex and set the > > length => [ qw( 4 5 ) ]? :) > > cvs update > > Your wish is my small patch. While you are fiddling with

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Iain Truskett
* Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 19:51]: > Jaw drops... > > Your wish is my small patch. > I seem to have stumbled onto a new programming paradigm. I > partially think through half baked design concepts then > Iain not only throughly cooks my ideas he writes all the > code. This

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Joshua Hoblitt
Jaw drops... > Your wish is my small patch. I seem to have stumbled onto a new programming paradigm. I partially think through half baked design concepts then Iain not only throughly cooks my ideas he writes all the code. This is called Extreme Spoon Programming (xSp) - look for my upcoming

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Iain Truskett
* Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 17:59]: > > If something is of a static length, use lengths. > Say I have the years 2003 and -2003. In order to use > static lengths I need to have two separate regexs, > /(-\d\d\d\d)/ and /(\d\d\d\d)/. If I have a lot of rules > that need to match

Re: DT::F::Builder multiple identical lengths

2003-06-25 Thread Joshua Hoblitt
> If something is of a static length, use lengths. Say I have the years 2003 and -2003. In order to use static lengths I need to have two separate regexs, /(-\d\d\d\d)/ and /(\d\d\d\d)/. If I have a lot of rules that need to match both negative and positive years group tags can cut the worst c

Re: DT::F::Builder multiple identical lengths

2003-06-24 Thread Iain Truskett
* Joshua Hoblitt ([EMAIL PROTECTED]) [25 Jun 2003 16:05]: > > I've just checked some experimental code into CVS. Take > > a read of t/dispatch.t and > > lib/DateTime/Format/Builder/Parser/Dispatch.pm (damn > > these paths are getting long). > > > > Something like that? > Wow - Yes. The idea came

Re: DT::F::Builder multiple identical lengths

2003-06-24 Thread Joshua Hoblitt
> I've just checked some experimental code into CVS. Take a read of > t/dispatch.t and lib/DateTime/Format/Builder/Parser/Dispatch.pm (damn > these paths are getting long). > > Something like that? Wow - Yes. The possibility for recursion is just Evil{TM}. I'm really really impressed with the

Re: DT::F::Builder multiple identical lengths

2003-06-24 Thread Iain Truskett
* Joshua Hoblitt ([EMAIL PROTECTED]) [22 Jun 2003 15:17]: [...] > [...] (this is directly related to my drooling over > the DISPATCH method in p6. :) It goes something like this: In > addition to a "label" a "group" tag can be assigned. If a parser is > passed a key called, for example, DISPATC