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
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)
Would this one work as well?
'\b(?i:(function|procedure))\b\s+(\w+(.\w+)?)((.*?))?;\s*(?=(? i:attribute|forward|external))';
If so, I'll go ahead and commit it.
Chris
On 3/16/07, at 10:04 AM, Chris Thomas said:
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?
Would this one work as well?
'\b(?i:(function|procedure))\b\s+(\w+(.\w+)?)((.*?))?;\s*(?=(? i:attribute|forward|external))';
Yes please. Thank you for cleaning up the regex ;)
One question: These won't be listed in the Symbol List anymore right? Or do we have to set a preference on that scope? (I'm not certain how the symbol list works).
Thanks, _Ryan Wilcox
On Mar 18, 2007, at 10:01 PM, Ryan Wilcox wrote:
On 3/16/07, at 10:04 AM, Chris Thomas said:
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?
Would this one work as well?
'\b(?i:(function|procedure))\b\s+(\w+(.\w+)?)((.*?))?;\s*(?=(? i:attribute|forward|external))';
Yes please. Thank you for cleaning up the regex ;)
One question: These won't be listed in the Symbol List anymore right? Or do we have to set a preference on that scope? (I'm not certain how the symbol list works).
Either way, I'll make sure that it doesn't show up in the Symbol List.
Chris