Browse thread
Case-insensitive lexing
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 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