Hi everybody,

I came around ragel and read the user guide, which I understood only partly (I'm not having CS as background ;-)

I would like to write a parser for iso 8601 date, duration and recurrence strings. As we are related to climate science the dates
which needs to be handled aren't the once everybody has done.

I didn't manage to solve my problem and wnat to kindly ask everybody around here, having more experience, for help.

The first thing I have is parsing simple dates:

- something like 20340203 (3rd of February 2034) for example
  is no real problem
- -3456781203 in contrast is (3rd of May of the year -345678,
  proleptic Gregorian)

I'd like to use the same expr for both strings.

iso_year = ('-'? . digit+) >tag_iso_year;
iso_month = ('0' . [1-9] | '1' . [0-2]) >tag_iso_month;
iso_day = ('0' . [1-9] | [12] . [0-9] | '3' . [01]) >tag_iso_day;

iso_date = (iso_year . iso_month . iso_day) %set_iso_date;

Now iso 8601 is providing en extended format containg hyphens between the components:

iso_date_extended = (iso_year . '-' . iso_month . '-' . iso_day)

How can I manage the transparent handling in one machine.

The last issue is that I didn't understood error handling. It would be great to have something like a pointer to the point in the string, where parsing failed ...

The whole code is supposed to be C.

Thanks in advance for any kind of help,
Luis

--
                             \\\\\\
                             (-0^0-)
--------------------------oOO--(_)--OOo-----------------------------

 Luis Kornblueh                           Tel. : +49-40-41173289
 Max-Planck-Institute for Meteorology     Fax. : +49-40-41173298
 Bundesstr. 53
 D-20146 Hamburg                   Email: [email protected]
 Federal Republic of Germany

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to