[ragel-users] Parsing date strings
ragel-user at jgoettgens.de
ragel-user at jgoettgens.de
Thu Aug 11 14:15:32 UTC 2011
Hi Luis,
my Maya colleague next door believes that "-3456781203" refers to a date in
December instead of May. Could he be right?
Given the fixed format of your date strings, the question is not really
whether you can scan it with Ragel (or flex, or what else), but whether such
a tool is the right tool to do that. Somehow you always need to extract the
last 2+2 chars and validate them, but this essentially makes you going
backwards in your machine (or using further memory) which is not within the
realm of a "pure" FSM (http://en.wikipedia.org/wiki/Finite_state_machine).
However, Ragel allows you to easily add the necessary "counting".
It depends on how you get your date strings whether using Ragel is benficial
or not. If you have just isolated strings (i.e. the entire string, so you
know where it ends) it probably doesn't. If you need to extract the date
from a stream of other tokens that can easily described by a FSM, then it
will.
jg
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list