[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg question: parsing CSV
- From: "Duncan Cross" <duncan.cross@...>
- Date: Fri, 16 Nov 2007 23:52:13 +0000
On Nov 16, 2007 11:33 PM, Ken Smith <kgsmith@gmail.com> wrote:
> On Nov 16, 2007 1:04 PM, Duncan Cross <duncan.cross@gmail.com> wrote:
> > > In the second case, I expect to receive a table from the match but get
> > > only the first field as a string.
> >
> > You should use lpeg.Ct instead of lpeg.C for this.
>
> Thanks for the response. When I change
>
> lpeg.C((1 - lpeg.S',\n"')^0)
>
> to
>
> lpeg.Ct((1 - lpeg.S',\n"')^0)
>
> I get a table from record:match but the table is empty. Is this not
> what you meant?
Sorry, my fault, I misread - try putting lpeg.Ct( ... ) around the
following bit of record_lpeg, instead:
field * (',' * field)^0