<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span>Hi Hans,</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span>Thanks for your reply, getting closer :-)</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span><br></span></div><div><span><font size="3">The one for call works great as it's never in the </font>beginning<font size="3"> of a line and there is always space before so this works:</font></span></div><div><span><font><div>{<span class="Apple-tab-span" style="white-space:pre"> </span>name = 'meta.call.my_LG';</div><div><span class="Apple-tab-span"
style="white-space:pre"> </span>match = '\s*(call)\s+((\w+)\w*)';</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>captures = {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>1 = { name = 'keyword.control.my_LG'; };</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>2 = { name = 'entity.name.call.my_LG'; };</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>};</div><div>},</div><div><br></div><div>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:</div><div><div>{<span class="Apple-tab-span" style="white-space:pre"> </span>name = 'meta.function.my_LG';</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>match = '^(function)\s+((\w+)\w*)';</div><div><span class="Apple-tab-span"
style="white-space:pre"> </span>captures = {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>1 = { name = 'keyword.control.my_LG'; };</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>2 = { name = 'entity.name.function.my_LG'; };</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>};</div><div>},</div></div><div><br></div><div>What am I doing wrong?</div><div><br></div><div>Thanks.</div></font></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Hans-Jörg Bibiko <bibiko@eva.mpg.de><br> <b><span style="font-weight: bold;">To:</span></b> John Relosa
<john.relosa@yahoo.com>; TextMate users <textmate@lists.macromates.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, December 29, 2011 9:50 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [TxMt] Re: Coloring for a function call<br> </font> <br>
<br>On 29 Dec 2011, at 18:18, John Relosa wrote:<br><br>> 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".<br>> <br><br>Hi,<br><br>maybe try something like (AN EXAMPLE!):<br><br>{ name = 'meta.call.your_LG';<br> match = '^\s*(call)\s+(\S+)';<br> captures = {<br> 1 = { name = 'keyword.control.your_LG'; };<br> 2 = { name = 'entity.name.type.call.your_LG'; };<br> };<br>},<br>{ name = 'meta.function.your_LG';<br> match = '^\s*(function)\s+(\S+)';<br> captures = {<br> 1 = { name = 'storage.type.function.your_LG'; };<br> 2 = { name =
'entity.name.function.your_LG'; };<br> };<br>},<br><br><br>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.<br><br>And look in other Language Grammars (C, Ruby, Python, ...) since it's a common task.<br><br>Hope it helps a bit.<br><br>Best,<br>--Hans<br><br> </div> </div> </div></body></html>