[SVN] bundle regexp question

Chris Thomas chris at cjack.com
Thu Jun 9 23:09:20 UTC 2005


Some notes from the Ruby implementation (syntax: %q!features stolen  
from perl make me "gag"!).

1. Ruby special-cases () [] <> and {}; might wanna check whether perl  
supports those too.

2. Ruby also highlights the prefix. This is consistent with the  
highlighting of the at-sign at the start of a constant NSString  
(@"Turnips!") in Objective-C. None of this was intentional, though,  
and I don't feel strongly about it. I'll update Ruby, at least, to  
whatever you come up with.

You might try something like:

>
>         {    name = "string.unquoted.qq";
>             begin = "qq(.)";
begin = "(qq)(.)";
>             end = "\\1";
             end = "\\2";
>             swallow = "\\\\.";
beginCaptures = {"keyword.string-prefix"}; // or whatever
>         },

Chris

On Jun 9, 2005, at 2:09 PM, Eric Hsu wrote:

> I was trying to fix the Perl bundle to support the qq function  
> which allows new quotes like
>
> qq!I am an
> "annoying" new line
> quote!;
>
> using
>
>         {    name = "string.unquoted.qq";
>             begin = "qq(.)";
>             end = "\\1";
>             swallow = "\\\\.";
>         },
>
> I got it to work almost perfectly. However, the 'qq' gets  
> highlighted, which looks slightly silly to me. I tried to add
>
>     patterns = ( { match = "\\1\\b.*\\b\\1"; } );
>
> to the search, which resulted in sporadic crashing and console  
> error messages
>
>
>> 2005-06-09 14:01:24.488 TextMate[27466] Exception raised during  
>> posting of notification.  Ignored.  exception: *** -[NSCFArray  
>> objectAtIndex:]: index (0) beyond bounds (0)
>> 2005-06-09 14:01:24.495 TextMate[27466] Exception raised during  
>> posting of notification.  Ignored.  exception: *** -[NSCFArray  
>> objectAtIndex:]: index (0) beyond bounds (0)
>> TextMate regular expression error
>> Anonymous rule
>> Error: invalid backref number/name for pattern \1\b.*\b\1
>>
>
> Anyway, I'm taking suggestions about what to do about the qq and  
> also making a note to Allan that this is another obscure way to  
> crash TM.
>
> best, Eric
> ---
> Eric Hsu, Assistant Professor of Mathematics
> San Francisco State University
> erichsu at math.sfsu.edu
> http://math.sfsu.edu/hsu
>
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate-dev
>
>




More information about the textmate-dev mailing list