CSV parser, quotes?

Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Thu, 31 Jul 2003 10:28:08 +0100

> In attempting to improve the CSV parser based on comments, I have the 
> following code that's attached. I'm having a heck of a time getting the 
> double quotes = an escaped quote thing to work. There is some commented out 
> code which was my last attempt. As it stands the code works, minus the 
> escaped quotes. Remove the comments and it just hangs.

I haven't looked at the code, but it occurs to me that the issue may
be to do with lookahead.  If you're in a quoted string, then "" means
a quote character in the string, but ", or "\n or "<EOF> mean end of
cell.  You can't tell which is which until you read the final
character; specifically, you can't tell if the string has ended until
you read the newline or EOF at the end of the line.

Does that help?

--KW 8-)