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.5 required=5.0 tests=SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 483AEBBC4 for ; Tue, 14 Apr 2009 02:24:33 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4DAAh040nD7gavkWdsb2JhbACBUpRhAQEBAQkLCgcRA7ZEg3wG X-IronPort-AV: E=Sophos;i="4.40,182,1238968800"; d="scan'208";a="26184938" Received: from mailrelay002.isp.belgacom.be ([195.238.6.175]) by mail3-smtp-sop.national.inria.fr with ESMTP; 14 Apr 2009 02:24:33 +0200 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiAFAI9z40lR8WUC/2dsb2JhbACBUstkg3wG Received: from 2.101-241-81.adsl-dyn.isp.belgacom.be (HELO poincare.swapping.umh.ac.be) ([81.241.101.2]) by relay.skynet.be with ESMTP; 14 Apr 2009 02:24:32 +0200 Received: from localhost ([127.0.0.1] ident=trch) by poincare.swapping.umh.ac.be with esmtp (Exim 4.69) (envelope-from ) id 1LtWRz-0005lU-Rg; Tue, 14 Apr 2009 02:24:31 +0200 Date: Tue, 14 Apr 2009 02:24:31 +0200 (CEST) Message-Id: <20090414.022431.864180245398589194.Christophe.Troestler+ocaml@umons.ac.be> To: yaoconglun@gmail.com Cc: OCaml Mailing List Subject: Re: [Caml-list] Re: How to achieve this camlp4 syntax extension From: Christophe TROESTLER In-Reply-To: References: <49D4B6DB.2020407@users.sourceforge.net> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: University of Mons X-Mailer: Mew version 6.2.51 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; camlp:01 syntax:01 christophe:01 troestler:01 christophe:01 troestler:01 ocaml:01 'list':01 longident:01 val:01 longident:01 expr:01 expr:01 delimited:01 overloading:01 > On 4/2/2009 1:42 PM, Conglun Yao wrote: >> >> Different kinds of error happened, when trying to use it. >> >> Even the ordinary expression:  List.length [1; 2;3 ],  failed.  'List' >> is parsed as module_longident, try to match the rule I defined. Not sure whether you are still looking for a solution to this but, as it was not possible to use theses constructions together with pa_do (same grammar rule to modify), I added hooks so you can provide your own functions for them. E.g., val module_square_brackets : (module_longident -> Loc.t -> expr -> expr) ref allows you to replace [M.[ e ]] by [!module_square_brackets m _loc e] where [m] is the internal representation of [M] and [_loc] is the location of the whole expression [M.[ e ]]. This is available in the last version of delimited overloading (downloadable at http://pa-do.forge.ocamlcore.org/ ). Hope it helps, ChriS