[TxMt] perl syntax color oddity

Dallas Kashuba dallas at dreamhost.com
Sat Oct 13 00:46:55 UTC 2007


I've just started using TextMate for perl editing and I noticed today  
when I opened up a file that this line of code confusing the syntax  
coloring...

if ($link eq '' || $user eq '' || $user =~ / / || $link =~ / /) { ... }


TextMate saw a string starting at the first ~ and never stopping.

I looked through the bundle and I found what seemed to be the problem  
here...


{	name = 'string.regexp.find.perl';
	match = '(?<!\\)((~\s*)?\/)(\S.*?)(?<!\\)(\\{2})*(\/)';
	captures = {
		1 = { name = 'punctuation.definition.string.perl'; };
		5 = { name = 'punctuation.definition.string.perl'; };
	};
},


The \S there is matching any non-whitespace character so it doesn't  
like the space character being used between the //.  I changed that  
match line to this and it seems to have fixed it for me...


match = '(?<!\\)((~\s*)?\/)([\S| ].*?)(?<!\\)(\\{2})*(\/)';


Is there any reason that's not a wise change to make?

Thanks for any info,
	Dallas





More information about the textmate mailing list