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.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 21706BC69 for ; Fri, 23 Feb 2007 16:41:50 +0100 (CET) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.239]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1NFfm8V029783 for ; Fri, 23 Feb 2007 16:41:49 +0100 Received: by wr-out-0506.google.com with SMTP id 70so547800wra for ; Fri, 23 Feb 2007 07:41:48 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aYrCOrYBnspK9I/S6g/mUtyVhUUCPxsY2ReCw/vVFk7ojMfdkymIN2VsMqXI5qKd3KGTP+3f2mj+yTVWVkqpFK8qkvpCSYqaIFHa0PQeqDRGlHE2xgohsWBqSMBAPif6XhjUsn8jXTBfPAP8yWgLCGRHSlrge7UBkFkSEQ79QtU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ojoRaU3f4zR1pAhXWu7IdEg5gPeXN/algMOZ71dNnh8NezRrAEScGpijyG+sNs4cwtRez4YzgoEupLrCB3OVUyzeeDWQVQX/odMLW+wC/a3LwomOR0iLet//HJ6yJOmB2ZzTzFLwpPmEWGBBj2b7RdxNc6vAfrsvRrjRuAY+6/c= Received: by 10.114.157.1 with SMTP id f1mr956554wae.1172245307188; Fri, 23 Feb 2007 07:41:47 -0800 (PST) Received: by 10.114.194.3 with HTTP; Fri, 23 Feb 2007 07:41:47 -0800 (PST) Message-ID: <6dbd4d000702230741l2833c822x8dcb6c469b3724fe@mail.gmail.com> Date: Fri, 23 Feb 2007 10:41:47 -0500 From: "Denis Bueno" To: "Joel Reymont" Subject: Re: [Caml-list] Case-insensitive lexing Cc: caml-list@inria.fr In-Reply-To: <23E977DC-77FF-44A2-8675-5EAA8F61505F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <23E977DC-77FF-44A2-8675-5EAA8F61505F@gmail.com> X-j-chkmail-Score: MSGID : 45DF0B3C.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45DF0B3C.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lexing:01 lexer:01 ocamllex:01 int':01 regexp:01 regexp:01 hashtable:01 hashedtype:01 wrote:01 token:01 caml-list:01 lex:01 expressions:04 comparison:04 quite:07 On 2/23/07, Joel Reymont wrote: > Folks, > > Is there a way to make a case-insensitive lexer with ocamllex? > > The only answer I was able to find is the following from John Skaller: You could also make all your token regular expressions accept all possible cases. So if `int' were a keyword to lex, your regexp might be "[iI][nN][tT]". You could (easily?) write something that would accept a keyword regexp and give you back a case-insensitive keyword regexp. It looks like you might have been asking for case-insensitive comparison for your keyword hashtable. This is quite easy, just by using a HashedType with a case-insensitive `compare' function. -Denis