From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id CD9C37ED34 for ; Fri, 13 Jul 2012 12:24:04 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of wojciech.meyer@googlemail.com) identity=pra; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@googlemail.com"; x-sender="wojciech.meyer@googlemail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of wojciech.meyer@googlemail.com designates 209.85.217.182 as permitted sender) identity=mailfrom; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@googlemail.com"; x-sender="wojciech.meyer@googlemail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f182.google.com) identity=helo; client-ip=209.85.217.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@googlemail.com"; x-sender="postmaster@mail-lb0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au4BAJj2/0/RVdm2mGdsb2JhbABFpwOREwgiAQEBAQEICQ0HFCeCIAEBAQQSAhMZAQEsCwEPCwsNDSEhARIBBQEKEgYTEhCHWwEDDAucbAkDimaELgEFhRUKQAMCCIlIBopWZoV2lT2BEolygyU+g38 X-IronPort-AV: E=Sophos;i="4.77,579,1336341600"; d="scan'208";a="150548431" Received: from mail-lb0-f182.google.com ([209.85.217.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 13 Jul 2012 12:24:04 +0200 Received: by lbon10 with SMTP id n10so7829976lbo.27 for ; Fri, 13 Jul 2012 03:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+ddVbhPT5KUAwJtHRIaXVEFKRWpq9zAmmw6H2Nmnt4I=; b=RjE3AR8kUnHjdrGIWrpPfOKAb9KUcsphUAxjLudQza9y2zaJVKfHyVHpLTKRCPf4ou uS2p3Sxe6dQwOZ8XIvSIBuJzbpdWaQJ26cqhLSdR8SNWVKb/oRDjH7sliQuMLEZTujHQ Ec3JfdjWq9hGo9hCn5rxIJNB7/kq27kEkC3RQ2IyXAkR53QNg7uo7dxFQg/GxjBF8ziI 9eF/K63hfbC38axFVSiVc3OQOLCF9q1AUuihr1gLRziZkKadZKbIV2CSpwEWONipqsc7 aS/BGVCBl+W1pgU8GPsEQRRmGeY4UskZAe6eiKOGkmXK/UKq+awlA7EXHTMy0Mmnv8Jw js2A== MIME-Version: 1.0 Received: by 10.112.83.169 with SMTP id r9mr530314lby.66.1342175043491; Fri, 13 Jul 2012 03:24:03 -0700 (PDT) Received: by 10.114.0.203 with HTTP; Fri, 13 Jul 2012 03:24:03 -0700 (PDT) In-Reply-To: References: <1342169284.53181.YahooMailRC@web180016.mail.gq1.yahoo.com> Date: Fri, 13 Jul 2012 11:24:03 +0100 Message-ID: From: Wojciech Meyer To: Gabriel Scherer Cc: Dan Bensen , caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] analyzing Camlp4 nodes There is Camlp4LocationStripper.ml filter in Camlp4/Filters. On Fri, Jul 13, 2012 at 11:12 AM, Gabriel Scherer wrote: > I'm sorry but I don't understand your question. > What do you mean by "comparing" ast nodes? Is it an equality/ordering > test between the node as OCaml values? > I don't understand what you mean by the idea of "a quotation and > another quotation" having "the same location". > Maybe a concrete example would be clearer. > > If your question is: how do I text that two pieces of ASTs are equal > *modulo* the location (the term structure is the same but the > locations are allowed to be different), then you can do that by > erasing the locations. Untested code: > > let strip_locations = Ast.map_loc (fun _ -> Loc.ghost) > let equal_modulo_loc a b = (strip_locations a) = (strip_locations b) > > On Fri, Jul 13, 2012 at 10:48 AM, Dan Bensen wrote: >> >> Is there a way to compare a Camlp4 ast node to a quotation >> that ignores the locations? >> Camlp4 seems to rely on quotations as much as possible, >> but it seems like you have to either compare a quotation >> with another quotation, so they have the same location, >> or write out the ast code explicitly. > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >