Parsing nested constructs

2007-09-08 Thread tool69
Hi, I need to parse some source with nested parenthesis, like this : cut- { {item1} { {item2} {item3} } } cut- In fact I'd like to get all start indexes of items and their end (or lenght). I know regexps are rather limited for this type

Re: Parsing nested constructs

2007-09-08 Thread David
On 9/8/07, tool69 [EMAIL PROTECTED] wrote: Hi, I need to parse some source with nested parenthesis, like this : If this is exactly how your data looks, then how about a loop which searches for {item and the following }? You can use the find string method for that. Otherwise, if the items

Re: Parsing nested constructs

2007-09-08 Thread tool69
David a écrit : On 9/8/07, tool69 [EMAIL PROTECTED] wrote: Hi, I need to parse some source with nested parenthesis, like this : If this is exactly how your data looks, then how about a loop which searches for {item and the following }? You can use the find string method for that.

Re: Parsing nested constructs

2007-09-08 Thread Paul McGuire
On Sep 8, 3:42 pm, tool69 [EMAIL PROTECTED] wrote: Hi, I need to parse some source with nested parenthesis, like this : cut- { {item1} { {item2} {item3} } } cut- In fact I'd like to get all start indexes of items and their end

Re: Parsing nested constructs

2007-09-08 Thread Wildemar Wildenburger
Paul McGuire wrote: Well, it is an external module, but pyparsing makes this pretty straightforward: [snip delightful parsing] Again pyparsing to the rescue :) I have to do a parsing project in Java right now and I dearly miss pyparsing. I explained it to the guy I'm working for, and he

Re: Parsing nested constructs

2007-09-08 Thread Paul McGuire
On Sep 8, 10:01 pm, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Again pyparsing to the rescue :) I have to do a parsing project in Java right now and I dearly miss pyparsing. I explained it to the guy I'm working for, and he was pretty impressed. Thought that might make you smile. /W