[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Patch for parsing dates and time

From: Maarten van Beek
Subject: Re: [Help-smalltalk] Patch for parsing dates and time
Date: Mon, 23 Jul 2012 22:24:56 +0200

The attached patch accepts negative dates and doesn't use position:
anymore. I've removed the test cases that weren't possible to succeed
because of this. This includes some test cases for DateTime, where
DateTime skips over all separators to see if there's any usable
content left. These separators are thrown away.

Maarten van Beek

On Mon, Jul 23, 2012 at 4:57 PM, Paolo Bonzini <address@hidden> wrote:
> Il 23/07/2012 15:47, Maarten van Beek ha scritto:
>> Indeed I didn't realise negative dates where possible I thought it was
>> an error. I'll fix that. However the following code shows the bug:
>>         stream := '2011-02-01abcd' readStream.
>>         date := Date readFrom: stream.
>>         result := stream upToEnd.
>>         result printNl.
>> The suffix to the date is abcd, so after parsing the date the stream
>> should still contain abcd. However result only holds 'bcd'. This is
>> not tested in the current test cases. Time, Duration and DateTime have
>> the same bug.
> Ok, thanks.
>> Not being able to use position: is a problem though. When parsing this
>> time for example: '09:00::1234' you should read 09:00 as time and
>> leave ::1234 in the stream, but you have to look ahead 2 characters to
>> notice this.
> I think it's safe to consider this example ill-formed, and not care
> about it.
> Paolo

Attachment: dates.patch2
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]