[TxMt] Re: Python bundle syntax highlighting bug

Jay Soffian jay-txmt at soffian.org
Wed Aug 15 04:25:49 UTC 2007


On Aug 14, 2007, at 9:18 PM, Alex Ross wrote:

> So, we have five options:
>
> 1. Match all raw strings unambiguously as regular expressions.  We  
> will sometimes have false-positives.
>
> 2. Match raw strings that are arguments to methods from the re  
> module.  We will sometimes not match raw strings that are regular  
> expressions, but can be pretty well guaranteed to never have a  
> false-positive.
>
> 3. Require some prefix to a raw string to "turn on" regular  
> expression matching.  This has an extremely high probability of  
> removing false-positives and false-negatives, but at the cost of  
> additional CRUFT.
>
> 4. A combination of 2. and 3.  Match raw strings that are arguments  
> to re.compile and raw strings prefixed with (?#) as regular  
> expressions, but no others.
>
> 5. Don't match re's at all.

My vote would be for 4, but I'll add two more options:

6. Parse r' and r''' but not r" and r""" (or vice-versa) as regexes.

7. Parse the "r" prefix, but not the "R" prefix, as regexes.

The last option is probably the simplest. I don't think I've ever  
seen the "R" prefix in use and didn't even know it was an option  
until I just read the spec moments ago.

j.



More information about the textmate mailing list