inhahe wrote:
Is there any way to make case-insensitive tokens?    I mean, other than 
specifying it as [Bb][Ll][Aa][Hh] etc..

I'm gathering that lexers combine all regexes into one single regex, so there's 
no way to do case-insensitivity?

I never had this problem, so I don't know.
The manual (lexer section) should say something about it, if it is supported.

The simplest approach I can think of, is to write a function that converts a keyword string to the above form, something like

>>> import string
>>> keyword = "abc-def"
>>> ''.join('[%s%s]' % (x, x.upper()) if x in string.lowercase else x for x in 
keyword)
'[aA][bB][cC]-[dD][eE][fF]'


If it's not possible with ply, does anyone know if it can be done with 
pyparsing or ANTLR?

You should ask that at other mailing lists probably.


Albert

--
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en.

Reply via email to