[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:


> 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

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