[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Need lpeg hint
- From: Peter Cawley <lua@...>
- Date: Sat, 13 Aug 2011 20:36:35 +0100
On Sat, Aug 13, 2011 at 8:18 PM, Martin Kortmann <mail@kortmann.de> wrote:
> Hello all,
>
> I'm trying to learn the usage of lpeg and i need a push to the right direction on the following problem:
>
> I will parse files with the following structure:
>
> blockname1 {
> key1 value1
> key2 value2
> blockname2 {
> key3 value3
> blockname3 {
> key4 value4
> }
> key5 value5
> }
> }
>
> there are named blocks of datas, the datas are several key/value pairs or other named blocks of datas. Seem simple, but i don't get a right grammar for this syntax.
> Can someone give me a start for this?
>
> Thanks Martin
Very quickly thrown together, but seems to work for your example:
http://codepad.org/z49J4o8z