From: Ian Jackson Subject: Re: [PATCH]: xl: don't segfault parsing disk configs, support NULL physpath and ioemu: Date: Thu, 19 Aug 2010 16:53:13 +0100 Message-ID: <19565.21353.200252.392736@mariner.uk.xensource.com> References: <1282228463.3731.27.camel@qabil.uk.xensource.com> <19565.17853.246902.357872@mariner.uk.xensource.com> <1282229882.3731.32.camel@qabil.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1282229882.3731.32.camel@qabil.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Gianni Tedesco (3P)" Cc: Kamala Narasimhan , Christoph Egger , Xen Devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Gianni Tedesco (3P) writes ("Re: [Xen-devel] [PATCH]: xl: don't segfault parsing disk configs, support NULL physpath and ioemu:"): > It's true that it's longer but the nature of these types of parsers it's > a lot of very short lines :) It adds 4164 characters and removes 1783. Discounting leading whitespace it adds 2550 characters and removes 1085. However you count it it's between 2x and 3x as long :-). I always think state machine based parsers are very hard to read by eye. That's why we have parser generators. > I think it's clearer than a correct strtok() + handling all errors and > variations would be. Perhaps so. > It's your call, I know nothing of flex and its mysterious ways and my > pcre skills are limited to basic text-editor-fu... I agree that flex > probably makes the most sense. I'll see if I can come up with a flex or pcre syntax that works and we can see what people think of it. > On the other hand whoever designed these formats seemed to want to make > them difficult to parse. Since it's all python I find myself wondering > why they didn't use a dictionary or a tuple. Just don't go there :-). Ian.