[TxMt] language definition regexp question
Allan Odgaard
throw-away-1 at macromates.com
Fri Mar 2 07:03:51 UTC 2007
On 1. Mar 2007, at 21:32, Peter Michaux wrote:
> In JavaScript I would like every instance of the word "self" and
> "parent" to be orange except when they appear as "window.self" or
> "window.parent". How can I specify these. What I have so far is...
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'; };
};
},
{ name = 'variable.language.js';
match = '\b(super|this|parent)\b';
}
The first one explicitly matches window.this and window.parent. This
and parent is still marked up as variable.language, so with no theme
modifications, it will show the same.
But you can now style all but window.(this|parent) using a scope
selector of:
variable.language - variable.language.this-or-parent
Likewise you can style just window.(this|parent) with:
variable.language.this-or-parent
More information about the textmate
mailing list