When writing C++ code in TextMate, it appears that the method names are not well detected when I use the throw([^)]*) keyword on my method declarations, as in this example:
void Foo::Bar(int argument) const throw() { /* ... */ }
or like this:
void Foo::Bar(int argument) const throw(std:exception, int) { /* ... */ throw std::exception("exception message"); /* ... */ throw 42; /* ... */ }
When I use the throw keyword on my method declarations, the method name detected by TextMate is "throw", which isn't really useful, especially when all the method names are detected as "throw". How can I fix this to ensure TextMates resolves the proper names?
Thanks for your help,
Marc-Antoine Courteau
On Aug 27, 2007, at 12:55 AM, Marc-Antoine Courteau wrote:
[...] When I use the throw keyword on my method declarations, the method name detected by TextMate is "throw", which isn't really useful, especially when all the method names are detected as "throw". How can I fix this to ensure TextMates resolves the proper names?
Bundles -> Bundle Editor -> Edit Languages…
There is a large pattern (regexp) to match (member) function (implementations/declarations) in the C and C++ grammars, this/these patterns would be expanded to also deal with throw.
I don’t think the change is too difficult -- do let me know if you add it, and I can roll it into the official language grammar.
I came up with this:
(?:\s+throw\s*([^)]*))?\s* # optional throw modifier
to place between the "optional const modifier" and "start bracket or end-of-line" bor both meta.function.c and meta.function.prototype.c; however it only works when the "const" specifier isn't part of the method, such as in this case:
int Foo::Bar(int parameter) const throw() { /* ... */ }
I'm not a regex guru so there's probably something I'm doing wrong. Any input to fix this completely would be greatly appreciated.
Marc-Antoine Courteau
On 8/27/07, Allan Odgaard throw-away-1@macromates.com wrote:
On Aug 27, 2007, at 12:55 AM, Marc-Antoine Courteau wrote:
[...] When I use the throw keyword on my method declarations, the method name detected by TextMate is "throw", which isn't really useful, especially when all the method names are detected as "throw". How can I fix this to ensure TextMates resolves the proper names?
Bundles -> Bundle Editor -> Edit Languages…
There is a large pattern (regexp) to match (member) function (implementations/declarations) in the C and C++ grammars, this/these patterns would be expanded to also deal with throw.
I don't think the change is too difficult -- do let me know if you add it, and I can roll it into the official language grammar.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate