[TxMt] [Pascal Bundle] Better Function Pattern Suggestion

Ryan Wilcox ryanwilcox at mac.com
Thu Mar 15 20:30:57 UTC 2007


Hello all,

I use the Pascal bundle quite a bit, and I've been annoyed that it can't tell the difference between declarations/prototypes of functions and definitions of functions.

I'll give you that this is tricky - in Pascal they both mostly look the same, and what they are is really determined by the next line (which would be a BEGIN if it was a definition)

FUNCTION aTest(varName: theType);


However, there is two cases where such a difference can be seen easily: the forward keyword and the external keyword

FUNCTION aTest(varName: theType); FORWARD; 
{a prototype of a function found later in the file}

FUNCTION aTest(varName: theType); EXTERNAL;
{EXTERNAL is just like C's extern keyword}

And, in GPC (the Gnu Pascal Compiler) there's also:

FUNCTION aTest(varName: theType); attribute (name = 'aTest');
{You could see this kinda like declaring a prototype in C -
    functions above this in the file OR outside the file
    can call this function
}

Can we make the Pascal bundle use the following regular expression in the meta.function.prototype.pascal scope (so then we can use a preference to turn off their appearance in the symbol list?

\b(?i:(function|procedure))\b\s+(\w+(\.\w+)?)(\(.+?\)); (attribute|forward|external)   

Or other thoughts etc would be appreciated - this could be an inefficient way of doing this.

Thanks In Advance,
_Ryan Wilcox

-- 
Wilcox Development Solutions:          <http://www.wilcoxd.com>
Toolsmiths for the Internet Age            PGP: 0x2F4E9C31



More information about the textmate mailing list