[TxMt] language definition regexp question

Allan Odgaard throw-away-1 at macromates.com
Fri Mar 2 09:47:14 UTC 2007


On 2. Mar 2007, at 09:39, Peter Michaux wrote:

>> Instead of one rule, make two:
>>
>>      {   match = '\b(window)\.(this|parent)\b';
>>          captures = {
>>              1 = { name = 'support.class.js'; };
>>              2 = { name = 'variable.language.this-or-parent.js'; };
>>          };
>>      },
>
> If I try the above rule alone (no other matches in the whole language
> file) it doesn't seem to work as a way to capture the "this" and
> "parent" words.

You mean it does not match them stand-alone (cause it shouldn’t,  
i.e. not the rule above), or it doesn’t match them when part of  
‘window.this’ or ‘window.parent’?

> [...]
> Did the above work for you?

I just pasted the above rule into the current JavaScript grammar (as  
the first rule) and if I press ⌃⇧P on ‘this’ or ‘parent’,  
when used after ‘window.’ it does show that they get correctly  
matched. So yes, it works for me.

Be sure to close the bundle editor after making a change to a  
grammar, to ensure it updates the various buffers.




More information about the textmate mailing list