English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Case-insensitive lexing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-23 (15:41)
From: Denis Bueno <dbueno@g...>
Subject: Re: [Caml-list] Case-insensitive lexing
On 2/23/07, Joel Reymont <joelr1@gmail.com> 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

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.