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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 89D14BC0A for ; Mon, 2 Apr 2007 14:40:28 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l32CeRqH001238 for ; Mon, 2 Apr 2007 14:40:28 +0200 Received: by ug-out-1314.google.com with SMTP id k3so1605287ugf for ; Mon, 02 Apr 2007 05:40:27 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=Z4I9iz9lrQ8O/mTpP3FE+VWv17ZmSRVq49SCMe/N2uyEL/73O/69T5Reb2xfh+v3/WMjYX00E+8be67ZOpadj5K3CA91sS2z9Zl2yB4I2k2f1soH2Maz92NKK5BZI90ezfzQD34dhtRNCzQOy3dGxHzn87ObBvtYUfwfEEDTVVA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=em+1H2BrlP5suJnB8I5mbu0CvRrTVPZGb4SWIXtlETBHvDl5bb5LbC8v3xpqSYU8hwfQqo4+srgcG1Snyv3WseuJy0L+i7jNPXXgiCI3oPjFcm7oRnSn6lLvR9yBr+VKZ2WZ0sRywuTkGsD3JLXbrAlIAmABORb7/ZNCjU3Q8zo= Received: by 10.66.239.18 with SMTP id m18mr4451191ugh.1175517627526; Mon, 02 Apr 2007 05:40:27 -0700 (PDT) Received: from ?192.168.1.34? ( [81.33.210.112]) by mx.google.com with ESMTP id y37sm7780912iky.2007.04.02.05.40.24; Mon, 02 Apr 2007 05:40:25 -0700 (PDT) In-Reply-To: References: <5526ED79-3406-4700-9E95-20C631FE40BF@gmail.com> <428B8C56-8ADC-43ED-96D0-34B4341E7045@gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <55D63C07-BC8F-424C-A895-55587FD97EB3@gmail.com> Cc: "Caml List" Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: Re: [Caml-list] Help with new camlp4 Date: Mon, 2 Apr 2007 13:40:26 +0100 To: Nicolas Pouillard X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 4610F9BB.002 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 4610F9BB.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 vars:01 stringset:01 failwith:01 stringset:01 vars:01 expr:01 expr:01 caml-list:01 patt:01 patt:01 ast:02 declaration:02 parse:02 parse:02 I'm stuck for good now. I'm trying to make sure that translate has a proper signature. It needs a few arguments that weren't present in the original declaration (let translate xml = ...). I add the missing bits but xml in translate is of type Xml whereas Quotation.ExAst wants a string. Help!!! let translate (_: Quotation.Ast.Loc.t) (_:string option) (xml: string) = let (body,vars,sublist) = visit StringSet.empty xml in if sublist then failwith "Need exactly 1 root (condition/repeat/omit-tag prohibited)" else let vvars = List.map (fun x -> <:patt< ~ $x$>>) (StringSet.elements vars) in List.fold_right (fun p e -> <:expr $e$>>) vvars body ;; let expand_expr_file = chain translate Xml.parse_file ;; let expand_expr_str = chain translate Xml.parse_string ;; let expand_patt x = (* Stdpp.raise_with_loc loc *) Loc.raise x (Failure "Quotation not allowed in pattern") ;; Quotation.add "octalxml" (Quotation.ExAst (expand_expr_str,expand_patt)) ;; Quotation.add "octalfile" (Quotation.ExAst (expand_expr_file,expand_patt)) ;; -- http://wagerlabs.com/