for in D versus C and C++
Georg Wrede
georg.wrede at iki.fi
Mon Mar 23 11:28:42 PDT 2009
Walter Bright wrote:
> Sean Kelly wrote:
>> I've found that once I created one lexer it could be re-used pretty
>> easily for other languages too. And recursive descent parsers are
>> trivial to write. It may be overkill for command-line parameters, but
>> for anything remotely structured it's generally worth using.
>
> When I was looking into parsing date strings, I thought it would be much
> easier if I adopted a lex/parse style approach. The result is in
> std.dateparse. The payoff is I've had very little trouble with it.
Ah, seems you can't parse dates in Nepal.
Read dateparse.d, and found this in line 81:
if (
year == year.init ||
(month < 1 || month > 12) ||
(day < 1 || day > 31) ||
(hours < 0 || hours > 23) ||
(minutes < 0 || minutes > 59) ||
(seconds < 0 || seconds > 59) ||
(tzcorrection != int.min &&
((tzcorrection < -2300 || tzcorrection > 2300) ||
(tzcorrection % 10)))
)
The last line here causes timezones that are not at full 10 minutes, to
fail.
Kathmandu, Nepal is UTC+5:45, according to Wikipedia TimeZone.
More information about the Digitalmars-d
mailing list