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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A016BBC6E for ; Mon, 17 Dec 2007 13:41:18 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAALP8ZUfAXQImh2dsb2JhbACQBQEBAQgKKZkW X-IronPort-AV: E=Sophos;i="4.24,176,1196636400"; d="scan'208";a="20403629" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Dec 2007 13:41:18 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id lBHCfHRb024869 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 17 Dec 2007 13:41:18 +0100 X-IronPort-AV: E=Sophos;i="4.24,176,1196636400"; d="scan'208";a="6913977" Received: from yquem.inria.fr ([128.93.8.37]) by mail3-relais-sop.national.inria.fr with ESMTP; 17 Dec 2007 13:41:17 +0100 Received: by yquem.inria.fr (Postfix, from userid 25991) id 6F924BC6E; Mon, 17 Dec 2007 13:41:17 +0100 (CET) Date: Mon, 17 Dec 2007 13:41:17 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] How to Create Sensible Debugging Information when Dynamically Typechecking Code Generated with camlp5 Quotations Message-ID: <20071217124117.GA24752@yquem.inria.fr> References: <1197733590-sup-3933@ausone.local> <518979.92669.qm@web60112.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <518979.92669.qm@web60112.mail.yahoo.com> User-Agent: Mutt/1.5.9i X-Miltered: at discorde with ID 47666E6D.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; rauglaudre:01 rauglaudre:01 camlp:01 camlp:01 pcaml:01 pcaml:01 wrote:01 dynamically:01 typechecking:01 caml-list:01 int:01 int:01 usable:02 string:02 string:02 Hi, On Mon, Dec 17, 2007 at 01:11:09AM -0800, echinuz echinuz wrote: > This contains no location information since Plot.Exc is not caught > and handled in the same manner as it is during preprocessing. I > would like an error similar to the first case, when there were no > quotations, to be shown in the second case, when there are > quotations. Ok, I understand your problem. It is indeed something missing in Camlp5. I just added what is necessary and made a release. Download the latest version (5.05) of Camlp5 at: http://pauillac.inria.fr/~ddr/camlp5/ I added a function "Pcaml.quotation_location" which returns the location of the quotation text, relative to the source file, and usable in quotations expanders. Your code: let get_loc l= string_of_int (Ploc.line_nb l), string_of_int (Ploc.bol_pos l), string_of_int (Ploc.first_pos l), string_of_int (Ploc.last_pos l) could be changed into: let get_loc l= let l = let qloc = Pcaml.quotation_location () in Ploc.shift (Ploc.first_pos qloc) l in string_of_int (Ploc.line_nb l), string_of_int (Ploc.bol_pos l), string_of_int (Ploc.first_pos l), string_of_int (Ploc.last_pos l) Hope this helps. -- Daniel de Rauglaudre http://pauillac.inria.fr/~ddr/