thanks, guys,
i do need it per token
i think i'll do the same thing Hofkamp suggested and just convert the regex
to case-insensitive
i also want to be able to do DOTALL on a per-token basis. i suppose i can
just do that by changing all . 's to [.\n] 's?

2010/3/9 Oldřich Jedlička <[email protected]>

> Hi,
>
> On Tuesday 09 of March 2010 at 06:38:58, inhahe wrote:
> > Is there any way to make case-insensitive tokens?    I mean, other than
> > specifying it as [Bb][Ll][Aa][Hh] etc..
>
> If you want _all_ tokens to be case-insensitive, there are actually two
> ways
> of doing it (I didn't use ply for a long time, so this might be inaccurate,
> but my information relates to regular expressions anyway):
>
>  1. Look at documentation sections 4.19 (custom reflags for lexer) and 6.12
>     (specify own lexer). In this way you can pass re.IGNORECASE to lexer
> and
>     this lexer to parser.
>
>  2. Specify (?i) anywhere in your tokens. If I remember correctly, ply
> makes
>     one big master regular expression (see section 4.3) to recognize
> tokens.
>     The "(?i)" anywhere in the regular expression makes the full expression
>     as case-insensitive - it is like specifying re.IGNORECASE in reflags
> (see
>     Python documentation, "re" module, section 8.2.1 Regular Expression
>     Syntax).
>
> >
> > I'm gathering that lexers combine all regexes into one single regex, so
> > there's no way to do case-insensitivity?
> >
> > If it's not possible with ply, does anyone know if it can be done with
> > pyparsing or ANTLR?
> >
> > Thanks
>
> Cheers,
> Oldřich.
>

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