Hi Mike

On 04/11/15 21:30, Mike Elston wrote:
Hi Ron,

As I said before in another message, your question is the result of confusion 
between /calendars/ and /names of months/.

There's no such thing as "German republican names" for months, any more than there are "German 
republican months" (or even "German months"). There are just the German names for the usual months that 
most of the Western world use, the months of the Julian and Gregorian calendars. Whereas the "French Republican 
names" are the names of the months of the French Republican calendar.

Thanx for the detail.

The above ("There's no such thing...") is the only thing that matters.

You used 'german_r_month' (orginally, below) and not 'german_month'.
That confused me.

It's a matter of what I put in the grammar, and I've gone with 'german_month' :-).

I just did not wish to find out one day that I needed both a german_month list and a german_r_month list! That would just mean an update, but rather worse would be if both existed but the only one I implemented had the 'wrong' name.

So, the French calendar escape is 'French r' or '@#dFrench r@', both case-insensitive.

Using 'French r' leaves 'French' free for later adoption.

And for German it is 'German' or '@#dGerman@', likewise case-insensitive.

And I /do/ realize the simple (@#d...@-free) versions will presumably not be compatible with other software.

[snip]

german_r_month  ~ 'jan' | 'feb' | 'mär' | 'maer' | 'mrz' | 'apr' | 'mai'
                | 'jun' | 'jul' | 'aug' | 'sep' | 'sept' | 'okt'
                | 'nov' | 'dez'

This gives me an opportunity for a progress report:

shell> prove -l t/
t/English.t .. ok
t/French.t ... ok
t/German.t ... ok
All tests successful.
Files=3, Tests=304, 2 wallclock secs ( 0.07 usr 0.00 sys + 1.96 cusr 0.03 csys = 2.06 CPU)
Result: PASS

The English tests use both Gregorian and Julian. The French and German tests mix their respective calendars with both Gregorian and Julian.

This means there are so far 304 pairs of input and output for you to study.

I'll do Hebrew today or tomorrow. After that, I'll release the module since the docs are 98% complete.

Now, from your other message:
> Ron, it might be helpful if you explained whether you are just aiming > for syntax checking or whether you intend to parse these dates and > > possibly convert them or do other calculations on them. For the > > > > former the concept of different calendars is relatively negligible, > > however for the latter it is a must.

The code parses dates, and accepts the Gedcom defined calendar escapes.

Gedcom mentions the German language but not the German calendar. Nevertheless, I have extended the grammar to accept German dates.

The output from the parse() method can be passed into the normalize() method which will reconstruct the date input, with various bits normalized. E.g. 'Int' or 'Interpreted' comes back as 'INT'.

As for calculations, you'll have to build up a date string from the output of parse() and pass that to DateTime (or whatever).

In Perl there is a perhaps-unfortunate plethora of date-oriented modules. My module's 'See Also' section lists a few, and has a set of links to various articles which mention many others (especially in the comments sections of the articles).

--
Ron Savage - savage.net.au

Reply via email to