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: 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,  
yytext)
{T}{R}{U}{E}{F}{A}{L}{S}{E}{A}{R}{R}{A}{Y}{R}{E}{F}   ('ARRAY-NUM- 
REF, yytext)

	Thanks, Joel

--
http://wagerlabs.com/