[TxMt] syntax highlighting in perl bundle

Barry Walsh baz at draegtun.com
Thu Jun 5 19:37:51 UTC 2008


LOL... ignore that lilomuck bit!   Thats me just playing around with 
grammar file in Textmate to make it easier for me to spot how it all worked!

This is the correct lines in question.....

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


Now what context this bit of grammar is really for I don't know.   From 
what I can see the other examples I gave don't use above. 

Perhaps the original author of this grammar can shed light on this and 
make the proper changes.


--
/I3az/


Barry Walsh wrote:
> 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/
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>




More information about the textmate mailing list