[TxMt] [Pascal Bundle] "Unit Test" For Pascal definitions vs prototypes

Ryan Wilcox ryanwilcox at mac.com
Tue Jun 26 00:37:18 UTC 2007


Hello all,

I use the Pascal bundle quite a bit, and - while the Pascal bundle is MUCH better about understanding what a (to use the C term) prototype is vs a definition, it still fails when looking at functions (pascal methods that return a value).

So: it doesn't know that "FUNCTION something: Boolean; forward;" is supposed to be a prototype. It does work, however, with procedures (pascal methods that don't return values): "PROCEDURE something; forward;" is known to be a prototype, and is rightly marked as such.

I'll also admit I'm partially to blame for this: in March (15th) when I suggested a regex on how to find a prototype, my examples were wrong: I had improperly labelled my PROCEDURES as FUNCTIONS.

After my .sig in this email is a test case for prototypes vs definitions in Pascal, with 10 kinds of prototypes and 5 different kinds of definitions.

FWIW, I also had to create a new preference item, to turn off ShowInSymbolList for meta.function.prototype.pascal, entity.name.function.prototype.pascal, to get even Procedures to be ignored. I'm not sure what's up with that...

Hopefully the unit test will help get this bug nailed down once and for all, and someone who's more familiar with the prototype regex than I (Chris Thomas??) can add this to it.

Thanks very much,
_Ryan Wilcox

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

{___________________________________________________________________}
INTERFACE

{You shouldn't see any of the 10 declarations, below this point, on the Symbol List}
FUNCTION 1.ExternalFunctionDefinitionPrototype(param: type): Boolean; external;

FUNCTION 2.FunctionNoParamPrototype: Boolean; attribute (name = 'FunctionNoParam');

FUNCTION 3.FunctionParameterPrototype(param: type): Boolean; attribute (name = 'FunctionParameterPrototype');

FUNCTION 4.FunctionForwardNoParamPrototype: Boolean; forward;

PROCEDURE 5.ProcExternalDefinitionPrototype(param: type); external;

PROCEDURE 6.ProcParamPrototype(param: type); attribute (name = 'ProcNoParamPrototype');

PROCEDURE 7.ProcNoParamPrototype; attribute (name = 'ProcNoParamPrototype');
	
PROCEDURE 8.ProcNoParamForwardPrototype; forward;
	
PROCEDURE 9.ProcParamForwardPrototype(param: type); forward;

procedure 10.bob(something: somethingElse); external;


IMPLEMENTATION

{You SHOULD see the 5 definitions, below this point, on the Symbol List}
FUNCTION 1.FunctionNoParamFunction: Boolean;
BEGIN
	
END;

FUNCTION 2.FunctionParameterFunction(param: type): Boolean;
BEGIN

END;

PROCEDURE 3.ProcNoParamProcedure(param: type);
BEGIN
	
END;

PROCEDURE 4.ProcParamProcedure(param: type);
BEGIN
	
END;

PROCEDURE 5.ProcNoParamProcedure;
BEGIN
	
	
END;


{___________________________________________________________________}



More information about the textmate mailing list