lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Oct 30, 2008 at 9:37 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> In the definition for field that I use every day, where the value for
> field has this,
>
> lpeg.Cs(((lpeg.P(1) - '"') + lpeg.P'""' / '"')^0)
>
> I have lpeg.C instead of lpeg.Cs.  I don't remember why I did this but
> it seems to work either way.

The lpeg.Cs substitutes single quotes for double quotes, therefore
unescaping quotes. Try this example:

local ex1 = '"a ""field"" containing quotes",123,3.14,2.717'

Ah, thanks for the explanaation.  I've added the lpeg.Cs to my parser.

   Ken