[ragel-users] Parsing date strings
ragel-user at jgoettgens.de
ragel-user at jgoettgens.de
Thu Aug 11 14:41:38 UTC 2011
Can you give a somewhat comprehensive example?
Anyway, you have to do the following steps once you start scanning a date
string:
(1) push all elements (at this point you are just scanning a signed integer)
onto a stack, possibly recognizing bogus characters (but not the correct day
and month chars (because you need to have the end of the string to do that))
(2) at the end of the string (not just a valid final state), start to pop
the elements and check them semantically for correctness:
(first 2 pops: day, next 2 pops: month, rest: year)
How you do that depends a bit on the characteristics of your stream
(essentially how easy it is do detect when going out of the "date machine").
I hope this helps.
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