[TxMt] syntax highlighting in perl bundle

Barry Walsh baz at draegtun.com
Thu Jun 5 18:56:52 UTC 2008


Andy Armstrong wrote:
> On 4 Jun 2008, at 19:26, bin at cox.net wrote:
>> can anyone tell me why the perl bundle treats the letter 's' oddly 
>> when it is used as a hash index?  for example the statements
>>
>> $OPT{w} = 'a';
>> $OPT{s} = 'a';
>>
>> are highlighted differently.  what's up?
>
>
> Oh yeah. Heh. I wonder if it's getting confused by a rule somewhere 
> that's supposed to handle s///.
>
It certainly is s/// causing the confusion ;-(     Strangely tr/// 
doesn't  ;-)       

Have a look a colour syntax on these different lines....

$OPT{ s } = 'a';   # => ok
$OPT{'s'} = 'a';   # => ok
$OPT{tr}  = 'a';   # => ok!
s/from/to/;        # => ok
s{from}{to};       # => ok
tr/A/B/;           # => ok
tr{A}{B};          # => Nope!

The grammar regex below is being incorrectly used in the $OPT{s} example....

        {   comment = 'string.regexp.replace.perl';
            begin = '\b(?=(s)(\s+\S|\s*[;\,\#\{\}\(\)\[<]|$))';
            end = '((([egimosx]*)))(?=(\s+\S|\s*[;\,\#\{\}\)\]>]|$))';
            endCaptures = {
                1 = { name = 'linomuck.regexp.replace.perl'; };
                2 = { name = 'punctuation.definition.linomuck.perl'; };
                3 = { name = 'keyword.control.regexp-option.perl'; };
            };
       ==snip==

Grrrr....  first time I've looked at this grammar file so not sure what 
"best" fix is?

--
/I3az/



More information about the textmate mailing list