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