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.6 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST 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 E23CBBBAF for ; Sun, 8 Mar 2009 12:45:58 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgBANZMs0nZkrEIkWdsb2JhbACVKgEBAQEJCwoHEQOtWoEHjkEBBIQF X-IronPort-AV: E=Sophos;i="4.38,324,1233529200"; d="scan'208";a="36246544" Received: from web27008.mail.ukl.yahoo.com ([217.146.177.8]) by mail4-smtp-sop.national.inria.fr with SMTP; 08 Mar 2009 12:45:58 +0100 Received: (qmail 54126 invoked by uid 60001); 8 Mar 2009 11:45:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1236512757; bh=Kl548Zz8/Bh/3vOMc/81anNFH/WLP/w5BXE9yZrl+Ec=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=JfNpQIf3gQR6NPLx5lK5JERxzmkDmv11zUPHV3DdY8MDagJbcwHZUOQgomr+dxWx3oYKMa1cNvhR2RPpgy2+eJxpJdY7ZCwDqD8kKfqXydR3lh2NoxO4CfRygSkEV23oSEMBtUXgA5uexuvQgSfiGhyPLwD19W818t3cYSRFWqU= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=SmjzXdQ4CYvMyFk+4Pz6oiDbMtMqOs7xAlVvTCSdQmNw3qafvhfNeQeHCN01BGUW7UMazNhfUoswy31DXCJMDh+hDJKFciCDcQePsrrCdqVCs0AWKRxNTuWuC2BA90I2QN41O/UEt4G8E6x+aX7hSqsVM3GSseLcXrMrZlrtdmA=; Message-ID: <279881.54090.qm@web27008.mail.ukl.yahoo.com> X-YMail-OSG: 05XKXikVM1mK4QAs4nkpQx02C3aMmPrsCJ_zl0kFxWMgQ4XEpAW1Q6Jye3GDsxgZRsHsMAVL6_ABynMdpddyUaUxpQ3dC4kM6zMc7zm71.bUW6k6WyaEb5TvYrUEbB0GRBYswlJJRYsXVkxxemRmlfUOo0ma03ouX6sFcwtex4tyH9L7k45mNfS9NHYmBcYRmWNkz8cddGe6RsnWrFZu9vYSmK_D Received: from [82.242.132.106] by web27008.mail.ukl.yahoo.com via HTTP; Sun, 08 Mar 2009 11:45:56 GMT X-Mailer: YahooMailRC/1155.45 YahooMailWebService/0.7.289.1 References: <24D11586-4F15-4B6E-8FB7-58651317164D@gmail.com> <46331.52510.qm@web27007.mail.ukl.yahoo.com> <0B508092-FD71-4733-BC95-B6B87A6D3E6B@gmail.com> <154139.25342.qm@web27007.mail.ukl.yahoo.com> <46FCBABD-7E4A-4077-8227-3816FD6D635D@gmail.com> Date: Sun, 8 Mar 2009 11:45:56 +0000 (GMT) From: Matthieu Wipliez Subject: Re : Re : Re : [Caml-list] Re: camlp4 stream parser syntax To: O'Caml Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; matthieu:01 camlp:01 parser:01 syntax:01 lexer:01 ocamllex:01 hash:01 tokens:01 hash:01 lowercase:01 hashtbl:01 lowercase:01 cheers:01 matthieu:01 o'caml:01 Since I don't know how to use the filter either, I tried to find another wa= y :-)=0A=0AIn your lexer, do you have something along the lines of the "cal= c" examples in ocamllex official documentation, like a hash table that asso= ciates strings to tokens?=0A=0AIn this case, here is a possible solution, y= ou have your hash table associate a lowercase version of the token with wha= t you'd like to use in the grammar:=0A"buytocover" =3D> "BuyToCover"=0A"sel= lshort" =3D> "SellShort"=0A...=0A=0AAnd you replace the lookup with=0Atry= =0A IDENT (Hashtbl.find keyword_table (String.lowercase id))=0Awith Not_fo= und ->=0A IDENT id=0A=0AThis way identifiers that when lower-cased look li= ke "buytocover" ("BuYTOCovEr", "bUytOcOVeR", etc.) are replaced by a single= token "BuyToCover", against which you match in the grammar.=0A=0ACould thi= s satisfy your requirements?=0A=0ACheers,=0AMatthieu=0A=0A=0A=0A----- Messa= ge d'origine ----=0A> De : Joel Reymont =0A> =C0 : Matthi= eu Wipliez =0A> Cc : O'Caml Mailing List =0A> Envoy=E9 le : Dimanche, 8 Mars 2009, 9h25mn 23s=0A> Objet := Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax=0A> =0A> How can= I make camlp4 parsing case-insensitive?=0A> =0A> The only approach I can t= hink of so far is to build a really larger =0A> set of tokens and use them= instead of strings in the parser.=0A> =0A> Any flag I can flip or way to d= o this without a large set of tokens?=0A> =0A> Thanks, Joel=0A> =0A> On= Mar 8, 2009, at 1:08 AM, Matthieu Wipliez wrote:=0A> =0A> >=0A> >> Is the = camlp4 grammar parser case-insensitive?=0A> >>=0A> >> Will both Delay and d= elay be accepted in the actionDelay rule?=0A> >>=0A> >> actionDelay: [ [= "delay"; expression ->=0A> >> Asthelper.failwith (convert_loc _loc)= =0A> >> "RVC-CAL does not permit the use of delay." ] ];=0A> >= =0A> > No, only "delay" is accepted.=0A> =0A> =0A> =0A> ---=0A> http://tiny= co.de=0A> Mac, C++, OCaml=0A=0A=0A=0A