Top  Previous  Next

What is translated > Tokens > Ampersand


By means of an ampersand Delphi keywords can be used as identifiers, e.g. \Embarcadero\Studio\19.0\source\rtl\win\winrt\WinAPI.ShlObj.pas  line 11032:



  tagDROPDESCRIPTION = record 

    &type: TDropImageType;   



In such cases it is recommended either to let the pre-processor substitute such expressions or to modify the source code. Otherwise Delphi2C# simply ignores such ampersands, that means "&type" becomes "type". In that case the parser will stop at that position, because of the unexpected type keyword. If "&type" is substituted for example by "amps_type" everything works well. You even can let the translator make a second substitution from "amps_type" to "type", if you like. This substitution is made after "amps_type" has been recognized as an identifier.



Another example is in  \Embarcadero\Studio\19.0\source\rtl\win\winrt\WinAPI.DataRT.pas  line 598:



property &Implementation: Xml_Dom_IXmlDomImplementation read get_Implementation;



\rtl\win\winrt\WinAPI.Devices.pas line 6078:



property &Function: Word read get_Function;



\rtl\win\winrt\WinAPI.CommonTypes.pas line 138/439/544/6163...








This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content