Unit ok_hint_directives
Description
Warning: this symbol is deprecated.
Warning: this symbol is specific to some platform.
Warning: this symbol is specific to some library.
Test parsing "platform", "library" and "deprecated" directives (called collectively "hint directives") by pasdoc.
Related tracker bug: [ 1196073 ] "some modifiers are not parsed".
We want to support all situations where these directives are allowed in modern FPC (>= 2.5.1) and Delphi. Their placement in unfortunately not consistent, thanks go to Borland. Quoting Delphi help (from Kylix 3): "Hint directives can be applied to type declarations, variable declarations, class and structure declarations, field declarations within classes or records, procedure, function and method declarations, and unit declarations."
Summary:
Between "unit UnitName" and hints you mustn't put any semicolon, and you mustn't put any semicolons between hints.
Same thing for CIOs (Classes / Interfaces / Objects / Records).
Same thing for CIOs fields.
Same thing for variables.
Same thing for constants.Between "procedure/function Name (...)" and hints you must put a semicolon, and semicolons between hints are allowed but not required. It seems that you can't specify "library" directive for procedures/functions – why? Probably because "library" is a keyword and Borland was unable to correctly modify it's compiler to parse such thing. But pasdoc parses library directive correctly.
Between method and hints you must put a semicolon, and semicolon between hints is required. You can specify "library" directive for methods.
I'm unable to figure out how to specify these hints for normal (non-structural) types. If anyone can
tell me how to specify hint directives for non-structural types or
explain why parsing these directives is so weird and inconsistent in Delphi or
point me to some precise documentation by Borland specifying grammar rules with these directives
... then please send email about this to pasdoc-main mailing list (or directly to me, Michalis Kamburelis, <kambi@users.sourceforge.net>, if your comments about this do not really concern pasdoc). I will be grateful.
Contrary to most units in tests/, this unit is kept at compileable by Delphi/Kylix and FPC. That's because this unit is also a test whether we really specify here hint directives in the way parseable by Delphi/Kylix.
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Class TTestClassDeprecated |
|
Record TTestRecordDeprecated |
Functions and Procedures
function TestFuncCombined(SomeParams: Integer): Integer; deprecated; platform; |
function TestFuncDeprecated: Integer; deprecated; |
function TestFuncPlatform: Integer; platform; |
procedure TestProcCombined(SomeParams: Integer); deprecated platform; |
procedure TestProcDeprecated; deprecated; |
procedure TestProcPlatform; platform; |
Constants
TestConstPlatform = 1 platform; |
TestConstLibrary = 2 library; |
TestConstDeprecated = 3 deprecated; |
TestConstCombined = 4 deprecated library platform; |
Variables
TestVarPlatform: Integer platform; |
TestVarLibrary: Integer library; |
TestVarDeprecated: Integer deprecated; |
TestVarCombined: Integer library deprecated platform; |
Description
Functions and Procedures
function TestFuncCombined(SomeParams: Integer): Integer; deprecated; platform; |
Warning: this symbol is deprecated. Warning: this symbol is specific to some platform. |
function TestFuncDeprecated: Integer; deprecated; |
Warning: this symbol is deprecated. |
function TestFuncPlatform: Integer; platform; |
Warning: this symbol is specific to some platform. |
procedure TestProcCombined(SomeParams: Integer); deprecated platform; |
Warning: this symbol is deprecated. Warning: this symbol is specific to some platform. |
procedure TestProcDeprecated; deprecated; |
Warning: this symbol is deprecated. |
procedure TestProcPlatform; platform; |
Warning: this symbol is specific to some platform. |
Constants
TestConstPlatform = 1 platform; |
Warning: this symbol is specific to some platform. |
TestConstLibrary = 2 library; |
Warning: this symbol is specific to some library. |
TestConstDeprecated = 3 deprecated; |
Warning: this symbol is deprecated. |
TestConstCombined = 4 deprecated library platform; |
Warning: this symbol is deprecated. Warning: this symbol is specific to some platform. Warning: this symbol is specific to some library. |
Variables
TestVarPlatform: Integer platform; |
Warning: this symbol is specific to some platform. |
TestVarLibrary: Integer library; |
Warning: this symbol is specific to some library. |
TestVarDeprecated: Integer deprecated; |
Warning: this symbol is deprecated. |
TestVarCombined: Integer library deprecated platform; |
Warning: this symbol is deprecated. Warning: this symbol is specific to some platform. Warning: this symbol is specific to some library. |