[TxMt] Python syntax breaks on # in regex string (r'#')

Dirk van Oosterbosch, IR labs labs at ixopusada.com
Wed Mar 21 21:09:14 UTC 2007


Ah, I see.

That could be cool though...
Or maybe only look for these "verbose" comments inside  
"""multiline""" patterns, since they're most useful there.

And one can also escape the comment character. This already solves  
the issue (and keeps the results of the regular expression intact!):
	some_reg_string = r'/#'

thx
d



On 21-mrt-2007, at 21:39, Alexander Ross wrote:

> Hey Dirk,
>
> I was attempting to match the comment style of "verbose" regular  
> expressions... Unfortunately, there isn't a good way to tell  
> whether or not those should be enabled, so I'm just going to remove  
> it altogether.
>
> –Alex
>
> On Mar 21, 2007, at 1:08 PM, Dirk van Oosterbosch, IR labs wrote:
>
>> Hi All,
>>
>> I just got the latest build, Version 1.5.5 (1372), and I noticed  
>> that the python language syntax is now somewhat broken for comment  
>> characters (#) inside regular expression strings r'some regular  
>> expression'.
>>
>> like:
>> 	some_reg_string = r'#'
>> shows up as illegal / incomplete syntax.
>>
>> And e.g. all my code following this line:
>> 	parentPattern = re.compile(r'^#extends (\w+)\s*$')
>> becomes:
>> source.python
>> meta.function-call.python
>> meta.function-call.arguments.python
>>
>> which is a little confusing.
>>
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070321/f65b6d5a/attachment.html>


More information about the textmate mailing list