[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case insensitive lexing?



Hi steve.

> I need to build a case-insensitive lexer, namely recognize about 80
> keywords whose case doesn't matter.

I already answered this:

http://www.sable.mcgill.ca/listarchives/sablecc-list/msg00234.html

> Is there an easy way to extend a lexer for id=[A-Za-z][A-Za-z_0-9]* so
> that it could return the appropriate keyword token if the id is one of
> the reserved words (keywords) of the language, and return the "id" token
> otherwise?

Just put all the keyword tokens first, then put the "id" token
definition. 

Etienne
-- 
----------------------------------------------------------------------
Etienne M. Gagnon, M.Sc.                     e-mail: egagnon@j-meg.com
Author of SableCC:                 http://www.sable.mcgill.ca/sablecc/
----------------------------------------------------------------------