[TxMt] C++ throw keyword in method declaration

Marc-Antoine Courteau macourteau at gmail.com
Mon Aug 27 11:45:17 UTC 2007


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 at 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 at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>



-- 
Marc-Antoine
macourteau at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070827/aa734e3e/attachment.html>


More information about the textmate mailing list