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=2.8 required=5.0 tests=DNS_FROM_RFC_POST, HTML_MESSAGE,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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 7905DBB84 for ; Tue, 10 Feb 2009 22:10:27 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvEBAPd7kUlKfVwZkGdsb2JhbACCQTCRGD8BAQEBCQkMBxEDr1SPZQEDAQOEFwaEJA X-IronPort-AV: E=Sophos;i="4.38,188,1233529200"; d="scan'208";a="35020388" Received: from qw-out-2122.google.com ([74.125.92.25]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Feb 2009 22:10:26 +0100 Received: by qw-out-2122.google.com with SMTP id 8so29563qwh.33 for ; Tue, 10 Feb 2009 13:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=7FBH+QPxx8QIq/S+fukUuH4ByPpqqoVik4zxaaWy0rI=; b=TQB3H4HM5uNUG/s7UGQhk2YEJSncex9mc8c+1zdt6wQIgiTYhnvfg+ljN3kdjecE64 XXCNfNj9DQS1E5TMaoAg2JbPCL2sLF0cBRZobYfOowoooKqYOeoYVCIeSjE7dlAvSHKX fzQd/DFA0fB9b99/4T67kMNQ5fq25sp5TdDL0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=TWnjljXFhFhs5qlMWPihYYBKRSrCLuTSTj88+GNssZXaAy9C3fvWk+F2JT1rL2I5dz K/9ED7+2a7X0owG6REAaIYAjD0YzuUDZcsShoz4z2w/Jf9gqOEv4LOYLwQNxnIa7Our7 Lj7b+Ie32vnkpAXhTzZVwLd7N+pFe7qkUXhys= MIME-Version: 1.0 Sender: jake.donham@gmail.com Received: by 10.142.194.1 with SMTP id r1mr2447585wff.166.1234300224488; Tue, 10 Feb 2009 13:10:24 -0800 (PST) In-Reply-To: <1234297248.6457.65.camel@Blefuscu> References: <1234297248.6457.65.camel@Blefuscu> Date: Tue, 10 Feb 2009 13:10:24 -0800 X-Google-Sender-Auth: ea800e825ccb7258 Message-ID: Subject: Re: [Caml-list] Behavior of camlp4o when used with -pp? From: Jake Donham To: David Rajchenbach-Teller Cc: OCaml Content-Type: multipart/alternative; boundary=000e0cd14ed86d44fe046296ea50 X-Spam: no; 0.00; camlp:01 -pp:01 ens-lyon:01 camlp:01 foo:01 foo:01 ocamlc:01 -pp:01 -help:01 ocaml:01 compiler:01 syntax:01 ocaml:01 ens-lyon:01 ocamlc:01 --000e0cd14ed86d44fe046296ea50 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Feb 10, 2009 at 12:20 PM, David Rajchenbach-Teller < David.Teller@ens-lyon.org> wrote: > camlp4o -no_comments foo.ml > > understands option "-no_comments" correctly and pretty-prints the > contents of foo.ml, minus comments > > > However, when using camlp4o as a preprocessor, > > ocamlc -i -pp "camlp4o -no_comments" foo.ml > -no_comments: unknown or misused option > Use option -help for usage > File "foo.ml", line 1, characters 0-1: > Error: Preprocessor error > The default Camlp4 printer is the "auto" printer, which checks if its output fd is a TTY; if so it uses the OCaml printer (which has -no_comments), if not it uses the DumpOCamlAst printer (which does not). The point of this is to pass the serialized AST through to the compiler without reparsing, for speed and also to preserve the original locations in code that's been transformed by a syntax extension. Basically there is no reason to use -no_comments with -pp. But if you really want to you can also give -printer o to camlp4o so you always get the OCaml printer instead of autoselecting. Jake --000e0cd14ed86d44fe046296ea50 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Feb 10, 2009 at 12:20 PM, David Rajchenbach-Teller <David.Teller@ens-lyon.or= g> wrote:
camlp4o -no_comments foo.ml

understands option "-no_comments" correctly and pretty-prints the=
contents of
foo.ml, minus c= omments


However, when using camlp4o as a preprocessor,

ocamlc -i -pp "camlp4o -no_comments" foo.ml
-no_comments: unknown or misused option
Use option -help for usage
File "foo.ml", li= ne 1, characters 0-1:
Error: Preprocessor error
 
The default Camlp4 printer is the "= ;auto" printer, which checks if its output fd is a TTY; if so it uses = the OCaml printer (which has -no_comments), if not it uses the DumpOCamlAst= printer (which does not). The point of this is to pass the serialized AST = through to the compiler without reparsing, for speed and also to preserve t= he original locations in code that's been transformed by a syntax exten= sion.

Basically there is no reason to use -no_comments with -pp. But if you r= eally want to you can also give -printer o to camlp4o so you always get the= OCaml printer instead of autoselecting.

Jake

--000e0cd14ed86d44fe046296ea50--