[TxMt] Small patch to JavaScript.bundle to support reversed function declarations
Tony Arnold
Tony.Arnold at newcastle.edu.au
Thu Nov 17 02:23:26 UTC 2005
Hi all,
I've been working with too many prototype objects in javascript of
late, and as some of you may know, they are generally declared as
follows:
Sound.prototype.play = function() {
...
}
All I did was took the existing function regex, and moved a couple of
the captures:
{ name = 'meta.function.js';
match = '\b([a-zA-Z_?\.]+\w*)\s+=\s+\b(function)?\s*\((.*?)\)';
captures =
{ 1 = { name = 'entity.name.function.js'; };
2 = { name = 'storage.type.function.js'; };
3 = { name = 'variable.parameter.function.js'; };
};
},
It could probably be nicer, but pasting that in after the original
function code (in the JS language def file) will give you properly
highlighted function declarations :)
Tony Arnold
http://tonyarnold.com/
“The university was great. They gave us money and facilities,
but we didn’t have to produce anything. I’ve worked in the
private sector. You don’t know what it’s like out there. They
expect results.” -- Dr Ray Stanz, Ghostbusters
More information about the textmate
mailing list