From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 350017ED34 for ; Fri, 13 Jul 2012 12:13:12 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.160.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.160.182 as permitted sender) identity=mailfrom; client-ip=209.85.160.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.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-gh0-f182.google.com) identity=helo; client-ip=209.85.160.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-gh0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnABAIn0/0/RVaC2imdsb2JhbABFuBYIIgEBAQoJDQcSBiOCIAEBAQQSAhMZARsdAQMMBgULDS4iAREBBQEcBhMih1sBAwyceQkDjCOCcYUaChknBQhXiHEBBQyLMIV2A5U6jik+hAA X-IronPort-AV: E=Sophos;i="4.77,579,1336341600"; d="scan'208";a="150547050" Received: from mail-gh0-f182.google.com ([209.85.160.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 13 Jul 2012 12:13:02 +0200 Received: by ghbz22 with SMTP id z22so4826960ghb.27 for ; Fri, 13 Jul 2012 03:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+/7SsUUSotSzMt3M9O/Lcw8KI6XUp4EpOr37VjXZZuA=; b=LliGzqAgXriIIcYzJpITcJqjOHBjI6jtPpsDA6PoHbE2j9BxFnF+ja0vJM2IEtrgxf fIvnWNVeYIVh5OSpRsjaFWjz5qBWZlx1y/xfDWPdHWTr/hzG54rhhqDL1+dQe2xbqMku NR2zdOvQ9grzXklxFWoh4BI+1Kuk7UBlxdiImGdhazFc2sQbbFaIoFdminatYxDtwb3j dFnV4otH0hOKuMjFlG3wkbCMUeYxtetQ614KuEFpEoMQUfEf8uKiZb7N/WLo3JqlJkA5 A8P1hE6ux2R63mhRU9uhbeYqPFWuo6AqzZ8JZmtZhwMbak9Ezvp8SPhKi5ZNvyuyUup9 Rg+Q== Received: by 10.50.77.200 with SMTP id u8mr439298igw.6.1342174380721; Fri, 13 Jul 2012 03:13:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.94.39 with HTTP; Fri, 13 Jul 2012 03:12:20 -0700 (PDT) In-Reply-To: <1342169284.53181.YahooMailRC@web180016.mail.gq1.yahoo.com> References: <1342169284.53181.YahooMailRC@web180016.mail.gq1.yahoo.com> From: Gabriel Scherer Date: Fri, 13 Jul 2012 12:12:20 +0200 Message-ID: To: Dan Bensen Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] analyzing Camlp4 nodes 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.