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 (16:02)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Caml-list] Case-insensitive lexing

On Feb 23, 2007, at 3:50 PM, Christian Lindig wrote:

> I assume you define identifier to a sequence of upper and lower  
> characters. What is wrong with this solution and what would you  
> have liked to see instead?

I was hoping not having to write this (from a Lex file):

A       [Aa]
B       [Bb]
Y       [Yy]
Z       [Zz]

{A}{B}{O}{V}{E}                 { return(ABOVE); }
{A}{G}{O}                       { return(AGO); }
{A}{L}{E}{R}{T}                 { return(ALERT); }

Or even uglier

{N}{U}{M}{E}{R}{I}{C}{A}{R}{R}{A}{Y}{R}{E}{F}         ('ARRAY-NUM- 
REF, yytext)
{T}{R}{U}{E}{F}{A}{L}{S}{E}{A}{R}{R}{A}{Y}            ('ARRAY-NUM,  
{T}{R}{U}{E}{F}{A}{L}{S}{E}{A}{R}{R}{A}{Y}{R}{E}{F}   ('ARRAY-NUM- 
REF, yytext)

	Thanks, Joel