[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: lpeg brain melt
From:       "Harold Hausman" <hhausman () gmail ! com>
Date:       2008-05-31 14:49:46
Message-ID: cc092b6c0805310749t43b1d527w748e433acdae78c3 () mail ! gmail ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic