[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lpeg brain melt
- From: "Harold Hausman" <hhausman@...>
- Date: Sat, 31 May 2008 08:49:46 -0600
On Sat, May 31, 2008 at 1:26 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> gg = re.compile [[
>> Chunk <- ( <Word> <Space> )+ -> {}
>> Word <- { [a-d]+ }
>> Space <- { ( " " / "\n" )* }
>> ]]
>
> The escape sequence \n is not interpreted inside [[...]] strings. You
> should use the predefined pattern %nl instead.
>
Gotcha! ... Thank you, my parser is working now. :)
I don't know if other people will try escape sequences in the long
string compilation method, but it may be worth mentioning on this
page:
http://www.inf.puc-rio.br/~roberto/lpeg/re.html
That is the page I've been using as a reference/docs. Is that the best resource?
Also, on that page the CSV parser uses '\n' inside of [[...]] ... I
haven't tested that CSV parser example, but does that mean it would
fail?
Thanks again for your swift informative reply, and this lovely library.
Regards,
-Harold