From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 47234BC0A for ; Fri, 18 May 2007 10:42:32 +0200 (CEST) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4I8gTLJ010348 for ; Fri, 18 May 2007 10:42:31 +0200 X-IronPort-AV: E=Sophos;i="4.14,552,1170595800"; d="scan'208";a="130625493" Received: from ppp59-172.lns2.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.59.172]) by ipmail01.adl2.internode.on.net with ESMTP; 18 May 2007 18:12:28 +0930 Subject: Re: [Caml-list] Error messages with dypgen From: skaller To: Joel Reymont Cc: OCaml List In-Reply-To: <66D9A385-E61C-4AA2-81AA-B352FB941A57@gmail.com> References: <66D9A385-E61C-4AA2-81AA-B352FB941A57@gmail.com> Content-Type: text/plain Date: Fri, 18 May 2007 18:42:23 +1000 Message-Id: <1179477743.17322.10.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 464D66F5.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0100,:01 syntax:01 rhs:01 rhs:01 ocamlyacc:01 lexer:01 polluted:01 lexbuf:01 parser:01 lexbuf:01 lexer:01 syntax:01 ocamlyacc:01 sourceforge:01 wrote:01 On Fri, 2007-05-18 at 08:20 +0100, Joel Reymont wrote: > I understand that dypgen throws an exception when a syntax error is > found. > > How do I get it to produce line/column numbers when that happens? > > It would be rather groovy if the the exception carried > symbol_start_pos, symbol_end_pos, rhs_start_pos, rhs_end_pos from the > dyp record since this information is available at the time that the > exception is raised. No it isn't. Dypgen uses lexbufs for compatibility with the broken Ocamlyacc interface. Dypgen lets you use ulex or other lexer as well. The type of the error thrown by the automaton should not be polluted by positional information that has no reasonable standard specification. If you want this information, you can look it up yourself in the lexbuf. The parser has no business at all examining the lexbuf, the lexbuf belongs to the lexer. > A simple error function built into dypgen could then take a message > and raise the syntax error exception with all the required info. An error function is a good idea, except the Ocamlyacc style interface is broken so there's no way to pass it so it would have to be global. -- John Skaller Felix, successor to C++: http://felix.sf.net