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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id F20A6BBAF for ; Sun, 8 Mar 2009 10:37:56 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.38,324,1233529200"; d="scan'208";a="22213054" Received: from yquem.inria.fr ([128.93.8.37]) by mail2-relais-roc.national.inria.fr with ESMTP; 08 Mar 2009 10:37:56 +0100 Received: by yquem.inria.fr (Postfix, from userid 25991) id DF1A4BBAF; Sun, 8 Mar 2009 10:37:56 +0100 (CET) Date: Sun, 8 Mar 2009 10:37:56 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax Message-ID: <20090308093756.GB5433@yquem.inria.fr> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46FCBABD-7E4A-4077-8227-3816FD6D635D@gmail.com> User-Agent: Mutt/1.5.9i X-Spam: no; 0.00; rauglaudre:01 rauglaudre:01 camlp:01 parser:01 syntax:01 camlp:01 lexer:01 tokens:01 lexer:01 redefining:01 grammars:01 lowercase:01 2009:98 token:01 token:01 Hi On Sun, Mar 08, 2009 at 08:25:23AM +0000, Joel Reymont wrote: > How can I make camlp4 parsing case-insensitive? I think it should work with doing the two following things (both): 1/ Change your lexer to generate case-insensitive tokens. 2/ Use the field "tok_match" of the interface with the lexer. Redefining it allows you to match some token pattern with the corresponding token. See doc (camlp5) in: http://pauillac.inria.fr/~ddr/camlp5/doc/htmlc/grammars.html#b:The-lexer-record In the example "default_match", change the test "if con = p_con" into "if String.lowercase con = p_con". Don't know if it still works with Camlp4, but you can often use the Camlp5 documentation even for many Camlp4 features. -- Daniel de Rauglaudre http://pauillac.inria.fr/~ddr/