Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 <> 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.