Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Francois Rouaix <francois@r...>
Subject: Re: [Caml-list] Case-insensitive lexing
You could wrap existing lexbuf generating functions with a layer that
converts everything to uppercase or lowercase, and write your lexer
accordingly? Won't work if you have constants strings, but otherwise it puts
all the case logic in one place.


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:
>
> | identifier {
>    let x = toupper (lexeme lexbuf) in
>    try Hashtbl.find keywords x
>    With Not_found -> x
> }
>
>         Thanks, Joel
>
> --
> http://wagerlabs.com/
>
>
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>