[TxMt] C language regexp problem
Oscar Bonilla
ob at bitmover.com
Thu Jan 19 22:49:06 UTC 2006
I was looking at some C source with TextMate and it seems the C
regexp for functions is broken when there is a new line in the middle
of the argument list. What I mean is that if your functions are
defined like this:
static int
AliasCreate(
Tcl_Interp *interp, /* Interp for error reporting. */
Tcl_Interp *slaveInterp, /* Interp where alias cmd will live
or from
* which alias will be deleted. */
Tcl_Interp *masterInterp, /* Interp in which target command
will be
* invoked. */
Tcl_Obj *namePtr, /* Name of alias cmd. */
Tcl_Obj *targetNamePtr, /* Name of target cmd. */
int objc, /* Additional arguments to store */
Tcl_Obj *CONST objv[]) /* with alias. */
{
Then TextMate will not see them as functions. I tried fixing the
regexp, which is
{ name = 'declaration.function.c';
begin = '(?x)
(?: ^ # begin-of-line
| (?: (?<!else|new) (?<=\w)\s+ # or word + space before
name
| (?<!&&) (?<=[*&>])\s* # or type modifier before
name
)
)
([A-Za-z_][A-Za-z0-9_:]+) # actual name
\s*\( (?=[^)]*\) # match "(" and use look-
ahead for ")"
(\s+const)?\s* # optional const modifier
(\{|\n)) # start bracket or end-of-
line
';
end = '\)';
beginCaptures = { 1 = { name = 'entity.name.function.c'; }; };
patterns = ( { include = '$base'; } );
},
But so far, I've been unable to make it ignore new lines in the
argument list.
Does anyone have any ideas?
Thanks,
-Oscar
--
pgp fingerprint: BC64 2E7A CAEF 39E1 9544 80CA F7D5 784D FB46 16C1
More information about the textmate
mailing list