From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 0D6085D5 for ; Fri, 12 Jul 2019 13:25:23 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.63,482,1557180000"; d="ml'?scan'208";a="391597859" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 12 Jul 2019 15:25:23 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 097AC826E3; Fri, 12 Jul 2019 15:25:23 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 3E95D7ED69 for ; Fri, 12 Jul 2019 15:25:19 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org IronPort-PHdr: =?us-ascii?q?9a23=3AGt+fAhblMb52XJAaLno8vK3/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZoM2/bnLW6fgltlLVR4KTs6sC17OM9f24EjJaqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjWwba5sIBmsrQjdqsYajIp8Jq0s1hbHv3xEdv?= =?us-ascii?q?hMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTD?= =?us-ascii?q?QhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlS?= =?us-ascii?q?EKPCM7/m7KkMx9lKxVrhK/qRJiwIDbb52aO+dwca7GeNMWWXBMU9xNWyFbHI+x?= =?us-ascii?q?aZYEAeobPeZfqonwv1UCowe/BQawBOPg0CVIiWLr1qI6yegvFhvK1xEkEdIJtn?= =?us-ascii?q?Tbss71OKkPWu2y1qnIzCnMb/NN1Djn7ojIdA4uoP6NXb1qa8bRzlMvFwzcg1iW?= =?us-ascii?q?tIfrMTSV1uEXvGia6eptTeOvi2g9qwFwuDej3MksipPPi4kIyV7E7T10zYUpKd?= =?us-ascii?q?GiSUN2YsSoHZ9Nuy2AKod7QMIvTmd1sygg0LIGo4S0fC0SxZQn2RHfb/uHfpCS?= =?us-ascii?q?7RLlUuaePzh5hHN/d76lgBay60egxvX9VsmyzllKsjJIn9rQunwX1hHe6dKLR/?= =?us-ascii?q?9g8ku7xDqC1QHe5vlBIU8ulKrbL5AhwqQ3lpoWqUnDBC72l1n2jKKNbEok/O6o?= =?us-ascii?q?5ProY7XnvJCQLYh0ihvxMqg2gMywHfw4MhQSX2ic4emzyKfs/Uj9QLlTiv02k7?= =?us-ascii?q?LZsIzBKMQApq+5BhdV3Zw55xa+CTemytUYkmMdIFJLYhLUx7TublrHJfS9Cfak?= =?us-ascii?q?n3ytli1qzrbIJO7PGJLIezL5kbzhdKxxo3Ea7Ux779dZ6okeQuUbIfnzckb3st?= =?us-ascii?q?HIDxZ/NBa7lbW0QO5h358TDDrcSpSSN7nf5AfRurAfZtKUbYpQgw7TbuA/7qe1?= =?us-ascii?q?33Y/n1INfKDv2oEYOijhT6ZWZn6BaH+pue8vVGIDvw4wVuvv0QbQWDhVamazVu?= =?us-ascii?q?Q7/D5pUdv7X7eGfZikhfm65An+HpBSYTkdWFmKF3r4dozCXO0DOnuf?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DcUwBjiShdZLBbRFBlGgEBAQEBFwEBA?= =?us-ascii?q?QUCAQEBAQYBAgEBAQGBSAKBLgIBNS9qgQQol0sBAQEBAQEGmkSBZwkBAwEMIwk?= =?us-ascii?q?BAgEBgUuDQwmCARwGAQQzBg4BAwEBBAEBAgECAwEEU4VRDII6IoQqEyEtNIMjg?= =?us-ascii?q?XYYC60thDIBAwIMQ0CEZAoGgTICAQEBh2uDcREGeD5Jh0IDgSWBCIUVBIwQiAV?= =?us-ascii?q?ph1+NKF0HAgKCGYMrgiCBDY0nJ5gGLZRMkC6BZiGBWX0IO4Jsh3CJFkEwATFSA?= =?us-ascii?q?Y9rAQE?= X-IPAS-Result: =?us-ascii?q?A0DcUwBjiShdZLBbRFBlGgEBAQEBFwEBAQUCAQEBAQYBAgE?= =?us-ascii?q?BAQGBSAKBLgIBNS9qgQQol0sBAQEBAQEGmkSBZwkBAwEMIwkBAgEBgUuDQwmCA?= =?us-ascii?q?RwGAQQzBg4BAwEBBAEBAgECAwEEU4VRDII6IoQqEyEtNIMjgXYYC60thDIBAwI?= =?us-ascii?q?MQ0CEZAoGgTICAQEBh2uDcREGeD5Jh0IDgSWBCIUVBIwQiAVph1+NKF0HAgKCG?= =?us-ascii?q?YMrgiCBDY0nJ5gGLZRMkC6BZiGBWX0IO4Jsh3CJFkEwATFSAY9rAQE?= X-IronPort-AV: E=Sophos;i="5.63,482,1557180000"; d="ml'?scan'208";a="391597852" X-MGA-submission: =?us-ascii?q?MDGUX/lZjDzywC/ccgfjkU75aeIJO+/duPofTt?= =?us-ascii?q?eh/gD/rZr4c/ssmmrHeClNQNjh5wYJrkE5Nsj3tv70TJJdtOtRWo6dpF?= =?us-ascii?q?pcSpJ59caCcn7reC6DZjoz60OTiy8Mk+O6PdpooUzJMSuJHwStYXQWH1?= =?us-ascii?q?v6gB8hihFGNwG7pMgqLjNvdg=3D=3D?= Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 12 Jul 2019 15:25:18 +0200 Received: from rich by annexia.org with local (Exim 4.89) (envelope-from ) id 1hlvY5-00041G-Fv for caml-list@inria.fr; Fri, 12 Jul 2019 14:25:17 +0100 Date: Fri, 12 Jul 2019 14:25:17 +0100 From: "Richard W.M. Jones" To: caml-list@inria.fr Message-ID: <20190712132517.4623wwffikbrsqlf@annexia.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="r2l4lqvtdv3oavad" Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Subject: [Caml-list] Ast_iterator example? Reply-To: "Richard W.M. Jones" X-Loop: caml-list@inria.fr X-Sequence: 17682 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --r2l4lqvtdv3oavad Content-Type: text/plain; charset=us-ascii Content-Disposition: inline As previously discussed: https://sympa.inria.fr/sympa/arc/caml-list/2019-06/msg00050.html I'm now trying to port ocaml-gettext to use ppx. However I can't get even a trivial Ast_iterator example to compile. Does anyone have a simple compilable example using Ast_iterator? Rich. --r2l4lqvtdv3oavad Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gettext_plugin.ml" (**************************************************************************) (* ocaml-gettext: a library to translate messages *) (* *) (* Copyright (C) 2003-2008 Sylvain Le Gall *) (* *) (* This library is free software; you can redistribute it and/or *) (* modify it under the terms of the GNU Lesser General Public *) (* License as published by the Free Software Foundation; either *) (* version 2.1 of the License, or (at your option) any later version; *) (* with the OCaml static compilation exception. *) (* *) (* This library is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *) (* Lesser General Public License for more details. *) (* *) (* You should have received a copy of the GNU Lesser General Public *) (* License along with this library; if not, write to the Free Software *) (* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *) (* USA *) (**************************************************************************) (** PPX dumper to extract strings. @author Richard W.M. Jones @author Sylvain Le Gall *) (* Extract the string which should be used for a gettext translation. Output a po_content list through the function Marshal.to_channel Functions that are looked for : Functions Arg 1 Arg 2 Arg 3 Arg 4 Arg 5 Arg 6 ... s_ singular f_ singular sn_ singular plural _ fn_ singular plural _ gettext _ singular fgettext _ singular dgettext _ domain singular fdgettext _ domain singular dcgettext _ domain singular _ fdcgettext _ domain singular _ ngettext _ singular plural _ fngettext _ singular plural _ dngettext _ domain singular plural _ fdngettext _ domain singular plural _ dcngettext _ domain singular plural _ _ fdcngettext _ domain singular plural _ _ All this function name should also be matched when they are called using a module. *) let visit_expr (iterator : Ast_iterator.iterator) expr = () let ast_iterator () = { Ast_iterator.default_iterator with expr = visit_expr } let transform hook_info structure = let astm = ast_iterator () in astm.structure astm structure let () = Pparse.ImplementationHooks.add_hook "ocaml-gettext" transform --r2l4lqvtdv3oavad--