Ampersand |
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:
type 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.
There is a case where the same identifiers are used with and without the ampersand.
TState = (Start, &Property, ObjectStart, &Object, ArrayStart, &Array, ConstructorStart, &Constructor, Closed, Error);
and e.g.
if FCurrentState = TState.Property then
then the identifier notations should be defined in the file for the identifiers in a unique way, e.g.:
&Array &Constructor &Object &Property Array Constructor Object Property
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...
&End
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |