Hello and Happy New Year!

Does any of the TxMt gurus know why the below does not work?

Message: 5
Date: Thu, 29 Dec 2011 11:27:01 -0800 (PST)
From: John Relosa <john.relosa@yahoo.com>
To: textmate <textmate@lists.macromates.com>
Subject: [TxMt] Re: Coloring for a function call
Message-ID:
    <1325186821.60244.YahooMailNeo@web121902.mail.ne1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Hans,

Thanks for your reply, getting closer :-)

The one for call works great as it's never in the?beginning?of a line and there is always space before so this works:

{name = 'meta.call.my_LG';
match = '\s*(call)\s+((\w+)\w*)';
captures = {
1 = { name = 'keyword.control.my_LG'; };
2 = { name = 'entity.name.call.my_LG'; };
};
},

I cannot make it to work for the function though which is always in the beginning of a line with no space before it. 

I removed the \s* and replaced it with the ^ (start of line anchor) but it does NOT seem to work:

{name = 'meta.function.my_LG';
match = '^(function)\s+((\w+)\w*)';
captures = {
1 = { name = 'keyword.control.my_LG'; };
2 = { name = 'entity.name.function.my_LG'; };
};
},

What am I doing wrong?

Thanks.


From: Hans-Jörg Bibiko <bibiko@eva.mpg.de>
To: John Relosa <john.relosa@yahoo.com>; TextMate users <textmate@lists.macromates.com>
Sent: Thursday, December 29, 2011 9:50 AM
Subject: Re: [TxMt] Re: Coloring for a function call


On 29 Dec 2011, at 18:18, John Relosa wrote:

> What I was hoping to have is have the arbitrary name of the function "xyz_any_function_name" have a color red when it's defined(after the word "function") or when it's called(after the word "call".
>

Hi,

maybe try something like (AN EXAMPLE!):

{    name = 'meta.call.your_LG';
    match = '^\s*(call)\s+(\S+)';
    captures = {
        1 = { name = 'keyword.control.your_LG'; };
        2 = { name = 'entity.name.type.call.your_LG'; };
    };
},
{    name = 'meta.function.your_LG';
    match = '^\s*(function)\s+(\S+)';
    captures = {
        1 = { name = 'storage.type.function.your_LG'; };
        2 = { name = 'entity.name.function.your_LG'; };
    };
},


If you assign the same name for the 2. match in 'call' and 'function'  or you write (function|call) the function name will appear in the same colour.

And look in other Language Grammars (C, Ruby, Python, ...) since it's a common task.

Hope it helps a bit.

Best,
--Hans