[antlr-interest] Parsing fields in a CSV file

Andy Tripp antlr at jazillian.com
Wed Mar 11 10:03:26 PDT 2009


Rick Schumeyer wrote:

> Another alternative, which sounds crazy but I'll ask anyway, is to write 
> a separate parser that only parses the above date/time field, and call 
> that parser from within the rule that receives the timestamp field. 

I think that's actually the easiest way: let ANTLR's lexer just see the
whole date as a single string, and then parse the date into individual
fields separately. You could do that with another ANTLR parser, "by hand",
or (if using Java) use the DateFormat class and its parse() method.

Andy


More information about the antlr-interest mailing list